Code Reuse in Programming – Image Reuse in Art.

March 5, 2009

Last Supper - San Marco Last Supper - Ognissanti

In Florence, Italy, there are two painting of the Last Supper that are almost identical. These are painting by the artist Ghirlandaio in the churches of San Marco and Ognissanti. What is unusual is that these pieces are almost identical, as opposed to just similar.

Most people know of da Vinci’s last supper, but what they don’t realize is that there are many last suppers. It is a painting commonly painted on the walls of the dining rooms of monasteries. The purpose of religious art is to recreate a past event from the scriptures so it can bring that event into the present, hence a last supper painting in a dining room.

There is a belief that creativity involves individuality, but in religious painting, there are very strict rules about the subject matter. The subject matter and arrangement of elements is very much dictated by the church. But, there is room for variation. For example, the Ghirlandaio Last Suppers have Judas seated on the opposite side of the table. Da Vinci’s has them all seated on the same side of the table. This makes it unique.

So how does his relate to programming?

In programming, there are a set of standard rules ( called Design Patterns ). These are the standard way of doing things.

Although we reuse patterns, we really are very poor at reusing code.

There is open source, which gives a framework, but not really a solution.

Look at some examples of reuse in art.

The Architect Frank Lloyd Wright designed a house for Ayn Rand. When Ayn Rand decided not to build the house, he had no issues with ’selling’ the design to another client.

In painting, a major portion of the creative time is consumes with setting up the composing the subject matter and drawing the subject. The artist Degas would make a drawing on a non-absorbent surface and press paper onto it, creating a monoprint ( literally unique one-time print ) . He would then do another. Because the process basically involves transferring the image to paper, the image eventually is removed from the original surface. So, Degas created a series of prints. He took the sheets of paper with images that we too faded to be sold as prints, and colored these with pastel. This gave him a set of drwaings. Hence one drawing could become about 5 works or art. This is a classic example of reuse.

Degas - Monoprint and Pastel

So, how can we do this in programming?

I believe that the proverbial walking skeleton is the solution. Whereas Frameworks provide low level reuse, a walking Skeleton provides a reusable backbone for code. Its major advantage is that since it provides a computer system that is complete, skeletons can be reused. This is because a skeleton is application independent. It’s sort of like Degas’s monorpints in that it reuses the structure.

Also low level code can be reused. On every project I write an indexOf method which accepts a String and an array of Strings. It returns the index of the String in the Array ( -1 if not found ). This means that I can execute a case statement based on an input string. The method ignores case. I also create duplicates of lot of Java methods that are case insensitive versions. This saves me a massive amount of coding. Most projects with unfamiliar technology could benefit if the first thing developed on the project were a set of common utilities. To ease the delay in developing these common components, the initial version merely needs to be stubs returning dummy data. On a recent project, I made the switch between dummy and real data switchable. When the license to one of the external services expired, we could consider developing using the dummy data.

Open Source is touted as a great solution, but I am becoming less enamored with Open Source the more I use it. There is a philosophy that you can change the source code if required. How many people change Open Source source, and how many customers would let you do it? The biggest joke is that on a recent project, a custom coding solution was rejected in favor of open source; it was suggested that the custom code be uploaded to source forge and then reimported to the project. My issue with Open Source solutions, is that the one thing that is missing is adequate documentation. If a customer would not accept a project without documentation, why would ( or should ) they accept a project that is totally dependent on an undocumented product.

In summary, reuse in art has been used to reduce the choices made about mundane issues. In programming, we need to think about reuse as a means of reducing the mundane repetitive coding tasks that are present on every project. We need to treat programing like a creative process with different stages and priorities at each stage of the process. If we can minimize the time spent on the mundane, we can spend more time on the enjoyable creative elements. Look at some paintings of the Last Supper and see the creative variations that exist in each of the works. The creativity is in the variations, not the mundane.

Entry Filed under: Uncategorized. Tags: , , , .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Blogroll

The Creative Site Administrator

Creative Time Management.

March 2009
M T W T F S S
    Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031