in reply to How do you program (again)?

Inspired by Lisp, I prefer the method of bottom-up programming. In its essence it's simple:

You have a task - T to solve. So, you don't just write a program to solve T. You first write a whole new language for solving tasks like T, and then you use this language to solve T.

By "language" I don't mean a whole new programming language (though with Lisp's powerful macros, which thankfully found their way into Perl 6, it looks this way) but rather a new level of abstraction (functions, classes, data types) above the basic language that helps to solve the task easily.

Such design results in very few bugs and immense flexibility. The flexibility comes because while requirements often change, they most commonly affect the "top layers". If you have a powerful abstraction, you recode those easily.

Naturally, some mix-in of top-down design is also required, but that's only when the task at hand is large and comprises of several large sub-tasks that can be independent.

Replies are listed 'Best First'.
Re^2: How do you program (again)?
by wazoox (Prior) on Jun 03, 2005 at 07:08 UTC
    I see, that's more or less the way I follow by now. My concern is that while I build tools and objects, I postpone the time when I write the actual program that will do "the task". Beforehand, I used to write a program that more or less did the task, then improve it gradually... easier, but hard to maintain.
      One of the benefits of the technique I presented is that it's actually easier to reach a working program quickly.

      When you write in layers from the bottom up, you test each layer which is simpler than the whole program, and thus assure yourself minimal bugs (debugging usually takes more time than code-writing). When you write the next (higher) level, you rely on a tested lower level and have more confidence. Massive unit-testing along the way and you're set for a working, clean solution.

        Well, I'll need sooner or later to dig into Test... I always test my code as I write it, I simply cut and paste small parts in little scripts... That's not elegant but that works pretty well!