Mostrando entradas con la etiqueta modular programming. Mostrar todas las entradas
Mostrando entradas con la etiqueta modular programming. Mostrar todas las entradas

miércoles, 23 de julio de 2008

The physics of software.

Rosenberg brings up yet another interesting point when it comes to software development:
" 'Software engineering' is something of an oxymoron," L. Peter Deutsch, a software veteran who worked at the fabled Xerox Palo Alto Research Center in the seventies and eighties, has said. "It's very difficult to have real engineering before you have physics, and there isn't anything even close to a physics for software."

(Rosenberg: p. 276)

However, is it even possible to find out the "physics of software"? Is there one? The natural answer to that question is that, obviously, there is none. Software doesn't have a physical existence of any type whatsoever. It only exists in the form of bits and code and, prior to that, in a programmer's mind or, at the very best, some well documented specs. In that case, we could assume that Deutsch is right on the money: there is (and there will never be) any true software engineering discipline. And yet, is Deutsch's premise correct? Is it true that only physical things can be "engineered"? I suppose it all depends on the approach one takes to the issue. If we start from a mechanistic point of view, the assumption that only something physical can be engineered appears to be true. However, if we take a more systemic approach, it would appear as if everything is information, bits that flow around and can be channeled in one form or another. If his latter vision were true, then the problem is not so much that software engineering would be impossible but rather that we'd have to modify our own concept of what engineering means.

lunes, 21 de julio de 2008

Tree structures vs. semi-lattices (and the advantage of organically grown, dynamic structures).

I found the following two paragraphs quite inspiring:
One day in April 2004, Chao Lam sent Mimi Yin a link to an article that he had found in a blog posting by a writer named Clay Shirky, a veteran commentator on the dynamics of online communication. Shirky had written about his rediscovery of an old article by Christopher Alexander, the philosopher-architect whose concept of "patterns" had inspired ferment in the programming world. The 1965 article titled A City Is Not a Tree analyzed the failing of planned communities by observing that typically they have been designed as "tree structures". "Whenever we have a tree structure, it means that within this structure no piece of any unit is ever connected to other units, except through the medium of that unit as a whole. The enormity of this restriction is difficult to grasp. It is a little as though the members of a family were not free to make friends outside the family, except when the family as a whole made a friendship."

Real cities that have grown organically —and real structures of human relationships— are instead laid out as "semi-lattices", in Alexander's terminology. A semi-lattice is a looser structure than a tree; it is still hierarchical to a degree but allows subsets to overlap. Why do architectural designs and planned communities always end up as "tree structures"? Alexander suggests that the semi-lattice is more complex and harder to visualize and that we inevitably gravitate toward the more easily graspable tree. But this "mania every simpleminded person has for putting things with the same name into the same basket" results in urban designs that are artificially constrained and deadening. "When we think in terms of trees, we are trading the humanity and richness of the living city for a conceptual simplicity which benefits only designers, planners, administrators, and developers. Every time a piece of a city is torn out, and a tree made to replace the semi-lattice that was there before, the city takes a further step toward dissociation."

(Rosenberg: pp. 184-185)

Aside from the obvious implications all this has for urban planning, there are also some consequences for software development. In this sense, the traditional approach to programming that viewed it as something akin to building a bridge, a huge work of engineering that needed to be planned way ahead, discussed, negotiated, documented and supervised prior to even laying out the first stone ought to give way to a different, more dynamic approach. This is precisely what has been happening in the last decade or so with the rise of agile methodologies of software development and, in general, the open source approach. Things are now to be understood in a more dynamic manner, as a flow, as something more amorphous, difficult to comprehend and control, an ever-changing set of specifications and features that needs to be managed in the sense of being navigated through —surfed even—, more than controlled. Reality is too rich and diverse to shoehorn it into a predefined shape.

Now, what I find quite interesting in all this is that the above description is quite compatible with the works of Gilles Deleuze, Félix Guattari and Manuel de Landa. Reality is to be described as a rhizome instead of a tree. Hierarchies may exist, but in a completely different form. They are not absolute anymore. They are highly dependent on the position they (and us) occupy in the whole landscape of things. I find it difficult to believe that a philosophy like this may not rise to take center stage in our century, replacing the outdated mechanistic approach of the past.

Developing software in "Internet time".

