[comp.sys.mac.misc] Source distribution .. Summary

RMG3@psuvm.psu.edu (09/19/90)

In article <90256.140224RMG3@psuvm.psu.edu> I wrote:

>  Questions:
>(1) What language is most common on Macs?
>(2) In my limited experience on Macs, it seems that you can easily spend
>50 to 100 lines just doing all the initializations required.
>What is a reasonable guess for the number of lines required for minimal
>  initialization?    _or_
>   Can I reasonably assume that anyone who has a language on a Mac is already
>able to set up the initializations?

  My thanks to the people who responded on this.  I completely overlooked
Hypercard.  I think that may be related to the fact that Apple didn't see
fit to include a copy of the intro to scripting guide with my copy of
Hypercard. (Apple please take note.)

  The brief summary of the responses is that
1) The most commonly available language is Hypertalk (nearly universal)
2) Hypertalk will take care of the general overhead of running on a Mac
without requiring user knowledge.

Thanks again,
Bob Grumbine a.k.a. rmg3@psuvm.psu.edu

Less Brief (in their original words):
===============================
Dave Steffen

>Question
I don't know what is most common; I hear most about Think C, which I do
not use.  I use Turbo Pascal and Microsoft Basic.  From your
description, I suspect Think C would be totally inappropriate for the
kind of programs you are talking about.  I suggest Microsoft Basic
(see below).

>Question 2

Both Microsoft Basic and Turbo Pascal allow you to start programming
with -no- initialization.  In the case of Turbo Pascal, the compiler
turns your Mac into a relatively dumb terminal and goes from there.
In the case of Microsoft Basic, the interpreter (or compiler) gives
you a reasonably useful set of default Mac-like things to play with.
For having fun/100 line programs I HIGHLY recommend Microsoft Basic.
It is reasonably compatible with other Microsoft basics (I have moved
programs from my Northstar with relatively few changes) it is cheap
(ca. $100 or less) and if you want to play with a few windows or
buttons, no sweat.
===========================================
From: convex!ewright@uxc.cso.uiuc.edu (Edward V. Wright)

>  Question 1

For professional programs, there is a roughly equal split between C
and Pascal. For people who just want to tinker a bit, HyperTalk is
probably the most popular.


> Question 2

Geez, I don't know where to begin.

I assume that when you talk about "initialization" you really mean
the code that creates the Mac interface.  The actual initializations
take about a dozen lines of code, depending on what managers your
program is going to use.

If you're talking about a full-blown Mac-like application, since so
many parts are standard, practically no one writes that sort of program
from scratch.  Some start with an existing, some use a source generator
such as Prototyper to create the source for the interface, and some use
object-oriented libraries to create the interface.

Most C and Pascal compilers provide some means of compiling a textbook
program to run on a simulated glass CRT, so you can write a program
(though not of professional quality) without ever worrying about the
Mac interface.

And if you're programming in HyperTalk, you don't have to worry about
creating the interface since HyperCard handles it.

=====================================
From: gt0831c@prism.gatech.edu (William Moss)

> Question 1

  Clearly the most common language is Hypercard.  Its programming parts
are similar to basic.  Take a look at some of the hypercard magazines
for ideas on how to compactly distribute the code.
  Unfortunately most of these Hypercard mags emphasize the whizzy aspects
of Hypercard and never really provide a basic grounding in traditional
programming techniques.

=========================================================================
From: rmh@apple.com (Rick Holzgrafe)

> -- combined answer

I can't imagine doing *anything* very useful or interesting in 100 lines
or less on a Mac, if you are using any language such as Pascal, C, Asm, or
BASIC. To fit a program into such a small space, you must work in some
environment that does most of the human interface work for you. (Human
interface is what makes Mac programs large and complex: ease of use for
the user is bought at the price of more work for the programmer.)

Three possibilities are MacApp, Think C 4.0, and HyperCard; each goes a
long way toward automating and hiding the drudgery of programming the user
interface. Unfortunately you probably won't get wide interest with either
MacApp or Think C. These are for professionals and serious hobbyists, and
not for the 100-line type-it-in-verbatim dilletante. (They are expensive,
difficult to learn, and unlikely to be owned by anyone who isn't already
pretty familiar with them.)

