[comp.sys.mac.programmer] TCL or not

dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) (11/19/90)

I am starting to program the Mac in Think C (thanks to all those who
made recommendations about programming environments).  I have worked
through some examples and feel fairly comfortable with the non-TCL
part of Think C.  I have looked at TCL (skimmed through the manual and
looked at the sample programs).

My impression is that TCL will be very useful in the long-run, but the
startup time will be very long.  TCL seems to be very complicated
(every subclass has to interact with so many other things).  It seems
that writing a simple program is complicated, but writing a
complicated program will eventually be easier (than without TCL).

My questions:
(1) Am I right about TCL?
(2) Is there something I can do to get moving quickly with TCL?
(3) If I start writing a simple program without TCL, will I be able to
    incorporate TCL into that program as I expand it?

Thanks for any help.

--
David M. Marcovitz                     |  internet: marcovitz@uiuc.edu
Computer-based Education Research Lab  |            dmmg1176@uxa.cso.uiuc.edu
University of Illinois                 |  novanet:  marco / cca / cerl

sharp@cs-sun-fsd.cpsc.ucalgary.ca (Maurice Sharp) (11/19/90)

    USE IT !! It is worth the startup time to learn. It will make your
life a lot easier when it comes to modifying your code, tracking down
bugs, etc. Also, there is a devloping library of public domain and
fairly inexpensive classes.

    There is a magazine (Prepare) that includes classes that work with
TCL, there is an ftp site (ics.uci.edu /mac/think-c) that contains
classes, and there is a user society (Splash) with a journal
containing classes and code.

	hope this helps
		maurice



-- 
Maurice Sharp MSc. Student (403) 220 7690
University of Calgary Computer Science Department
2500 University Drive N.W.	      sharp@cpsc.UCalgary.CA
Calgary, Alberta, T2N 1N4	      GEnie M.SHARP5

jmunkki@hila.hut.fi (Juri Munkki) (11/19/90)

In article <1990Nov19.033226.28411@ux1.cso.uiuc.edu> dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) writes:
>My impression is that TCL will be very useful in the long-run, but the
>startup time will be very long.  TCL seems to be very complicated
>(every subclass has to interact with so many other things).  It seems
>that writing a simple program is complicated, but writing a
>complicated program will eventually be easier (than without TCL).

I haven't programmed with TCL, but I've read the manuals and the next
project that is suitable for TCL will be written with TCL.

What are you going to use, if you don't use TCL? I guess you'll have to
use the toolbox directly. It takes quite a long time to learn how to
use the toolbox, so if you haven't programmed the Mac before, it will
probably require more work than starting with TCL.

Even though TCL handles a lot of toolbox stuff, you will eventually have
to learn to use the toolbox too.

I learned Macintosh programming with MacForth (in 1984). It enforced its
own ideas about windows, menus and especially dialogs. (no dialog window
support!)  It took me quite a while to get used to programming in C, but
I like the total control that it gives me over the Macintosh. Having a
(buggy) kernel someone else wrote running UI things limited things quite
a lot.

From what I understand, TCL doesn't have serious bugs and since you get
source code for it, you can always fix anything you don't like. This is
why TCL is different from the interfaces that MacForth and Mach (another
Forth implementation on the Mac) offered.

   ____________________________________________________________________________
  / Juri Munkki	    /  Helsinki University of Technology   /  Wind  / Project /
 / jmunkki@hut.fi  /  Computing Center Macintosh Support  /  Surf  /  STORM  /
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

nick@cs.edinburgh.ac.uk (Nick Rothwell) (11/20/90)

In article <1990Nov19.033226.28411@ux1.cso.uiuc.edu>, dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) writes:
> My impression is that TCL will be very useful in the long-run, but the
> startup time will be very long.  TCL seems to be very complicated
> (every subclass has to interact with so many other things).  It seems
> that writing a simple program is complicated, but writing a
> complicated program will eventually be easier (than without TCL).

I suggest you go for the TCL.

There are quite a few "gotchas" involving it - for example, the way that
certain classes get Deactivate() calls while they're being disposed of,
and things like this. But then, the Mac is like that, and doing it without
using the TCL would give you the same kinds of problems (only more so).

Using the TCL also means that you can dispense with the bizarre behaviour
of the Control Manager for a lot of things, and bypass the Dialog Manager
for controls panels and the like (there are pros and cons to this).

