Live data from Hacker News

Smalltalk: Swimming with the fish

simberon.blogspot.nl

41–50 of 87 posts

Re: Smalltalk: Swimming with the fish

#41

Earlier quoted context omitted.

> Clearly, if inspect that object and change the name member, Bob from accounting's name doesn't suddenly change to Gary. Yes it does. > So I'm not acting directly on the object, but a representation of the object. No, that is the object. Now, if it's backed by a relational database what you're saying might be true, but then you just change the name and then tell the object to save. You're thinking too data centric a…

First off, thank you for your through reply > > Clearly, if inspect that object and change the name member, Bob from accounting's name doesn't suddenly change to Gary. > Yes it does. Okay. either I wasn't clear in my analogy or I'm actually further away from understanding Smalltalk than I thought. Let me put it a different way: If I open the Bob object in the inspector and set the "deceased" member to "true", will Bo…

You are thinking about the separation between source files and the running system, but there is no such thing as a separate source file in Smalltalk. You can generate them if you wish, but it is not necessary. The code, in fact, is just a representation of the real system, which is contained in an image file.

For example, when you want to modify an object in Smalltalk, the system generates a representation of it - with methods and instance variables - and you modify the representation with the system text editor. Then you ask to system to apply the changes to the object. When the changes are applied, that is it, no source files are needed anymore. The system continues to live like this. When your "programming session" is over, you save the whole image, and starts it again on the next day. No compilation of whole system is ever performed. It is said that some objects in a standard Smalltalk image have been alive for several years... they are only saved and used, never recompiled or modified.

Re: Smalltalk: Swimming with the fish

#42
post #5

I've got a bit of the blub paradox going on here so this story is lost on me. Can anyone give me a concrete example of what he's talking about instead of an abstract analogy?

The debugger situation with Smalltalk is part of what he's talking about. You're running your application, and some part of your code throws an exception. A window pops up with the stack trace in it. You can inspect all the objects in each frame. "Inspect" in Smalltalk means, see and change the properties, call methods, change the code, clone, see the class hierarchy, etc. You can modify the method that threw the exc…

That's roughly how one works in Common Lisp as well (though most implementations don't ship with a graphical environment, so ssh is typical instead of VNC).

It's really much more pleasant than shipping text files and interpreters all over the place and sorting through logfiles and tracebacks when things go south.

Re: Smalltalk: Swimming with the fish

#43

Earlier quoted context omitted.

The debugger situation with Smalltalk is part of what he's talking about. You're running your application, and some part of your code throws an exception. A window pops up with the stack trace in it. You can inspect all the objects in each frame. "Inspect" in Smalltalk means, see and change the properties, call methods, change the code, clone, see the class hierarchy, etc. You can modify the method that threw the exc…

That's roughly how one works in Common Lisp as well (though most implementations don't ship with a graphical environment, so ssh is typical instead of VNC). It's really much more pleasant than shipping text files and interpreters all over the place and sorting through logfiles and tracebacks when things go south.

Absolutely. There's a deep kinship between them. Prolog can also be used this way, though it doesn't support images, it's a homoiconic language and it's very easy to read and write terms from files.

Re: Smalltalk: Swimming with the fish

#44

I have been facinated by Smalltalk but the language drives my kinda crazy. I have read the 'Blue book' ( http://wiki.squeak.org/squeak/64 ) and tried Pharo ( http://www.pharo-project.org/home ), Amber ( http://amber-lang.net/ ) and GNU Smalltalk. While I really like Smalltalk, for some reason it does not work for me as a web development platform (and the web is my platform), or maybe I just don't grasp it. I tried Se…

There are two other web frameworks in use, and I think one of them is more about generating clean URLs. Illiad?

I love the idea of Smalltalk, but it also never stuck for me. I think I just prefer to learn from books than through milling around in the image. All the great minds in Smalltalk seem to be self-driven autodidacts. I'm not.

I'm pretty good at Haskell and Prolog though, so I think it works out in the end. I'm also not good at Lisp or Forth. :)

