Friday, October 5, 2007

Software Visualization

Software visualization is defined as “the use of the crafts of typography, graphic design, animation, and cinematography with modern human-computer interaction and computer graphics technology to facilitate both the human understanding and effective use of computer software.”(John T. Stasko et. al.). It is a specialization of information visualization, whose goal is to visualize any kind of abstract data, while in software visualization the sole focus lies on visualizing software.


Software visualization and reverse engineering: Software visualization has been widely used by the reverse engineering research community during the past two decades. Many of the approaches provide ways to uncover and navigate information about software systems. The graphical representations of software used in the field of software visualization, a sub-area of information visualization, have long been accepted as comprehension aids to support reverse engineering. Software visualization has become one of the major approaches in reverse engineering, Koschke reporting that 80% of interviewed researchers consider visualizations as being important or absolutely necessary in software reverse engineering.

The enormous interest in visualization as an aid for reverse engineering and problem detection can also be inferred from the large number of tools that have been developed for this purpose: Rigi, SHriMP, CodeCrawler, Mondrian, etc.

My interest in this domain appeared during my visit to SCG, during my diploma thesis, when I created a set of new visualization for Lisp systems, developed to underline the differences of the language and to help understand and browse complex Lisp systems. For more information see my diploma thesis.

Friday, March 16, 2007

Going META!

Recently i am interested metaobject protocols.
Reading "The Art of the Metaobject Protocol" by Gregor Kiczales, Jim Des Rivieres, Daniel G. Bobrow (MIT Press) was a wonderful experience for me.
Like Alan Kay said: "The Art of the Metaobject Protocol is the best book written in computing in ten years" (Keynote OOPSLA 1997).

In a language based upon metaobject protocols, the language implementation itself is structured as an object-oriented program. This allows the power of object-oriented programming techniques to be exploited to make the language implementation adjustable and flexible. In effect, the resulting implementation does not represent a single point in the overall space of language designs, but rather an entire region within that space.

A metaobject protocol (MOP) is an interpreter of the semantics of a program that is open and extensible. Therefore, a MOP determines what a program means and what its behavior is, and it is extensible in that a programmer (or metaprogrammer) can alter program behavior by extending parts of the MOP. The MOP exposes some or all internal structure of the interpreter to the programmer. The MOP may manifest as a set of classes and methods that allow a program to inspect the state of the supporting system and alter its behaviour. MOPs are implemented as object-oriented programs where all objects are metaobjects.

The the best-known runtime MOP and the most powerful is the one described in the book "The Art of the Metaobject Protocol"; it applies to the Common Lisp Object System (CLOS) and allows full reflection (introspection and intercession) on every entity in CLOS (object, classes, methods, slots) and even on the mechanisms of inheritance, method dispatch, class instantiation and so on.

Even if your not interested in this meta-stuff, you should read this book because you will think differently after that, and you'll look at OO programming from another angle.
So my advice is: go META!

Saturday, February 3, 2007

Stratified design

This is an idea from the book "Structure and Interpretation of Computer Programs" by Hal Abelson, Jerry Sussman and Julie Sussman (an excellent computer science text used in introductory courses at MIT - a must read book).
They come with the idea of Stratified design (programming in a sequence of levels, one level based on another), giving the example of The picture language.


"We have obtained a glimpse of another crucial idea about languages and program design. This is the approach of stratified design, the notion that a complex system should be structured as a sequence of levels that are described using a sequence of languages. Each level is constructed by combining parts that are regarded as primitive at that level, and the parts constructed at each level are used as primitives at the next level. The language used at each level of a stratified design has primitives, means of combination, and means of abstraction appropriate to that level of detail. ... Stratified design helps make programs robust, that is, it makes it likely that small changes in a specification will require correspondingly small changes in the program."

There is also a paper by the authors of the book on this topic: "Lisp: A Language for Stratified Design" by Abelson and Sussman.