HyperCard sounds like a good bet. It comes free with every Macintosh, so
nearly everyone has it these days. It is easy to manipulate buttons,
graphics, and text fields without any programming at all, so much of the
user interface stuff needn't be addressed in your column. The built-in
programming language, HyperTalk, is easy to read and not too hard to
write, and lends itself nicely to 50- to 100-line examples. Like BASIC, it
is interpreted and the user can get fast turn-around to test his stuff,
and never has to mess with a compiler or linker. Finally, hacking
HyperCard is tons of fun - I do it all the time, as a pleasant break from
more demanding work in assembler, C, and C++.

Hope this helps.

=========================================================================
From: Ralph Melton <ralphm@portia.stanford.edu>

> -- combined response

IMHO, Pascal is probably the language of choice for source code samples.  Most
programmers, I think, use Pascal or C.  My impression is that Pascal is much
easier for a C programmer to read than C is for a Pascal programmer.

It is also true, though, that the only language available at a cost that is
reasonable for a non-programmer to pay is Hypertalk, the language of Hypercard.
Hypercard has good and bad aspects for your friend's purpose:

It is very readable.  Even without any Hypercard experience, it's often easy
to figure out what's happening.

It does all the initialization for you.  A simple "neat graphic thingy"
program in Hypertalk has a much greater fraction of its code doing neat graphics
than an equivalent stand-alone application in C.

It's common.  It now comes bundled with the Mac, so many users will have it.

It is, however, very wordy.  It would be hard to fit as much functionality into
50-100 lines.

Also, the structure of a Hypercard script also depends on the structure of the
stack and the layout of fields and buttons.  This could be difficult to show
in a magazine article.

Just my $0.02 . . .
=========================================================================
From: <cfranz@inf.ethz.ch> christian franz

> Combined response

bob,
programming for the mac is completely different from programming a dos
machine. you have to understand the concept of resources and data en-
capsulation (object-oriented programming).
there are quite a few good programming languages/environments for the mac,
but certainly basic is not the most common one.
i guess hypercard is one of the most popular languages (or better: most
widespread) on the mac.
the classic languages for the mac are pascal and c. i favor pascal (the
best pascal i've seen is THINK pascal, sometimes called lightspeed pascal),
because of its rigid type-enforcement (ok, ok, i *hate* c, for it reminds
me too much of my old assembler days).
initialization of the mac is not that bad, it usually doesn't take more
than 6 calls to the corresponding managers (not the apple CEOs :-).
With pascal you can build units, so maybe you divide your column into
creating different units and resources.
then you can import these units and use the init-routines etc.

=========================================================================
From: claris!ClarisII!drc@ames.arc.nasa.gov (Dennis Cohen)

> Question 1

Unfortunately, the most COMMON is HyperTalk, the scripting language in
HyperCard.

If you are talking about compiled/interpreted languages which allow you to
create standalone applications, it is pretty much a toss-up between Pascal
and C (regardless of the C bias you see on the net, which stems from the
unix-oriented nature of this population).

> Question 2
Minimal initialization, including the creation of a couple of menus is
probably about 25 lines.

>   Can I reasonably assume that anyone who has a language on a Mac is already
>able to set up the initializations?
No way you can assume that!

=========================================================================
From: awessels@ccwf.cc.utexas.edu (Allen Wessels)

> Question 1

The most popular languages among programmers of the Mac are C and Pascal.  The
only analogous "language" to the BASIC that comes with DOS is HyperCard.  You
could easily run BASIC programs written for the IBM on the Mac with only a few
changes, especially if the BASIC program doesn't do graphics.
=========================================================================
From: bristor@midori.Eng.Sun.COM (David Bristor)
> Question 1
HyperCard

=========================================================================

From: Christian Franz <cfranz@inf.ethz.ch>

> Question 2 follow-up
there was something i forgot to mention, though.
think c, pascal, most basic compilers etc. all have some kind of terminal
emulation than can even use graphics. this means, if you dont initialize
the toolbox, the compiler defaults to its own windows and keeps track of
your output. notably think and turbo pascal do this, i'm not sure about
zbasic. anyway, in my opinion, you should use pascal and *not* use
hypercard, because the algorithm will get lost in hypercard.

i hope this info helped you. good luck,