29 August 2009

Beck: Thought on Design Cost

"Design isn't free. ... When you put more design in today, you increase the overhead of the system. There is more to test, more to understand, more to explain. So everyday ... you pay a little design tax."
- Kent Beck's Extreme Programming Explained.

With more experience this is becoming truer and truer. As the design gets more general and seems to be preparing for potential future needs then there is more to test, understand, and explain. And yes it is that simple. That is not even counting the cost of the thought and white board time ( meaning less coding time ) going into the extra design.

Is it often worth the cost?

I am beginning to think not necessarily. Maybe the YAGNI question needs to be applied more thoughtfully to design and design decisions.

Scott Meyers: Good Library Design

Some principles that make for better libraries:
  • Make classes and functions easy to use correctly, hard to use incorrectly.
  • Obey the principle of least astonishment.
  • Avoid gratuitous incompatibilities with the built-in types.
  • Use const whenever possible
  • Avoid duplicating code.
Scott commented that the first principle listed is a "Hallmark of a professionally designed library."

And the for the third principle listed, "When in doubt, do as the ints do."


This is from material and notes taken at the 2002 C++ Seminar in Boston during the session about Library Design and the C++ Standard Library by Scott Meyers.

These still seem like sensible principles to keep in mind as one develops code.

04 August 2009

VAX/VMS

Recently, I found another blast from my past. I used this VAX/VMS book to write many of my DEC Command Language (DCL) scripts back while at Texas Tech in the late 80's and early 90's. I really enjoyed VMS and DCL. Tech, like many universities back then, had DEC systems for mainframes and even the physics department had a MicroVax.




I liked DCL over Unix script languages since DCL used command and keywords that made sense. Unix which uses "grep" for a search command whereas DCL used "search." Tell me which one is intuitive to remember? Of course grep is probably more powerful.




Recently I was lamenting about the VAX/VMS and found out that the cancelled F-22 fighter used the VAX/VMS OS! This was pleasant surprise. Cool.

14 July 2009

IBM: Assembly Language Programming

WARNING: If you easily get distracted and go off on tangents then this blog post is not for you. Please browse to another place on the internet and be content.


While visiting my Mom this last week I found one of my Dad's IBM Assembly Language books upon the bookshelf and decided to bring it home for safe keeping and to explore it a bit.

Assembly Language Programming for the IBM Systems 360 and 370 for OS and DOS copyrighted circa 1980 by Michael Kudlick.



An example page of part of a binary search in assembly.











Though exposed to assembler in a C.S. class and in an electronic instrumentation class, I seldom think about it anymore. Seeing this book got me to wondering about GNU Assembler. A slightly different looking assembly than IBM's but still interesting. I wonder where this all will end up ...... hmmm. ;)

You were warned, remember?

02 July 2009

Where It All Began

My father was a computer programmer from the early 1960's until the early 1990's when he retired while in his early fifties. His journey began by learning to wire boards for an accountant after he got out of college in 1962. This skill landed him a job teaching high school data processing (or programming.) Then a year later he landed a job with General Telephone (GTE) as a beginning programmer and did that until retirement. His only programming classes were several weeks of training in the Dallas-Fort Worth area then the rest was on the job training.

Interestingly enough the replacement teacher, when Dad left the high school, ended up still being the programming teacher at the high school by the time that my sister and myself got there in the late 1970's and both of us took that class.

Other than what little (punch cards and COBOL) my Dad tried to show me about programming up until high school, this class was the first time I had a programming class. We learned BASIC on a Radio Shack TRS-80 (aka Trash-80), RPG, COBOL, and FORTRAN from a terminal connected to a state computer. I forget whether I was a sophomore or a junior when I started the class (either in 1979 or 1980.) We started off learning BASIC and then moved onto other languages of our choice from the list above. I only tried RPG and COBOL. Luckily I did not have to learn FORTRAN for a few more years and luckily stopped using it in around 1997. Interestingly, COBOL was a much more a Literate-like language which Knuth has promoted.

Our instructor made us use this form (on the left) to write out our algorithm. At the time on the TRS-80 you could type in your code and get it running. Then you either printed it out on a narrow ribbon paper or if you had a cassette tape you could save it to cassette. Then you had to type NEW to delete it from the TRS-80 and you were ready to type in another program. I would print the working code out on the ribbon paper and tape or glue it to the work sheet as seen to the left. This is the first BASIC code I wrote.



Here is a example of the ribbon print out. This was just about the longest program we wrote during the class. Most of the program exercises were simple and small. All very sequential in nature.









Looking through my notebook from this class I found an interesting exercise. It appears that the instructor wanted us to write a program to plot a sine curve and to calculate the area under the curve. What I find so interesting is the fact that at the time I had no idea what a sine function was or even the concept of the area under a curve. A few others in the class may have had a clue but not myself. Somehow I got through this class doing somethings I did not learn for another four or five years while I was in college trying to catch up to start taking some physics classes. I did not take trigonometry or calculus until several years (~1985) into college.


If you look closely enough you can see that I defined Pi as TT instead of PI. That was how naive I was in math....really.


Also note the TRS-80 is an interesting story in itself.

Now nearly thirty years later I am still at it but doing it for physics but this was where it all began.