This idea is put to work in some of the newer trends in programming, like Language Oriented Programming (Sergey Dmitriev), Intentional Programming (Charles Simonyi), Language workbenches (Martin Fowler), Little Languages (Matthias Felleisen), Grammarware (Ralf Lammel), etc.

Sunday, January 21, 2007

Static vs. Dynamic Languages

In static typing all expressions have their types determined prior to the program being run (typically at compile-time).
Dynamic typing, also called latent typing, determines the type-safety of operations at runtime; in other words, types are associated with runtime values rather than textual expressions.

There's a lot of debate around dynamic vs. static typing.
The advantage to static typing is said to be increased safety, because types are checked before running the program and so many bugs are thought to be revealed.
The advantage to dynamic typing is that you do not waste all your time thinking at type problems and you can focus more on the programming itself. And about safety, even if you do not have compile time type checking, experience showed that dynamic languages (Lisp and Python) are surprisingly bug-free. Another good think with dynamic languages is that they do not restrain you from expressing naturally your thoughts directly. Dynamic languages are very good at prototyping and experiencing new ideas, because the delay between idea and runnable program is much more shorter. And even so it is showed that dynamic languages can scale; there are a lot of big projects using dynamic languages.

Even Bruce Eckel, author of "Thinking in C++" and "Thinking in Java", admitted that he prefers Python for expressing more naturally his thoughts in his article Static vs Dynamic: "I think that statically typed languages give the illusion of program correctness... In my own experience, it's very helpful to create models in a dynamic language, because there is a very low barrier to redesigning as you learn. Possibly more important, you're able to quickly try out your ideas to see how they work with actual data, to get some real feedback about the veracity of the model, and change the model rapidly to conform to your new understanding... By developing the model in a language that encourages change, my experience is that you end up with a better model, and this produces a distinct benefit when that model is translated to your implementation language... This last point is a major puzzle – we believe that static type checking prevents bugs, and yet a dynamically-typed language produces very good results anyway... My guess is that Python allows me to think more clearly about the concepts of the problem that I'm trying to solve. It is less distracting because it doesn't force me to think so much about the rules imposed by the language – rules that are basically arbitrary when I'm trying to produce an effective model of my problem space. By getting out of the way, Python and similar dynamic languages allow me to spend more of my brain's "seven plus or minus two" items on the problem itself, and less on the details of the language implementation... These are a couple of examples where too much static type checking, no matter how well-intentioned, gets in the way of both the creation and the examination of code."

So the conclusion: static typed languages are thought to be safer but dynamic ones turned to be more bug-free; static typed languages "stay in your way" of expressing your thoughts in programming while dynamic ones are more naturally at expressing ideas and experimenting. So why everybody insists on static typed languages?

Saturday, January 20, 2007

Languages are software too!

Most people focus their attention on the software engineering, and always neglect the language. They think that languages are something static, with no evolution.

This idea is pointed out by Jean-Marie Favre in "Languages evolve too! Changing the Software Time Scale":
"However, most academics still consider languages as immutable artefacts. Language/software coevolution issues are still neglected. Migration issues are however commonplace in software industry... It is therefore time to recognize that languages evolve too. Languages are integral parts of software products. Languages are software too. This paper surveys a few models of evolution taking decades and centuries as time-scales."
"Misconception: languages are immutable. While everybody agree that software architecture evolves, most academics still consider computer languages as if they were immutable artefacts. For instance most people consider “grammar evolution” and “grammar reverse engineering” as strange combination of words. They often argue that a grammar can be seen as a mathematical entity, and as such it is eternal."

So if we study software engineering, why not study "language engineering". This term was coined by Ralf Rammel: "Who needs a language engineer? Language engineers are into grammars, types and declarative programs; they seek to facilitate these concepts for the purpose of improving the practice of software development; they push forward language-engineering foundations inspired by practical needs."