Oh, the TCL is rather slow compared to stuff written directly on the
ToolBox (so it seems to me, but then I'm running MIDI Manager as well...).
That's the price of convenience...

> (2) Is there something I can do to get moving quickly with TCL?

You could join the THINK C mailing list (think-c@ics.uci.edu).

> (3) If I start writing a simple program without TCL, will I be able to
>     incorporate TCL into that program as I expand it?

I would doubt it. I wrote one large (20000 line) program without the TCL,
and decided to completely rewrite it using the TCL (mostly done now - about
10 weeks work). The data scoping and localisation was totally different.

-- 
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
 "You ain't seen nothing yet. I can take this floor out, too. No trouble."

minow@mountn.dec.com (Martin Minow) (11/20/90)

In article <1990Nov19.033226.28411@ux1.cso.uiuc.edu>
dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) writes:
>
>My impression is that TCL will be very useful in the long-run, but the
>startup time will be very long. ...
>My questions:
>(1) Am I right about TCL?

I would agree.  For me, the hardest part of TCL was getting enough courage
to actually start writing something.  I'm still thumbing through the
manual about every ten minutes.   It turned out to have a fairly high
threshold (i.e, getting a document/window/pane on the screen), but things
are much smoother now.

>(2) Is there something I can do to get moving quickly with TCL?

Jump in.  Take the sample editor application and make it do something
else (in fact, I'd recommend starting by *removing* anything resembling
scrolling and just use static panes and buttons and other simple stuff.

>(3) If I start writing a simple program without TCL, will I be able to
>    incorporate TCL into that program as I expand it?

If you carefully separate computation from user-interface, the computation
part will translate reasonably easily.  However, there are some TCL features
such as using the CLlist class and DoForEach to replace vectors and for-loops
that require some re-thinking.  I'd recommend biting the bullet and plunging
in, but documenting your code so you can re-target it when the next great
advance in computing theory comes along next month.

One significant advantage of TCL is that one might hope that the nice folks
at Think will worry about System 7's new features (such as Apple Events).
The System 7 beta CD had a patch kit for ThinkC that fixed some problems
with the debugger and added header files.

One thing I'd appreciate was a way to look at a class and see all of
the methods and variables it inherits.  I.e., to look at the documentation
for CList and see GetNumItems (which is in CCluster) -- that would cut
down the pain of dealing with the documentation.

Martin Minow
minow@bolt.enet.dec.com

dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) (11/20/90)

I've gotten a few responses, and they all say to go with TCL.
However, I am finding it difficult to get started.  Are there any
books or tutorials available that can help me.  I recently read the
"Mac Programming Primer" (written before TCL), and I am now fairly
comfortable with non-TCL Think C.  Is there something like this
available for TCL?


--
David M. Marcovitz                     |  internet: marcovitz@uiuc.edu
Computer-based Education Research Lab  |            dmmg1176@uxa.cso.uiuc.edu
University of Illinois                 |  novanet:  marco / cca / cerl

dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) (11/20/90)

>I've gotten a few responses, and they all say to go with TCL.
>However, I am finding it difficult to get started.  Are there any
>books or tutorials available that can help me.  I recently read the
>"Mac Programming Primer" (written before TCL), and I am now fairly
>comfortable with non-TCL Think C.  Is there something like this
>available for TCL?

Apparently, there is a volume II to the "Mac Programming Primer".
This covers TCL.  I'm going to have to check this out.

--
David M. Marcovitz                     |  internet: marcovitz@uiuc.edu
Computer-based Education Research Lab  |            dmmg1176@uxa.cso.uiuc.edu
University of Illinois                 |  novanet:  marco / cca / cerl

omh@cs.brown.edu (Owen M. Hartnett) (11/20/90)

>> (2) Is there something I can do to get moving quickly with TCL?

You could also get AppMaker.  AppMaker is an application generator which
generates code for the TCLs.  I've found is useful to build my interface
and watch how AppMaker constructs the classes.  You later have to override
a lot, but at least you've got a start.

AppMaker produces very good code - this is its strong point.

Disclaimer:  Although I know the author from the Boston Computer Society,
the above endorsement will not give me any personal advantage.

-Owen


Owen Hartnett				omh@cs.brown.edu.CSNET
Brown University Computer Science	omh@cs.brown.edu
					uunet!brunix!omh
"Don't wait up for me tonight because I won't be home for a month."