From: Laurent Julliard Date: 2002-01-14T17:48:06+09:00 Subject: Re: Small Methods - a ramble Curt Hibbs wrote: Over the last decade I have use many different development > environments. In these development environments there are several > predominant forms of code navigation and editing, that I believe can > synergistically coexist in a single IDE. > > = Flat File = > > Not much to say here. This is your basic textpad style editing where you see > everything that is in a single file and your only form of navigation is > moving up and down in the file and searching. Very primitive. A useful > addition to this is the ability right-click on a symbol in the code and get > a context menu that lets you go to its definition. > > = Collapsible Text = > > This is a very nice addition to flat file editing. Intelligent parsing can > allow the text to be collapsed at particular code points (usually method and > class definitions). A very flexible adhoc use of collapsible text is when > you are allowed to collapse text sections based on the matches of a regular > expression. CodeWright (which I mentioned above) does all of this. > > = Browsing = > > This is where you are allowed to view the code in your project based on the > logical entities that it contains (classes, methods, modules) instead of its > rather arbitrary physical storage (files). There are several ways to present > this, but they all boil down to essentially the same thing. > > There is a hierarchy of names: classes/modules by inheritance/mixin which > contain methods. When you click on one of these names, the editor should > show that entity's definition, ready for editing. The name hierarchy can be > displayed in the form of a collapsible tree control, or in classic Smalltalk > panes. The display pane that shows code for editing can contain only that > particular entity (Smalltalk style) or could be the entire file containing > that entity with the selected entity visible for editing (and perhaps the > rest of the file slightly "grayed" to visually distinguish the selected > entity). > > I particularly like the this last approach because it lets me navigate > logically, but easily see the physical organization without any additional > effort. This is also the form that is most natural for non-Smalltalkers as > it takes what they are use to (editing physical files) and layers onto that > the capability to navigate using the names of the logical entities in their > code. > > Also, there are many possible types of logical navigation panes: class > hierarchy, reverse class hierarchy, "uses of ", etc. > Building on Ron's remark I too do tend to have either large methods with comment in it because it makes it easier to follow the "story". Splitting the code in many small pieces which I do as well is really when either you know the code very well and the code browser is actually in your brain or you have a powerful and convenient browsing tool at hand (I still haven't found one personally and stick to Emacs. Which is why I want FreeRIDE to be innovative in this area) So it looks like we have a sort of a dilema here between reading a story (like we read a novel in a book) and looking at the structure of the story (like we read a table of content and possibly the index).If we push the book analogy one step further there is another thing we could do which is a variant of the = Collapsible Text = describe by Curt above. The idea is to have the ability to flatten a method in place. In other words it would give you the ability to substitute a method call in a given piece of code by the code of the method itself (possibly doing clever substitution argument names). And you could do this recursively of course so that from a highly fragmented series of methods you can at any given time flatten the code and read the story in-line. It is exactly like if you were given a table of content of a book and had the ability to expand any of the chapter section, sub-section and substitute them with the content for a while to read the story. I don't know if this kind of tool is already available is some IDE and I'd be glad to here your comments about that. Laurent