Languages are pieces of software: they are designed, implemented, maintained, and they also evolve. So to think languages are "immutable artefacts" it's only naive.

Patterns... what they really are?

There's a lot of talking around patterns in the last years. What patterns really are?

wikipedia.com says: "In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations."

Christopher Alexander says: "Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice"

GoF says: "A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem in object-oriented systems. It describes the problem, the solution, when to apply the solution, and its consequences. It also gives implementation hints and examples. The solution is a general arrangement of objects and classes that solve the problem. The solution is customized and implemented to solve the problem in a particular context."

Alexander is the "father" of the idea, but GoF are accredited with the idea to apply patterns to programming. But don't let the GoF patterns mislead you. Those are only instances (Radu Marinescu) of the more general idea of pattern, the one intended by Alexander. The GoF patterns apply only to OOP and especially to static typed languages (C++/C#, Java, etc.). But these patterns don't apply for example to dynamic languages (like Lisp). Peter Norvig pointed this out in his paper "Design Patterns in Dynamic Programming": "16 of 23 patterns have qualitatively simpler implementation in Lisp or Dylan than in C++.", "16 of 23 patterns are either invisible or simpler." This lead people to say that "Patterns are signs of weakness in programming languages."(Mark Dominus - "Design patterns of 1972") and "When I see patterns in my programs, I consider it a sign of trouble. The shape of a program should reflect only the problem it needs to solve. Any other regularity in the code is a sign, to me at least, that I'm using abstractions that aren't powerful enough." (Paul Graham - "Revenge of the Nerds"). I think this is true, every pattern (or almost every) shows a missing feature in the language. Take for example the visitor pattern in C++/Java; it shows the missing of double-dispatch in the language. The same way in C we have the "Object-oriented class pattern" which shows the lack of OOP. So i must agree with Paul Graham that a pattern is a sign that were missing an higher abstraction.
If you want to know more about what Alexander's idea of patterns is then you better read his books, not GoF! Another book that speaks about Alexanders patterns in programming, not instances, is "Patterns of Languages" by Richard P. Gabriel.
So when you think at patterns, don't think at instances, but at a meta-level (Radu Marinescu), at the real idea of pattern.

Why Lisp?

I am big fan of the Lisp programming language. And everybody when hears this asks me "Why Lisp?". This is why, or better said, this is where you can find out why.

The best description of Lisp lies in the following quotes:

"Lisp has jokingly been called "the most intelligent way to misuse a computer". I think that description is a great compliment because it transmits the full flavor of liberation: it has assisted a number of our most gifted fellow humans in thinking previously impossible thoughts."
- Edsger Dijkstra, CACM, 15:10

"Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot."
- Eric Raymond, "How to Become a Hacker"

If you really want to know what Lisp is about, you could read the following articles:

Now if you want to learn Lisp, you could start with this books:

The place to start: The Association of Lisp User

And if you need a Lisp implementation (software) i recommend:

Generative programming

In the present i am interested in a way new of doing programming. This is widely known as Generative Programming but there are a lot of similar ideas. Here is a list of those similar ideas:
  • Domain Specific Languages
  • Model-Driven Engineering
  • Generative Programming
  • Language Oriented Programming (Sergey Dmitriev)
  • Intentional Programming (Charles Simonyi)
  • Language workbenches (Martin Fowler)
  • Little Languages (Matthias Felleisen)
  • Software Factories (Microsoft)
  • Family-Oriented Abstraction, Specification, and Translation (The FAST Process) (David Weiss - Lucent)
  • Grammarware (Ralf Lammel)

Maxwell’s equations of programming

Alan Kay – „How Simply and Understandably Could The "Personal Computing Experience" Be Programmed?” at The Intel Research Berkeley Programming Systems Seminar Series (November 27th 2006)


This are „Maxwell’s equations of programming”:

from John McCarthy – „LISP 1.5 Programmer's Manual”


