On 1 July 2011 13:13, Norbert Hartl <norbert@hartl.name> wrote:
Am 01.07.2011 um 12:47 schrieb Igor Stasenko:
On 1 July 2011 12:39, Sven Van Caekenberghe <sven@beta9.be> wrote:
On 01 Jul 2011, at 12:31, Nick Ager wrote:
or even:
hello world:
((ZnServer defaultOn: 1337)
   delegate: (ZnDispatcherDelegate new
       map: '/' to: [ :request :response | response entity: (ZnEntity text:  'Hello World!') ])) start
echo:
((ZnServer defaultOn: 1337)
   delegate: (ZnDispatcherDelegate new
       map: '/' to: [ :request :response | response entity: (ZnEntity with: request contents) ])) start
Yes, of course Nick, but then you better use the prefixes:
((ZnServer defaultOn: 1337)
    delegate: (ZnDispatcherDelegate new
        map: '/hello' to: [ :request :response | response entity: (ZnEntity text:  'Hello World!') ])) start
((ZnServer defaultOn: 1337)
   delegate: (ZnDispatcherDelegate new
        map: '/echo' to: [ :request :response | response entity: (ZnEntity with: request contents) ])) start
Writing the shortest possible server code is a dubioius challenge. Although few Smalltalker would be happy to use verbose and heavy Java and XML. It is important that simple things be easy, short and elegant and complex things be possible.
The problem with such short examples is that they usually serve as a advertisement to attract new users, but has nothing to do with reality. Because once you put a real requirements before a framework which you would like to use for your needs, and measure how easy/fast you could implement it, then you realising that simple things are not so simple as shown in 'hello world' examples. So, such pieces of code could actually thwart users away: because once you hit a wall (and you will always hit it no matter what framework you using), the first reaction could be: - hey but you said it will be easy!
:)
And if you wouldn't say it they won't even try it at first.
No, i think that showing a real-world example, a nice killer app implemented on top of your framework will sell it much better than silly and useless helloworld code snippets.
Norbert
-- Best regards, Igor Stasenko AKA sig.