Jackpot - James Gosling's Latest Project
Pete Bevin writes "Artima has a fine interview with James Gosling, creator of Java, about his latest project. It's called Jackpot, and it treats the parse tree as the program. This makes refactoring much, much more intuitive. The article has some good insights into code visualization, technical writing, and making your programs more understandable."
So you can write what is kind of like a reverse grammar, where you associate structural patterns with what you can think of almost as TeX descriptions of how to represent the patterns graphically. What you see on the screen has been generated from this pattern matching. So we can, on a user chosen basis, turn various program structures into all kinds of visual representations.
:)
Why, methinks he's reinvented the Matrix.
Always document your code so that a mentally retarded 6 year old can understand what you mean.
I learned that when doing math proofs. It it wasn't written so retarded 6 year old can understand it, the TA took off marks.
I don't know much Java, but .NET has an entire CodeDOM namespace that can be used to generate assemblies and code on the fly. DOM being the keyword - it presents C# code as a parsed object tree. I haven't played with it beyond generating simple assemblies but I wonder if it could be somehow cajoled into creating a tree representation that also understands flow. That would be a neat thing to play around with.
"Creator of Java"? What's that? How about "the creator of Gosling Emacs"?
I've heard that somewhere before...
Oh yeah. In my ANSI Common Lisp book. Something about the real power of Lisp being that everything, including the program itself is just a tree structure.
I guess programming languages really are slowly merging. Java isn't getting macros now, but I suspect in another 5 or 10 years it'll be something else Java will do. =)
-Ducky
"Complexity is in many ways just evil. Complexity makes things harder to understand, harder to build, harder to debug, harder to evolve, harder to just about everything."
So says the creator of Java. I wonder if he's bothered to browse the API lately?
Does this mean it will be any easier for me to learn Java? Probably not. Will I ever learn Java? Of course. Let's be honest, Qweez No. Probably not.
Now, put this support straight into emacs and I'll be happy.
Isn't that what IntelliJ does already? I use it as my main IDE, and it has an amazing understanding of Java -- it allows you to refactor just about anything.
When working in it, you feel like you're not just editing Java -- you're editing the fully integrated structure of your software.
Hey this is my first post. I have angry half-baked opinions tho. I find that commenting for a retarded 6 year old makes code unreadable. Have you ever tried to find anything in the apache tomcat sourcecode using only notepad? Why is there a comment on "getInfo()" that says "Returns the info."??? Some classes I was trying to understand I just went through and deleted every comment so I could read the damn thing. Turns out the class was only like 12 lines of code. It was like shaving a cat.
As a Slashdot thread on a programming language progresses, the probability of someone claiming that "Lisp already does that" approaches unity.
The bitter lessons of a veteran coder: http://bitterprogrammer.blogspot.com
Of course all this is easier in functional languages, because you don't have to worry about state, identical trees will always evaluate to the same value. Not so in Java, if any of the nodes refer to global data.
I wonder how often Gosling talks with Guy Steele, who was pivotal in the development of both Scheme and Java. I'd love to see what they'd come up with if they put their brains together.
OK, I read the article. What the hell are they talking about?
I'm an American. I love this country and the freedoms that we used to have.
Yes, yes, I had to deal with all the "Lisp did it first" comments when Eidola was on Slashdot.
While it's true that the program is the parse tree in Lisp, that's not a very strong statement. Lisp's elegance comes from the fact that there are so few constructs in the language, and basically everything is a list -- even your programs. But they're basically just lists, that's all. So you have this wonderful flexibility, but the parse tree doesn't actually tell you very much about the program; you have to "parse the parse tree" to recognize higher-level constructs.
Now languages with lots of language-level constructs -- like strong static types, objects, access modifiers, etc. -- tell you a whole lot about high-level structure with their parse trees. (And, for those following along at home, Lisp is not such a language -- not that that's a bad thing, but it isn't. Lisp builds these high-level constructs out of a very few language-level atoms.) To my knowledge, applying the "language is the parse tree" principle to non-functional languages is still largely the domain of research projects like Jackpot, Eidola, and Intentional Programming, and visual languages.
Moral: Lisp is very, very, very cool, but it has not already done everything every other language is doing. So yes, it may sound familiar from you Lisp book, but it's not the same.
if people like Gosling could show Jackpot
and its benefits in a BUSINESS CONTEXT.
- Code gets cleaner, easier to maintain & debug.
- Multi-thread scaling areas get easier to spot.
- Profiling tools speed up based on the algebra.
- IT staff in mergers can finally merge apps.
Sure the technology is "cool" and "entertaining"
but these days Sun needs a profit.
Cheers, Joel
When you googled for something *java* it was anoying enough to deal with stupid $tarbuck$
links, with 'Jackpot' an unlucky click and it might take 20 min to undo the popdowns, offers for the *best internet casino*... and oh my gawd, add to the wrong mail list!
(I was going to add an example link but I wouldn't do that to my worst enemy)
When writing LISP you're pretty much expressing a parse tree as a program, and yes, LISP does have some advantages when it comes to expressing certain solutions in an elegant manner.
Such a language, much like LISP, might be quite useful with respect to genetic programming.
In addition, a parse tree language which has lots of internal understanding of data flow might make for a good intermediate step in a compiler or perhaps become a better LISP.
It's good to see that Gosling isn't resting on his Java laurels but applying what he's learned in new areas of research.
-- Good judgement comes with experience. -- Experience comes with bad judgement.
Alex Stepanov famously described Java as "a money-oriented programming language". I guess that makes the name "Jackpot" an appropriate name. I suppose the next projects will be "Jingle" and "Jyp".
Hmm... most of what he talks about has been available in proper languages for decades! I'll even try, as a public service, not to mention LISP :]
:)
Smalltalk has this:
(3/5) class methodDictionary at: #+
which will give you the + method for the Fraction class. From that object (the CompiledMethod) you can get the original source code (if it's available), or a parse tree. The parse tree will give you indices into the original source, in case you should need to do a GUI for your IDE
Say you're writing a debugger (which you can actually do, unlike in Java, where the debugger needs to run externally).. the MethodContext knowns at what opcode execution stopped, the parse tree knows which part of the source that represents. This means you can step operator by operator through an exression... no "line numbers".
You can *fake* some of these things in java, but it's not pretty - something like IntelliJ has to use its own special compiler and huge amounts of support code, and it's just plain impossible in Java for a system to debug itself.
Go play: free-as-in-beer-for-personal-use and nice / free, cute, fluffy and sluggish
</preach>
For me as along time programmer this feels like moving from C to C++. You can discuss your program on a whole other abstraction level.
GREAT.
Things are getting very interesting in the field of improving the coding process. I still remember Sniff C++ started by Eric Gamma in the early 90-ties. This was the first product to visualize/navigate over large C++ projects that blew me away. One can certainly see this approach in Eclipse - one of the latest projects of Eric Gamma.
A few very smart IDEs appeared - CodeGuide, Eclipse, IDEA.
Eric Gamma was working in an IT research lab in the UBS in Zurich in Switzerland before he became really famouns with his GoF book.
Lars
Not a great deal there yet, but if you're interested in Jackpot then the Jackpot home page would be worth bookmarking for future reference. Their early work on source code metrics is interesting and the published papers listed are a good starting point for more detailed information than can be delivered in an interview.
Sailing over the event horizon
Besides Lisp and Eclipse and IntelliJ, this sort of syntax-tree-oriented manipulation has been going on in optimization and programming language research for the last 20 years. (And Eclipse does a fine job -- all that chit-chat about encapsulating public instance variables is just a choice on the refactoring menu, and it's free. I've got no idea why Gosling thinks this is new and interesting.)
For example, people (including me) at Rice University worked on a source-to-source Fortran vectorizer that manipulated ASTs. Derivatives of that AST reappeared in the Dana/Ardent/Stardent compilers for C and Fortran. The Fortran AST was also used in an AST-based editor, a Fortran interpreter/debugger, a pretty printer, an ugly (fixed-format card image) printer, and dependence-displaying Fortran browsers (dependence here refers to loop iteration dependences that hinder parallelization).
One thing that became clear while working on AST-based editors was that people didn't want the tree structure continuously in their face. For example, at the expression level, Fortran programmers (as opposed to, say, Lisp programmers) found tree-based editing to be intolerable. The tree structure can be handy for browsing/skimming code; uninteresting blocks of code could be elided. But, people did not want to be prevented from making changes that were "only" syntactic.
Keep in mind, this is just the Rice-centric view, other people were doing things like program slicing (what code depends on the value of this variable). I'd love to see some of this stuff nicely integrated into an IDE -- that nice integration is the hard part, the theory is generally done and old.
Gosling spoke:
One piece of analysis, therefore, is to find all the public instance variables. But we can find them and also make them private, add all the setters and getters, and account for what it means to actually access the variables via setters and getters.
As I've said before, Gosling appears to have oblivious to most of the research that had gone on in the field of object-oriented languages.
Java should been designed from the start to enforce getter/setter access to instance variables. This feature has long been recognized to be a desirable feature in an object-oriented language. I think Self, Dylan, and other object-oriented languages got this feature right.
Most of this stuff isn't new. The first general refactoring tool I ever saw was the RefactoringBrowser built by John Brant and Don Roberts at the University of Illinois at Urbana-Champaign. It uses Smalltalk parse trees to analyze code, perform refactorings, lint checks and code rewrites. It's free and has been incorporated into VisualWorks Smalltalk, Dolphin Smalltalk and Squeak, and is available as an add-on for VisualAge Smalltalk. To see the kinds of refactorings supported, check out: http://st-www.cs.uiuc.edu/~brant/RefactoringBrowse r/Refactorings.html
B rowse r/Lint.html
e r/Rewrite.html
n gBrowser.html and look at the dates. People use this free tool set every day.
To see the lint checks available, look at:
http://st-www.cs.uiuc.edu/~brant/Refactoring
And to see the parse tree based rewrite tool, go to: http://st-www.cs.uiuc.edu/~brant/RefactoringBrows
To see how long this has been available and something of it's evolution, check out the HyperNews page at http://st-www.cs.uiuc.edu/HyperNews/get/Refactori
Your opinions about Python are all well and fine but if you have the choice between Java and Python on a project, use Java.
.pyc files in there.
Even though I happen to agree that Python is a better language (for the most part), I would always stick to Java. I chose Python on a project I did. I would much rather have that experience on my resume as Java instead. Python is nice, but employers just aren't looking for it.
Sad, but true.
On a side note: Microsoft Site Server 3.0 was written in Python by the original shop that wrote it (an acquired product). No one would touch the source until they moved it to C++ for the next version of the code (it's called Commerce Server now). If you don't believe me, install Site Server and look for the
*sigh*
Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!
Even though I happen to agree that Python is a better language (for the most part), I would always stick to Java. I chose Python on a project I did. I would much rather have that experience on my resume as Java instead. Python is nice, but employers just aren't looking for it.
Sad, but true.
Python is nice, but employers just aren't looking for it? That's a bad reason, if any...JUST LIE!!!! Does it really matter? What _really_ matters is doing it right and doing so efficiently. If python gives you an advantage in being able to rapidly prototype and develop, then that is every reason to choose it.
LOOPS had:
A single-inheritance object system with GUI support (class, method, and object browsers).
Editing with structure editors that manipulated the parse tree directly. The structure editor was also used as the inspector in the debugger.
refactoring support in the browsers (select a method and move it to another class, etc).
automated global refactoring based on code analysis - this being 1987, it had a pseudo-natural language interface (EDIT ALL METHODS CALLING FOO AND REFERENCING *BAR*...).
LOOPS is one of the primary predecessors of CLOS (the other being Flavors).
Parse-tree-based editing has been around for awhile - Google for "syntax directed editing". Paradoxically, it works much better in Lisp than in other, more syntax-heavy domains; when your editor insists that everything be syntactically and semantically well-formed all the time, it's best that there be very few, very general syntax rules. This is why it also works in Smalltalk.
To a Lisp hacker, XML is S-expressions in drag.
Yes, and do you realize the significance of Gosling Emacs? It was its proprietary nature. Gosling Emacs was what finally got GNU Emacs off the ground as a successful open source Emacs implementation for UNIX systems.
Gosling has been hostile to open source from day one. He created NeWS and tried to kill off X11, and he was probably partially behind keeping Java proprietary.
That's a bad reason, if any...JUST LIE!!!! Does it really matter? What _really_ matters is doing it right and doing so efficiently.
Bzzzt! Wrong answer!
What *really* matters (to me, anyway) is staying employed. Your strategy employs two faulty tactics: lying and not focusing on what the customer needs or say they need. If you lie about your experience, then be prepared to accept the consequences when you're found out. If you do a project in Python when a customer specifically requests Java, then be prepared to lose the business.
Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!
I would much rather have that experience on my resume as Java instead. Python is nice, but employers just aren't looking for it.
If the customer specifically requests java, then that is a different story altogether than lamenting over prior experience being spent on a project in language X over language Y. Clueless customers go with the flow (the buzzwords, etc) without understanding the technology. Do you really want them making your technical decisions for you?
I agree with you that I do not condone lying. But if you are in a situation ["What *really* matters (to me, anyway) is staying employed"] where you really need a job (kids, spouse, rent, etc), then something as trivial as what language a past project was coded in is truly irrelevant. In which case, I can understand someone increasing their chances by 'flipping bits' on their resume; I've seen countless resumes go down the trash shoot for plenty of other trivial reasons ("it looks ugly!!", etc).