views:

451

answers:

5

I'm working on an IDE for python, ruby and php.

Never having used Smallltalk myself (even it was very popular when I was at university) I wonder if the classic Smalltalk Browser which displays only one method is really an improvment or to classical file editing or not.

I myself like to have the overview of as much as possible in a class. Now i use a 24" 1280x1920 display in a two column mode which can display a lot of lines at ones.

I personally have to wonder what is the benefit if you for example also have good code folding editor where a user can fold for example all def's (functions code bodies) with one keystroke.

But I see the request to make xxx more smalltalkish from time to time in newsgroups. I know some might want an image based version but the browser was the second most different Smalltalk invention.

+1  A: 

It's a little bit of a simplification to say the class browser only shows one method. It actually shows a lot of methods in a much more organized way than raw source code usually does. Consider in which of these you think you'd have an easier time finding what you wanted:

class Thing
  def foo
    blah blah blah
    blah.each do |blah|
      blah blah blah blah
      blah.collect {|blah, blah| blah blah blah}
    end
  end


  def bar(blah)
    blah blah blah
    blah.each do |blah|
      blah blah blah blah
      blah.collect {|blah, blah| blah blah blah}
    end
  end
end

class Fob
  def foo
    blah blah blah
    blah.each do |blah|
      blah blah blah blah
      blah.collect {|blah, blah| blah blah blah}
    end
  end


  def bar(blah)
    blah blah blah
    blah.each do |blah|
      blah blah blah blah
      blah.collect {|blah, blah| blah blah blah}
    end
  end
end

Or:

Classes     Methods

Thing   ->  foo     ->  blah blah blah
Fob         bar         blah.each do |blah|
                          blah blah blah blah
                          blah.collect {|blah, blah| blah blah blah}
                        end

And an actual Smalltalk class browser is a lot more powerful than my silly little plaintext mockup, whereas Ruby source actually looks a lot like that. A class browser encourages you to think of classes as actual entities with autonomous behaviors rather than a bunch of abstract text.

Chuck
But lets say foo is "load" and bar is "save" then if my screen is large enough (or splitted) i can compare the implementation of these two related methods easily. I found that methods are most often not really very autonomous.With ruby's open class implementation where methods could be spread over many different files i see at least one point to gather them together in a methods column.
Lothar
And why do you think it's impossible to look at both in a class browser? If you want to look at both methods on your large screen, look at both methods. Also, perhaps my phrasing was sloppy, but I meant that the objects themselves are autonomous in how they behave, not that individual methods have some kind of autonomy.
Chuck
A: 

I have a love/hate relationship with the Smalltalk browsers (Squeak in my case). At times I think they are the best things since sliced bread, and at others they make me grind my teeth. The problem with Smalltalk is that the browsers are basically all you have. You can of course write your own, but very few people go that route. Whereas with file-based languages, I have a choice of ways of looking at the code, using completely different editors or environments if I wish. However, one way of looking at the code I've never wanted is one that only lets me see one method at a time.

anon
At last ESUG, the Glamour browser construction DSL was presented. 100 lines of code should be enough...
Stephan Eggermont
+3  A: 

The Smalltalk browser has two parts: the top one shows the packages, classes, protocols and methods/messages, the bottom one shows the content of one method. This is very usefull if you design/code your program thinking more on signatures and names, rather than as a web of lines of codes.

If you concentrate on signature, this could lead to a more "object oriented" style, where the system is designed as a collaboration of objects sending messages to each other. In this paradigm, the methods names are somehow more important than how they are implemented.

If you have a very large screen (I got one myself :-)) you would open several smalltalk browsers allowing you to browse (and code) in several different packages and classes. Moreover, you would probably also have a worspace and a xUnit to test and play with your objects.

I suggest you look at the Whisker editor created for Squeak. It proposes a quite nice balance between names and signatures navigation, and lines of code exploration. You would need to try it, as the screenshot does not show the dynamic of it, and how you navigate thru the "boxes" of codes.

http://www.mindspring.com/~dway/smalltalk/whisker.html

Bernard Notarianni
Thanks downloaded and tried it. Looks indeed like it solves a few problems. Unfortunately i think i can only judge the usefullness (some handlings do not really look ergonomic) if i learn Smalltalk. Do you use the whisky browser or the default squeak browser for your work?
Lothar
I use the classic Smalltalk browser. Even when I program in Java, I use the smalltalk-like perspective offered by Eclipse.
Bernard Notarianni
+1  A: 

VisualAge for Java used the Smalltalk Browser model for coding, and I thought they (IBM) did a great job of taking a typical file based language and lifting it up to a higher conceptual mode. Instantiations even had a great add-on to bring good refactoring tools to VAJ (people either don't know or forget for which language refactoring tools were introduced first...take a guess ;) Of course I had cut my teeth on Smalltalk, then moved to C++ for a number of years (too many) and was pleased to see anything Smalltalk-like. When I saw that IBM was seriously moving on Eclipse I was flabbergasted.

But most of my co-workers at the time did not like not being able to see the entire text of the .java file at once. I would ask, "why not just have only one method in a class so that you can see it all of the class file at once?" Then someone would reply, "Then I wouldn't be able to decompose my code very well at all!" To which I would reply, "If your code is decomposed well, why do you need to see every method at once?" And then I would get a response about things being slower somehow...

Development environments that throw in your face the fact that the code database is a system of text files and force you to work with the code that way have always seemed retarded to me...particularly in the in the case of OO languages.

Having said that, there are a number of things that I don't like about the traditional Smalltalk browser. I've often wanted a better way of navigating across the browser instances that I've opened and visited. Whenever you work with code there is invariably a context of methods and classes that you are working with (modifying and/or viewing) - it should be simpler to navigate around the context that dynamically develops while you work. I would also like to be able to easily compose a view of 2-3 method bodies together at one time - something that a code-folding editor can sort of give you, at least for one file...

+2  A: 

Eclipse offers a Smalltalk like browser, the Java browsing perspective. Even though being a Smalltalker myself, I almost never use it. Why? The powerful part if the Smalltalk IDE is the debugger not the browser. When coding Smalltalk, I do everything test-first and then fix all missing methods in the debugger while running the test. Having this for any other language would be like ... WOW JUST WOW, so go ahead and do this :)

Adrian
I love being able to code in the debugger while running the test. That is by far the best feature of smalltalk. In my mind, the visual studio debugger doesn't hold a candle to the smalltalk debugger.
Curtis