Hi Dan!
Feel free to ask more - below follows a "get into the water" recipe for building web apps (which I presume you want to do).
Dan Ingalls Dan@SqueakLand.org wrote:
Folks -
I've never run a server in Squeak (or anything else for that matter (of course)). I thought it would be easiest to start with a Swiki, get it going, understand it, and then subvert it to the real purpose I have in mind.
Some words about the "real purpose" would make it a bit easier to give advice. :)
Can someone please...
- Point me at good documentation.
Ehrm, are we talking about a web app? Or some custom socket stuff? Or a wiki implementation? Swiki itself (the original implementation) is a bit cryptic and if you aren't specifically interested in building a wiki-wiki, then I would not start looking there.
If you want to start doing simple web stuff and get going quickly without needing to understand the Magic of Seaside then I think HttpView2 is very simple to get started and play with. It has a few small examples and "Hello world" as a web app is a *single method* in *a single class* started as a server with *a single line*.
- Suggest which Squeak release would the best combination of being
relatively up to date, and yet having the least bit rot (if there is any) in the server code.
We who build web apps typically use 3.8 (or even 3.7) today. Note: If you use 3.7/3.8 you could also install FastSocketStream (a new implementation of class SocketStream) from SM and change the references to use it instead of the standard SocketStream class. In 3.9 that implementation of class SocketStream is default.
- (If it isn't obvious from (1)) Hum a few bars about how you can
run the server on the same machine as you use it from, either in the same Squeak, or in two separate copies.
I always run it in the same image as you develop in, no problem. The best way to *get started really quickly* if you want to grok the basics is IMHO to:
1. Get Squeak 3.8, install these using the SqueakMap Package Loader under the open... menu: - DynamicBindings (this is a "thread locals" implementation by Stephen Pair, it is used in KomHttpServer but is generally useful) - KomServices (a services framework, mainly Tcp, but also other stuff, is used by other packages too) - KomHttpServer (the web server itself, has competition these days and will eventually probably be merged with Swazoo but time, time...) - HTMLBuilder (a HTML generation library derived from Seaside and HttpView. Seaside has now a newer model so it is only used in HttpView2 AFAIK) - HttpView2 (a very small simple web "framework" which simply maps URL directories into methods in a neat way, used by SqueakMap for example)
...and if you want to use the "newest" SocketStream now used in 3.9, install FastSocketStream and change the reference in class HttpAdaptor to use it.
2. Look in category HV-examples, read the class comments and methods. Use the debugger - put a self halt in there, use your Firefox, and examine the call stack inside the debugger all the way up to the Socket communication.
Then, if HV2 doesn't fit your bill - it is best in simple apps or apps where you want total control over URLs and state management (since it is so much hands on and hackable) - Seaside is the way to go for more advanced apps, but it adds quite a bit of magic so it is not as easy to see how things work IMHO. But for advanced web apps Seaside blows HV2 out of the water. It also builds HTML using Smalltalk etc but uses continuations etc to maintain all state on the server side - so you don't need to muck about with URL parameters and all the other tricks to keep track of your state. It also uses a better HTML rendering model these days (the WACanvas classes).
Thanks much in advance
- Dan
regards, Göran