When it comes to software development, something changed in the last 15 years or so. Sadly, we have not figured out the way to write software without bugs, neither have we come up with a way that allows non-programmers to put applications together. However, what has definitely changed is the time our programmers are allowed to sit on a project before they release the code. Let's put it this way: code has become a big business, which means that the time that can be dedicated to the development of a particular product has now shrunk significantly, since there is a need to monetize it as soon as possible. And what changed all that? It was the Internet and, above all, Netscape. Michael Toy, ex-Netscape employee, has an obvious bias for developing software in what has become to be known as Internet time:

"... I frankly admit that I am heavily biased toward: Let's ship something and put it in people's hands and learn from it quickly. That's way more fun, way more interesting, and, I think, a much better way to do things than to be sure that what we're doing is going to last for ten or fifteen years. It looks like Chandler is trying to be very architecturally sound and to be almost infinitely willing to delay the appearance of the thing in order to have good architecture. It's Mitch's money, so he can make that trade-off any way he wants. And it could be that that willingness to go slow is going to pay off hugely in the future. But it's really hard for someone who wants to ship software next week."

(Rosenberg: p. 171)

It's the very same approach taken by open source development: release quick and release often, then make changes depending on the users' feedback. This is quite far from the original intent to reach perfection that was shared by pretty much every original software engineer. Back then, the aspiration was to "write software like we build bridges". I'd say the overall attitude has changed now. We don't think we can build the perfect program anymore. We prefer to think of it all as a process, not an end product. Even better, it is a process that never ends. We put together a prototype and release it out there. Users give it a try and provide some feedback —some of them may even provide code too! Then, we take that and build upon the original prototype. In other words, software development is less software engineering —building a definite product from the well defined plans— than a craft or an art always trying to perfect itself by the use of a set of so called good practices. This is the hige shift in mentality brought about in the field by Internet time.

viernes, 18 de julio de 2008

Work meetings that go into an infinite loop.

Ah, how did the following view exchange reminded me of so many work meetings!
"The question is," said Mitch Kapor, deep in the middle of a long meeting in a series of long meetings, "How do we sequence things to avoid spending an infinite amount of time before anything useful happens?"

"It's only infinite if you're stuck in a loop," Hertzfeld replied.

(Rosenberg: p. 152)

Vitruvius applied to software design.

Inspiration can truly come from anywhere, but when it comes to software design it is clear that there is a connection between it and architecture, as Kapor noted:
Software design, Kapor argued, was not simply a matter of hanging attractive graphics atop the programmer's code. It was the fundamental creative act of imagining the user's needs and devising structures in software to fulfill those needs. As the architect draws up blueprints for the construction team, so the software designer should create the floor plans and elevation views from which software engineers would work. Reaching back to ancient Rome, Kapor proposed applying to software the architecture theorist Vitruvius' principles of good design: firmness —sound structure, no bugs; commodity —"A program should be suitable for the purposes for which it was intended"; delight —"The experience of using the program should be a pleasurable one".

(Rosenberg: p. 149)

The terms may sound outdated, but the idea truly still applies: a well designed software should be solid and consistent, able to meet the requirements and a joy to use. Apple's designers have always put this advice to good use.

jueves, 17 de julio de 2008

The paradox of reusable code.

The dream of code reuse has been with us for quite sometime. It promises to speed up the time it takes to write a given project and, even more important, it also promises sturdy, well tested components that may overtime become completely free of bugs. This is what people mean when they talk about modularity. Well, as Rosenberg explains in his book, code reuse is widespread these days and it does contribute towards solving some of the problems programmers had to deal with in the past —especially, it does speed up the time to completion. However, it is not free of its own problems.
Here is one of the paradoxes of the reusable software dream that programmers keep rediscovering: There is almost always something you can pull off the shelf that will satisfy many of your needs. But usually the parts of what you need done that your off-the-shelf code won't handle are the very parts that make your new projects different, unique, innovative —and they're why you're building it in the first place.

(Rosenberg: p. 102)

This is almost by definition. A reusable component exists because a relatively high amount of people had a particular need in the past and it was written to satisfy that need. However, any project that is truly unique and innovative will have, by definition, needs that didn't exist before. It's one of those doh moments, isn't it?

However, there is another face to this paradox that's even more worrisome. What happens if a given project decides to use a particular reusable component from the get-go and later on finds the need to innovate and/or make some deep changes? Either they have to invest the time to learn the component —and we are talking about large and difficult pieces of programming here, such as Zope— or they have no other choice but to shoehorn their innovations into it. Needless to say, this leads to more bugs and, eventually, to an unmaintanable project.