Concept Programming
descubes writes "A recent article asked about improvements in programming. Concept programming is a very simple idea to improve programming: program code should reflect application-domain concepts. What is amazing is not the idea itself, but how often we don't apply it, and how much existing tools and techniques can get in the way without us even realizing it. To be able to represent all concepts equally well, we need tools that don't force a particular, restricted vocabulary on us. The Mozart project is a Free Software project to implement concept-programming development tools. It includes the Coda universal intermediate language, the Melody persistent program representation, the Moka Java-to-Java extensible compiler, and a fairly advanced front-end for a new programming language called XL. In the long run, Mozart can give the Free Software community a foundation for something as powerful as Charles Simonyi's Intentional Programming."
I apply this principle all the time.
I write lisp macros, essentially extending the language and customising the object system to incorporate the domain-specific concepts, rolled into a package.
It's the way many forth coders work too, BTW.
I find it interesting that lisp, coming from the really high-end and forth, coming from the really low end, feel so similar in this respect.
Isnt this the whole philosophy behind OO programming? ISTR my OO teacher saying something like "every class should reflect a real-world concept"... but hey, it's been a while. I could be wrong.
At my first engineering job, twenty years ago, the head programmer liked to say, "Sounds like bullshit to me!" It is only when I read about things like this that I miss him...
The first example discusses the concept of "Maximum", and shows how you would implement that concept in Java, followed by the allegedly superior XL way to do it. The Java "class" makes no sense, and really would not be the way to go about it. YOu would never want to model the concept of Maximum in that way, but if you did, you would use the already-existing Comparable interface and creating a static method called "Max" of some class that takes a list of comparable objects.
Furthermore, in C, you can model it exactly as they have, since C allows multiple arguments.
The next example was discussing takinga derivative and how you can translate some incorrect Java syntax that takes a derivative into the Java equivalent. Why not write a method to do this? What is to be gained by using a non-standard syntax? It makes it harder to write (you have to learn something in addition to Java), and harder to read (same reason).
As for the XL language, and the notion of Concept Programming, it just wasn't explained well at all, and left me saying "what's the big deal? What does this buy me? Where is a real example?" Not every program (dare I say not many programs) are based around mathematical equations and operations. Most involve executing some logic based on input and spitting out output. Modelling that as math seems really counterintuitive (and not in-line with the "concept" of your domain).
Ultimately, seems like some typical academic wank-fest that someone can use to get their Ph.D., but not very applicable in the real world.
http://www.naildrivin5.com/davec
from the justification:
;) ...
Projects fail not because of language defects, but because people insist on using the wrong tools. Projects succeed when people use the right tools, not because of the features of these tools.
I'm not against this point of view, because I have problems thinking for myself
Isn't this the idea behind a rich OS, like a *nix?
I have all these languages to choose from, that I can glue together many different ways... I don't have to nail myself to A solution, and thereby A drawback.
I can get the drawbacks of everything, all at once!
Maybe I'm sadistic, but I like having a lot of tools in my toolbox. I like that if I don't understand a concept in a language, I'm not shut out of the programming flock forever.
I knew I should have just posted something funny and hung up. Coffee...
Keep your packets off my GNU/Girlfriend!
*Begin Rant*
I'm not about to say this or any of the other ideas referenced are bad, at least not always. It just seems like an idea that needs more proof, evidence, or something beyond an opinion.
In physics, chemistry, and other hard sciences, ideas are submitted to far more scrutiny than many of todays ideas. We can come much closer to proving the ideal gas law than theorists have bothered to do with design patterns, OO, concepts, extreme programming, etc. Too often in computing today, an idea is "proven" when some analyst, poohbah or Slashdot has referenced it.
Since there really isn't any hard math, evidence and such, the idea is much closer to opinion than fact, and as such won't last very long.
I'd submit that the best approach to programming is to hire good people, and keep them once they learn the product. Give them a real budget with realistic deadlines. Listen to the developers. Think twice before shoving methodology dujour onto the development team. A good team probably can function more efficiently and effectively without unsubstantiated opinions. When something is *really* substantiated, then developers should and would listen.
*End Rant*
Reading around his site I think I'm impressed by the volume of work put in, and (if it is indeed as he claims), the quality of e.g. complex number manipulation.
Mozart is a poor choice of name, unless it is very very very old - because it is already taken by a programming system (see the Oz language).
Also, check out Pliant which is (relatively) mature, and does most of what is discussed on the site and a whole lot more.
This really is a silver bullet posting.
Don't you love simple, two-word statements that the majority of your audience understands to mean "someone's become fixated on something that will magically 'fix everything'"?
I could make exactly the same type of post about any technology or approach.
When trying to make people aware of an approach that they do not know, do *not* use words such as "amazing". They simply obscure any real information, and turn off precisely those people who it may benefit.
If I were to run your post through spambayes I suspect it would classify your post as spam on my machine. Although it may have enough useful markers to counteract the obvious spam markers.
So, how will introducing the concept of "concepts" make it any easier to write code? I have no concept of how the concept of concepts will help me to conceptualize programming concepts. A class might be a concept, a function might be a concept, windshield degradation on your racing simulation might be a concept... It appears that that "concept programming" is just a fancy way of talking about waving your hands in the air.
From the REALLY LIMITED amount of information about "concept programming" on the linked site, it appears that the author REALLY REALLY wants to use higher-order functions (a la Scheme or Haskell), but he just doesn't know it.
That's "Mr. Soulless Automaton" to you, Bub.
Forget XL for a moment. My objection is based on the idea of "concept programming". Based on the information on your site, concept programming could be anything at all.
If concept programming really means anything, then you need to sit down and write up a detailed and exact description of what this is. If your description takes less than 5000 words, go back and see what you left out. Most importantly, don't refer to XL or any examples written in XL, as these will just confuse the issue at this point.
After you have defined concept programming clearly and exactly, then you should write a paper on XL as an example of a language designed for concept programming. Be sure to explain exactly what you mean when you say that XL is "more extensible than Lisp". You should also compare and contrast XL with languages such as Scheme, Haskell, Dylan, and Smalltalk. Do NOT mention performance or optimization in this paper AT ALL. XL is a language, and languages do not have performance characteristics. Performance is a property of an implementation.
Finally, when you've defined all this stuff, you can talk the performance of code generated by the current implementation of your compiler. This document is the least interesting, because, if you are working diligently at it, performance of the next version of your compiler should be better, and so on. So this document will change rapidly, while the first two should change either very slowly or not at all.
Sorry to be pedantic. I'm trying (now) to help you explain (to me and everybody else) why concept programming is something we should be interested in.
That's "Mr. Soulless Automaton" to you, Bub.
The trouble with all this conceptual stuff is that unless you can get a decent spec, or, at the absolute minimum, useful feedback from the end user, all you end up with is a conceptually elegant and/or implementationally efficient useless program rather than an inelegant and/or inefficient useless program.
In my experience, being tied into the wrong programming metaphor, or the wrong object set, or whatever, is far worse than spagetti code. At least with spagetti, all options are equally possible and equally bad, or good. Once you start having to fight your metaphor or object model, you end up with kludges that make Fortran look like a really beautiful thing.
And, again in my experience, the only way to get a decent spec is to write the code at least once, wave it at the user, list all the wrong assumptions, throw all the code away and start again. Which is not something coders like very much. But wasn't it that guru guy from Xerox (Kay?) who said that the best thing for software integrity was frequent fires in the backup store?
Virtually serving coffee
Thanks to all of you in the Slashdot community who offered interesting feedback. I've started taking this feedback into account, and updated the web site.
-- Did you try Tao3D? http://tao3d.sourceforge.net
In one place on the XL site, we see "The syntax itself generally matters very little in the long term, as long as it is not completely inane or ambiguous." Elsewhere, we see "Try and do numeric-intensive programming, and LISP is no good either, not because of its performance, but because mathematicians write 1 + 1 rather than (+ 1 1)". So...which of these mutually exclusive claims would the author have us believe?