Re: Smalltalk: Swimming with the fish

#45
So, it's a language for doped up hippies. That's what I got out of that. I recalled Jerry Garcia's stories about scuba diving and how it was better than LSD.

I have no clue what it means to live amongst your objects and touch and feel and turn and taste them. That article didn't really explain what that means, but I'll take him at his word.

Re: Smalltalk: Swimming with the fish

#46

Earlier quoted context omitted.

> Clearly, if inspect that object and change the name member, Bob from accounting's name doesn't suddenly change to Gary. Yes it does. > So I'm not acting directly on the object, but a representation of the object. No, that is the object. Now, if it's backed by a relational database what you're saying might be true, but then you just change the name and then tell the object to save. You're thinking too data centric a…

First off, thank you for your through reply > > Clearly, if inspect that object and change the name member, Bob from accounting's name doesn't suddenly change to Gary. > Yes it does. Okay. either I wasn't clear in my analogy or I'm actually further away from understanding Smalltalk than I thought. Let me put it a different way: If I open the Bob object in the inspector and set the "deceased" member to "true", will Bo…

> First off, thank you for your through reply

No prob.

> If I open the Bob object in the inspector and set the "deceased" member to "true", will Bob claw his way out of his casket?

Oh, I see what you meant, no of course not as the Bob object itself is a representation of the real world Bob, however if you did that your system and all of its clients would immediately think Bob was deceased.

> A lot of my confusion about whether it's the object or the representation of the object comes from this level.

I think you might be confusing classes with objects; objects are instances of a class and thus only exist at runtime, which is all the time in Smalltalk (and Lisp) and at debug time for other languages.

The representation you work on is the class, in most languages the class is a source file you edit that at runtime can have instances of itself created. In Smalltalk, the class itself is just another object in the system, you create subclasses and instances by sending messages to it; there are no source files. You don't work on source files, you work on live objects, the IDE doesn't edit files, it edits method objects from the classes in the running system. You can reflect, inspect, and browse the live running class system just like the IDE does.

> If I'm understand what you've written properly, then the Smalltalk language isn't nearly as important as the Smalltalk environment.

Correct, but don't let that make you think the language isn't important as well. Smalltalk the language is amazing in a similar fashion to how Lisp is amazing; the syntax is incredibly flexible and simple.

The proof of this is that Smalltalk control structures, your if/then/else/switch/while/for/etc are not part of the language itself (discounting VM optimizations), they are simply implemented in the standard library using objects, polymorphism, and lots of higher order functions.

Just as Lisp macro's enable Lispers to add native control structures because Lisp itself uses the same mechanism, Smalltalk's simple lambda syntax [ code ] or [:arg | arg isX ] and special method naming syntax enable Smalltalk'ers to add native control structures because Smalltalk the language uses the same mechanism.

For example, you can't add your own "if" to Ruby that looks and works just like the built in "if", but you could in Smalltalk because that's how it was done in the first place. It's all library, classes and objects (functions in Lisp) and everything is built on top of that. Very few languages work this way, most have special keywords for control structures and you can't add to them.

> For a comparison point, during my day job, I write a large amount of Python in Emacs.

Great, also a great little language. Ah... but you're using Emacs, if you aren't aware that's just a Lisp image exactly the same thing as a Smalltalk image. You know exactly what working in an image is like, you do it daily.

> This code is for an application that runs in a REPL. Emacs gives the the ability to highlight code and run it.

Yup, Emacs is an image.

> I can call the "help" function on an object

On an object, or do you mean on a class in a file. Vastly different things. Object and class are not interchangeable words to use in this context.

> to see its documentation or the "dir" function to view all its members and methods.

I think you're talking about classes, not objects. And does this also include all source for the standard library as well, not just your application?

> I can load code at run time and patch new members onto classes or objects.

Yup, Python like Smalltalk is a very flexible dynamic language, but it didn't come out till a decade later and still isn't as flexible.