Now we have to discover „The theory of relativity of programming” ...


Who's more important: the programmer or the machine?

This is a very important question you have to put to yourself before doing anything, because this will have a great influence on the way we program and think. Most of today's people are focusing on the machine: run faster, optimize, performance. This was a good idea back in the 60's-70's when machines were slow and the price of hardware was bigger than the price of programmers, but today (and from a long time ago) the proportion was reversed, people are way more expensive than hardware. So way always think at the machine, think at the programmers: what is better for them, how is more convenient for them. Thinking at the machine makes us lower the way we think and think like the machines, and this is by no means a good thing.

Donald Knuth: "Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do."

Yukihiro "Matz" Matsumoro: "Often people, especially computer engineers, focus on the machines. They think, "By doing this, the machine will run faster. By doing this, the machine will run more effectively. By doing this, the machine will something something something." They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves."

John Backus: "While it is perhaps natural and inevitable that languages like Fortran and its successors should have developed out of the concept of the von Neumann computer as they did, the fact that such languages have dominated our thinking for twenty years is unfortunate. It is unfortunate because their long-standing familiarity will make it hard for us to understand and adopt new programming styles which one day will offer far greater intellectual and computational power."

Allen Newell: "Millions for compilers but hardly a penny for understanding human programming language use. Now, programming languages are obviously symmetrical, the computer on one side, the programmer on the other. In an appropriate science of computer languages, one would expect that half the effort would be on the computer side, understanding how to translate the languages into executable form, and half on the human side, understanding how to design languages that are easy or productive to use.... The human and computer parts of programming languages have developed in radical asymmetry."

The Feyerabend Project

The Feyerabend Project is Richard P. Gabriel's attempt to repair the arena of software development and practice.
"Fifty years into the First Computing Era some of us in the computing arena have come to realize we’ve made a false start that can’t be fixed, and for us to finally be able to produce lasting, correct, beautiful, usable, scalable, enjoyable software that stands the tests of time and moral human endeavor, we need to start over. Perhaps we’ll be able to salvage some of what we’ve learned from the First Era, but I expect almost everything except the most mathematical fundamentals to be brushed aside."
To begin thinking about how such a reinvention can take place, Richard P. Gabriel have put together some small workshops: at ChiliPLoP, at EuroPLoP, at OOPSLA.

What's next?

Were is the programming world of today? To a new paradigm shift (personal opinion). The current programming paradigm (object-oriented) is fading. Programmers need something more (you'll see this need more in the research area, not in the commercial area). But which will be the new paradigm? AOP, MDA? There's a lot attention to models this days; a lot of people would bet on that. The problem is not to focus all our attention in only one place. And maybe incremental evolution is not the answer. All great discoveries were revolutionary and not incremental evolutions. What would it be if Einstein didn't dare contradict all physics of his days to say that things are not as they seem? As Alan Kay says in a presentation at "The Intel Research Berkeley Programming Systems Seminar Series", we have the equivalent of Maxwell's equations (i'll let you discover what they are), but we still need the Theory of Relativity... This is kind of a radical way to think but this is the only way to get new and great things.

In 1975, Berkeley philosopher Paul Feyerabend wrote a book called "Against Method," in which he said: "...one of the most striking features of recent discussions in the history and philosophy of science is the realization that events and developments ... occurred only because some thinkers either decided not to be bound by certain ‘obvious’ methodological rules, or because they unwittingly broke them."
In "The Invisible Computer," Donald Norman wrote, "...the current paradigm is so thoroughly established that the only way to change is to start over again."

State of purpose

This blog will be a way of expressing my thoughts on programming. This will be something different, you will not see mainstream ideas here, but instead you will get new ideas, new way of looking at programming. As the subtitle says this is about the programming world of tomorrow. I will try to gather here some ideas from a lots of people i consider appealing and off course some of my ideas. I hope this will lead to something good, and helpful. So lets start...