Live data from Hacker News

Smalltalk: Swimming with the fish

simberon.blogspot.nl

21–30 of 87 posts

Re: Smalltalk: Swimming with the fish

#21

Earlier quoted context omitted.

In Smalltalk, you can manipulate objects directly rather than just indirectly via code that operates on them. The state of your manipulation is made persistent in smalltalk's image facility. Also, the whole object graph is supposedly better exposed accordingly then what you could get sigh just a plain old debugger. At least I think that is what the author is trying to convey.

This is where my Blub programmer life bites me. I don't understand what you mean by "manipulate objects directly". I can't figure out the right abstraction level to put it at. For instance, let's say I have an Employee object that throws an exception. Clearly, if inspect that object and change the name member, Bob from accounting's name doesn't suddenly change to Gary. So I'm not acting directly on the object, but a…

It is as if your application is always running inside the debugger.

You can change anything at any time and those changes are made persistent.

This is one reason why images are prunned for deployment.

Re: Smalltalk: Swimming with the fish

#23

Earlier quoted context omitted.

In Smalltalk, you can manipulate objects directly rather than just indirectly via code that operates on them. The state of your manipulation is made persistent in smalltalk's image facility. Also, the whole object graph is supposedly better exposed accordingly then what you could get sigh just a plain old debugger. At least I think that is what the author is trying to convey.

This is where my Blub programmer life bites me. I don't understand what you mean by "manipulate objects directly". I can't figure out the right abstraction level to put it at. For instance, let's say I have an Employee object that throws an exception. Clearly, if inspect that object and change the name member, Bob from accounting's name doesn't suddenly change to Gary. So I'm not acting directly on the object, but a…

> 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 as if only persistent objects exist, so let me explain. Smalltalk is image based, you're working in the live runtime, not on files that later become the live runtime.

Forget the debugger, it has nothing to do with the debugger. I can open up a workspace and say "SomeClass allInstances", highlight the statement, press a key to inspect it and up pops a list of all instances of that class in a window. I can then click any instance in that list and inspect it and get a window for that object where I can see and modify the state of that object. That object could be a session object for a user on the website at that moment, or it could be the application itself, or any other object in the system.

In most languages using the debugger is the only time you get to play with the running program, in Smalltalk there is only the running program and you're in it all the time. I can highlight a method name, hit one key, and be taken to the source for any method in the system including those that give me that ability; I could change code that breaks the IDE that I'm working in if I wanted. I could inspect the running IDE and change the color of the window tile while I'm using it. I can do all of this from the IDE or workspace without ever invoking a debugger.

Here's a very simple way to grok it, it's just like SQL in the sense that a database is a running image and you can query user table or even system tables that control how the server itself functions. If you change a view, clients of that view see the change instantly; you don't have to restart the database to see your code changes because you are working on the running server, not a text file that when ran becomes the server.

Smalltalk is the same, you write code in the running image and changes are seen immediately by clients using that server. This is the same as a Lisp hacker connecting Emacs to a running Lisp instance, say the one that hosts this site, and making changes while people are using the site.

Smalltalk is optimized for code navigation like no other environment I've ever seen. When I work in Ruby or frankly any other language, I have to pull up the documentation for the String class to see what methods it supports; I've never had to do that in Smalltalk, I just go to the String class and look at what methods it supports directly assuming I don't see what I'm looking for in the intellisense. If I want to extend it, I add a method to it right there, but categorize it with my package so it's part of my project and not part of String for the purposes of source control.

If I want to see how a string works, I can simply highlight a string in a workspace and inspect that instance of it in a window, and then play with it, sending messages to it to see how it reacts, or if it errors, or whatever. Pretty much anywhere in the system you can simply highlight some code and press a key to evaluate it allowing you to hack things together by trial and error much much faster than if all you have is a REPL or worse only the debugger.

A Smalltalk workspace is pretty much exactly like working in a SQL workspace; write some code, highlight it, run it, see what happens. But in Smalltalk, you're not limited to a result window, you might have a transcript up, but you also might have 10 inspectors open on all the objects you're playing with in a workspace so you can see them and watch their state change while you're playing with the code.

A Smalltalk image is a running object database, not a transactional one, you don't generally want to use it for persistence, however, you can and this is fantastic when prototyping. You can write the entire UI using the image as the database and put off the persistence decision until your app is shaken out and you know what you really want to do. I can just hang an OrderedCollection off my class and use it as the database. I could then query it like so:

  Customer db select: [:e | e name = 'Joe' 
      and: [ e age > 3 ]].
Hugely helpful when prototyping to be able to simply avoid the persistence issue.

Re: Smalltalk: Swimming with the fish

#24
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…