> Of course, that's the classic Blub programmer paragraph.

Yup, but at least you're aware of that, so you've un-blubbed IMHO.

> At the very least, Smalltalk sounds like a nice environment and I'm jealous of having multiple, independent object inspectors.

And multiple IDE's and multiple workspaces, windows all over the place.

> I'm also sure that the Smalltalk documentation is better written than what I usually get from "help".

Actually, honestly, you'll find very little documentation to speak of for most Smalltalk code; Smalltalker's tend to just read the source, it's there, it's simple, the average method length in a typical image last time I looked was about 7-10 lines of code, and you can just create instances of anything on the fly and play with them to see how they work, or find existing running instances and play with them.

> Still, I suspect that I'm missing something. Especially if I'm still wrong about what it means to work directly on an object.

Yup, but I think you'll understand by the time you read this line based on your Emacs use alone.

Re: Smalltalk: Swimming with the fish

#47
post #19

Articles about how great Smalltalk is usually remind me of articles about how great the Lisp Machine was. And there is a lot of merit to an entire system, hardware and software, designed to operate in a high-level language. My complaint is that neither of these things is coming back in a relevant way. Perhaps the biggest shift in software engineering in the last decade or two is the fact that no one writes entire sys…

At the same time, so much recent tool development has focused on virtualization. Vagrant, chef, puppet, packer, ... and yet, Smalltalk has decades of experience with whole virtualized machines to we can study.

Perhaps systems like Smalltalk still have something to teach us?

Re: Smalltalk: Swimming with the fish

#48
post #45

So, it's a language for doped up hippies. That's what I got out of that. I recalled Jerry Garcia's stories about scuba diving and how it was better than LSD. I have no clue what it means to live amongst your objects and touch and feel and turn and taste them. That article didn't really explain what that means, but I'll take him at his word.

Sure, downvote me. This article says nothing. You have to be a Smalltalk lifer to get it. It's all metaphors that have no meaning to anyone outside the author's bubble.

Crap article.

Re: Smalltalk: Swimming with the fish

#49
post #22

Earlier quoted context omitted.

[deleted]

Feels like you didn't read the page I linked. You can do all of this: "navigate object graphs, edit them while the program runs, inspect UI elements and modify their behavior interactively, and so on." It just isn't persisted to an image. The OP is implying that Redline is just Smalltalk skin on a Java pig. That's not true, but if your goalposts for Smalltalk are "it must be Pharo" then, yeah, it isn't Pharo. This is…

> Redline is just Smalltalk skin on a Java pig.

This is a seriously weird mixed metaphor. Normally the phrase is "lipstick on the pig," which makes a reasonable amount of sense: ostensibly women wear lipstick to look prettier. Pigs are ugly and won't look prettier even when they're wearing a prettying agent.

Meanwhile, there's the term 'pigskin,' which is a term for an American football.

Finally, pigs already have skins.

This phrase conjures up some sort of horrible notions of the serial killer Buffalo Bill in The Silence of the Lambs for me. Very upsetting.

Re: Smalltalk: Swimming with the fish

#50

The analogy given in the article is pretty accurate. The Smalltalk environment is unique in that it allows very easy access to the libraries, the IDE and the language’s internals (including the compiler!). The Smalltalk debuggers are among the best ones I have ever used. (I’m mostly speaking out of my experience with VisualWorks, a commercial Smalltalk implementation, but other implementations are similar.) I would g…

> many parts of the Smalltalk IDEs are horribly outdated

My opinion is the opposite: I find the IDE in Pharo to be simple and very elegant, far more human-friendly than any I've seen in 'mainstream' languages. And this version of Smalltalk is under heavy development, with a push towards even greater cohesion. This small corner of computing is seething with hot, cutting-edge activity.

> The text editors are pretty bad

Well, you ought to know that Smalltalk is focused on relatively small snippets of code, held together in consistent OO structures. There's hardly any point in fancy text-editing features when your methods are generally 8-12 lines long!

Post reply on HN