Algorithm Effectiveness

 

Introduction.  This page is likely to ramble through a variety of topics.  I'm quite certain I cannot make certain points I would like to make and share certain insights within this page or time we have in this course.  But I want to at least address some issues so that I can bring them up at different times during this course.

It should make sense that some coding practices are more effective than others.  Oftentimes code effectiveness is like other forms of beauty which is in the eye of the beholder.  As far as I'm concerned we really do shortchange notions of algorithms and data structures in our course work.  But on the other hand, we only have so many credits in the major, and most students that are more concerned about more abstract notions such as algorithm analysis, design and implementation are in departments of Computer Science rather than Computer Information Systems.  In spite of this, I do want to address these sorts of issues within the context of developing functioning applications.  I also hope that approaching it this way throughout our semesters together will make this more meaningful.  Far too often, Computer Science programs study old approaches that have been around for quite a few years that relate to situations that really aren't all that useful from most student's perspectives.

Rather than discuss algorithms at present, which you have probably seen to some extent before.  I want to give a broad sort of discussion about effective design of algorithms.

I think it was the German Bauhaus movement in architecture that first popularized the phrase "less is more".  While it doesn't often result in more inspiring architecture, it really can have a lot of impact. 

In engineering and systems, less is more! 

Well, I tease.  I'm trying to develop my skills at appearing as an authority so I can get less disagreement from others with less effort, insight and capabilities from myself.

Certainly, if I could do this it would be getting more from less effort. 

So clearly, it is not adequate to say less is more and apply it in all situations.  But if you can develop a high selling product with less effort you are likely to feel you have discovered something of value!  Unfortunately, this isn't necessarily good either.

When Is Less More?  Ugh!  What a question!

When you prepare for tests and develop computer programs you really are likely to be happy if you get more in terms of your grades with less effort.  Hopefully, this is accomplished by trying to figure out ways to increase your knowledge and understanding in ways that require less effort.  In actuality, I as a professor also like it when my students are crafty and clever enough to figure out ways to reduce their work and effort but still finish their programs and learn.

And all these years your parents and teachers have been calling this laziness!

When you choose to buy a product from one producer rather than another you are likely to have certain features and quality expectations in mind.  You are likely to choose between comparable products by trying to get more for less.  But as many people seem to fail to realize, everyone else is also doing this, so in order to get money from others you are likely to have to continually improve your capabilities at providing more for less in order to stay competitive.

Sometimes you really do get back from others what you do unto them!

So clearly, the phrase "less is more" is overly simplistic, but a truth particularly when more is provided for less.

Less Is More Design.  Have you ever thought about what holds up an arch?  You really can think of an arch as something that is held up because it is falling down on itself.  Look at the following image.

 

 

Think about what holds up the arch.  Without being at all precise, it really is the pressure, based on gravity, of each brick onto its contiguous bricks.  If it wasn't adequately balanced it would collapse.

Arches can be used to build bridges so that things can flow under them in one direction and over them in other directions.  This has been done for centuries as illustrated in this following image of the Pont du Gard.

 

 

Looks precarious to me, but it has stood through some tests of time.

So something larger, more intricate and even more useful is built off of this much simpler arch.

But in the middle ages in Europe, people wanted enclosed expanses for their cathedrals.  Stories of their collapses during the building process are quite widespread.

But think of trying to build arches supported only by walls.  What keeps the walls from buckling outwards as illustrated in the following diagram?  All of our arches so far were filled in some way from the sides.

 

 

Think about being inside a long open cathedral and the weight of the roof causing the walls to buckle outward.  This gave rise to something called flying buttresses as illustrated in the following images of some European cathedrals.

 

Notre Dame de Paris St Vitus

 

Even the buttresses had buttresses!  I'll find better pictures eventually.

Is this a less is more approach to design?  No way!  Though it is probably not as bad as putting emission controls onto an existing automobile engine.  They suck the power, beauty and efficiency out of an already not particularly good design.

Well, anyway.  Since it was done centuries before and not in an approved region of the globe, the approach to developing the Hagia Sophia was probably not even considered.

 

 

Though it has been rebuilt and has been under the influence of people with particular religious motivations for some time.

In the Hagia Sophia, a dome was set on top of boxes.  The boxes were open to the interior to add to the open space.

 

 

Probably, one of the ultimate uses of an arch for enclosing and open space (I love these kinds of contradictions) was done for the University of Illinois' Assembly Hall.

 

 

I'm serious when I tell you that I almost went running out the first time I walked in.  I had no idea what was holding it up.  Everyone scoffed at my stupidity for actually observing for myself.  Later on I found out they had taken great care to have a concrete ring girder to make sure it didn't fall in on itself.  Yeah, like I should trust every architect and engineer that ever lived!

But do you appreciate the advantages and simplicity of the solution?

 

 

When Less is More in Computing.  Microsoft has definitely taught many academics that less is not more in many computing situations.  Think of your little bit of experience with text editors, command prompts and moving around a hard disk in this course.  It likely increases your appreciation for how Microsoft was able to make money both on DOS and then on Windows.

But it is still the case that less is more in many computing situations.  But what are they?

For things like actual computations and access to memory you always want to do this as efficiently as possible. 

The following list gives some basic principles that are likely to impact what is considered effective programming.

  • Algorithms should also be designed so that the number of computations and memory accesses are kept as small as reasonable.
  • The quantities of data transferred across networks should be kept smaller in order to ease congestion and improve security.
  • You would like data moving in packets across the Internet rather than having circuit-like connections that require a constant connection.
  • Programs need to be developed so that the ease of validation is improved.
  • Programs need to be developed so that the ease of debugging is improved.
  • Programs need to be developed so that future modifications are easier to implement.

So when it comes to developing user interfaces how less is more isn't very easily answered.  Though improving effectiveness is often going to be related to a lack of clutter and coherent layouts.

Brute Force Computing.  People that are at least somewhat familiar with computing often resort to strategies that could be easily characterized as brute force. 

Think of the one of the situations we have examined in this course where we found the sum of the first N positive integers.

1 + 2 + 3 + 4 + . . . + N

In typical computer fashion we developed a loop and found the sum.  You probably have forgotten, or never knew there is a closed form solution for this that is quite simple.

1 + 2 + 3 + 4 + . . . + N = N(N + 1)/2

If you knew this solution it would definitely simplify the computations.  Would you be willing to take the time to try and develop such a formula?  Should you?  Would you be willing to take the time to research whether someone else has determined such a formula?  Should you?  How much effort should you put into such endeavors?

This is actually not as bad as it often gets.  Brute force substitutes for more thorough thinking in almost all human endeavor.  It shouldn't be surprising that it can happen in computing also.

Other examples abound.