Yes they are gone.

However, the main point is that back then you haven't got HN, Reddit and the blogs of today.

As such not many geeks were fortunate enough to know and understand those systems, as consequence you have a legion of developers that cannot understand the beauty of those systems.

Re: Smalltalk: Swimming with the fish

#25
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…

> Perhaps the biggest shift in software engineering in the last decade or two is the fact that no one writes entire systems anymore.

That's unfortunate. If we kept at it, we could have discovered much simpler ways of doing things than the current accumulation of leaky abstractions over leaky abstractions in a rather disintegrated environment. We can do better: http://www.vpri.org/pdf/tr2011004_steps11.pdf

Re: Smalltalk: Swimming with the fish

#26

Earlier quoted context omitted.

In Smalltalk, you can manipulate objects directly rather than just indirectly via code that operates on them. The state of your manipulation is made persistent in smalltalk's image facility. Also, the whole object graph is supposedly better exposed accordingly then what you could get sigh just a plain old debugger. At least I think that is what the author is trying to convey.

This is where my Blub programmer life bites me. I don't understand what you mean by "manipulate objects directly". I can't figure out the right abstraction level to put it at. For instance, let's say I have an Employee object that throws an exception. Clearly, if inspect that object and change the name member, Bob from accounting's name doesn't suddenly change to Gary. So I'm not acting directly on the object, but a…

What you're missing is that, in Smalltalk, the representation on which you're acting is indistinguishable from the object; in your example, when you change the name member, Bob from Accounting's name does suddenly change to Gary; not only do future accesses of the name member on that object return "Gary", but, for example, if you have an HR management frontend open on Bob when you make the change in the inspector, you'll instantly see the effect there as well.

If all your experience and knowledge is born of Unix and the web, you don't really have available the necessary concepts to think about how a Smalltalk, or even a Lisp, actually works -- I know this because all of my experience and knowledge were born of Unix and the web, until recently, when I took it into my head to learn Lisp and also to gain at least a passing familiarity with Smalltalk. The difference is amazing -- in the preface of the UNIX-HATERS Handbook, written mostly by veterans of the Lisp years at SAIL, our modern computing environment is described thusly, by Ken Pier of Xerox PARC:

"I liken starting one's computing career with Unix, say as an undergraduate, to being born in East Africa. It is intolerably hot, your body is covered with lice and flies, you are malnourished and you suffer from numerous curable diseases. But, as far as young East Africans can tell, this is simply the natural condition and they live within it. By the time they find out differently, it is too late. They already think that the writing of shell scripts is a natural act."

Which I thought was hyperbole, too, until I spent some time discovering what sort of environment Pier and the SAIL folk took for granted. I don't unreservedly recommend the experiment; I earn my living in Pier's "East Africa", and sometimes I think I'd be better off if I didn't know how bad I have it. But I can certainly say that if you haven't tried it for yourself, you don't begin to know what you're missing.

Re: Smalltalk: Swimming with the fish

#28
post #22

Earlier quoted context omitted.

That isn't true. http://www.redline.st/discover/is-it-smalltalk.html

[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 basically the same unhelpful puritanical attitude that left Lisp basically dead from the end of the Lisp machine until PG started talking it up. It doesn't have to be the same to be good, or better than a lot of alternatives, or to count as a real Smalltalk.

For what it's worth, not having Morphic is a huge win IMO. A UI built on something else that attempted to achieve the original goals of Morphic but with, say, a little actual OO design and architecture, would be way better than that disgusting, unlearnable mess.

Re: Smalltalk: Swimming with the fish

#29
post #21

Earlier quoted context omitted.

This is where my Blub programmer life bites me. I don't understand what you mean by "manipulate objects directly". I can't figure out the right abstraction level to put it at. For instance, let's say I have an Employee object that throws an exception. Clearly, if inspect that object and change the name member, Bob from accounting's name doesn't suddenly change to Gary. So I'm not acting directly on the object, but a…

It is as if your application is always running inside the debugger. You can change anything at any time and those changes are made persistent. This is one reason why images are prunned for deployment.

Pruned? How do we do that? I mean, how do you distinguish the changes you want to deploy from the changes you want to drop?

Re: Smalltalk: Swimming with the fish

#30
post #21

Earlier quoted context omitted.

It is as if your application is always running inside the debugger. You can change anything at any time and those changes are made persistent. This is one reason why images are prunned for deployment.

Pruned? How do we do that? I mean, how do you distinguish the changes you want to deploy from the changes you want to drop?

Basically it already knows the system/ide classes and pulls them out, and does some code analysis to remove unused bits of code and so on. It's an interactive process, but it's generally pretty smart.
Post reply on HN