Ben J. Christensen

Software Development and Other Random Stuff

Initial Impressions on Ruby Performance

I’ve spent the past day playing with Ruby and decided to test some basic performance – iterating and string parsing – to get an idea of what the performance is really like.

Ruby is not doing so well in my tests.

Note to Ruby Experts: If anyone can demonstrate what I’m doing wrong in my code or testing, I would love to be corrected.

My approach was to write the exact same code in Java and Ruby that loads up a file, reads each lines, tokenizes it into words using whitespace as the delimiter and counts up the tokens.

This avoids network or database IO and other external resources – except the filesystem which I don’t consider a significant variable in the test.

Further testing I’m planning on doing will test Rails, multi-threading and other common things I do in my apps.

Picture 3

On my laptop, a MacBook Pro 2.53Ghz Core 2 Duo with 4GB memory, the average times are:

  • Ruby 1.8.6 app: 8022ms
  • Java 5 app: 2986ms
  • Java 6 app: 1443ms

Source Code

After downloading, strip the .doc ending off of the files.

Program Output

macbook-pro:src benjc$ /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java FileReadParse
Starting to read file…
The number of tokens is: 7764115
It took 1502 ms
macbook-pro:performance benjc$ ruby file_read_parse.rb
Starting to read file …
The number of tokens is: 7764115
It took 7999.955 ms

macbook-pro:src benjc$ /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java FileReadParse

Starting to read file…

The number of tokens is: 7764115

It took 1502 ms

macbook-pro:performance benjc$ ruby file_read_parse.rb

Starting to read file …

The number of tokens is: 7764115

It took 7999.955 ms


Filed under: Code, Performance

Software Development Is Not Engineering

I have long considered it a fallacy to call software development “engineering”. Even though the term technically works for software as “the science, discipline, art and profession of acquiring and applying technical, scientific and mathematical knowledge to design and implement structures, machines, devices, systems, and processes that safely realize a desired objective or inventions” (see Wikipedia), this is not how the term ends up being interpreted and therefore misrepresents how software development actually occurs – since engineering has become synonymous with building physical structures such as buildings, bridges, roads. Recently someone with authority on the subject expressed this opinion much better than I could have, and since he has authority on the subject and in the industry, it means something.

According to Wikipedia, “Tom DeMarco has authored over nine books and 100 papers on project management and software development” and has been intimately involved over the past 40 years in the software industry and the establishment of “structured analysis”, software project management concepts and legendary software development projects such as the first large scale telephone exchange for Bell.

He recently wrote an article titled “Software Engineering:  An Idea Whose Time Has Come and Gone?

The article is well written and there is no value in me repeating it verbatim, so read the original.

The following quotes however are worth me repeating along with my commentary:

Software development is inherently different from a natural science such as physics and its metrics are accordingly much less precise.”

Software development is not like building a bridge – where the materials, laws of physics and chemistry, labor times etc have all been experienced and practiced thousands of times, can be accurately predicted and correctly planned for, then managed.

Software development is and always will be somewhat experimental. The actual software construction isn’t necessarily experimental, but its conception is. And this is where our focus ought to be. It’s where our focus always ought to have been.”

If we are writing software, it’s because we’re trying to do something that hasn’t been done before or is different in some way from what already exists, otherwise we’ll purchase the existing software. We are building a solution to a problem – to create value of some kind.

If we’re doing something that hasn’t been done before – either with new technologies, new rules, new performance criteria or whatever it is that makes it unique – then we are doing “research and development” – experimentation. It is not as if a blueprint for a house is given and the construction team comes in to build it as they’ve done 1000 other houses in the same community. Software “architecture” doesn’t work that way. There is never a replicate – because it’s not physical.

Yet business and project management would love it to be – it makes it easier to control, schedule and most critically, budget for.

Tom DeMarco discusses “metrics” in the most detail in the article, about why we spend so much time trying to control software development projects, and particularly the timeline/cost aspect.

He says:

For the past 40 years, for example, we’ve tortured ourselves over our inability to finish a software project on time and on budget. But as I hinted earlier, this never should have been the supreme goal. The more important goal is transformation, creating software that changes the world or that transforms a company or how it does business.”

After giving an example of two projects, one creating little value and one creating significant value he states:

“This leads us to the odd conclusion that strict control is something that matters a lot on relatively useless projects and much less on useful projects. It suggests that the more you focus on control, the more likely you’re working on a project that’s striving to deliver something of relatively minor value.

Ironically, I’ve generally seen the opposite perspective from business – that the “expensive” projects, the ones typically capable of creating the most value, are the ones where the most control of timeline and cost is desired and therefore the most damage done by “management” as opposed to allowing the necessary experimentation, design, thought, research and development to occur to create the most value out of the software.

Being criticized of being “unable to delivery on time” in software development is not something I can really take personally – when the industry at large struggles so significantly with this, largely because it has tried so desperately to liken software development to a public works engineering project such as building a bridge, a building or a road.

Software development is more like art than most seem willing to accept.

It is driven by creativity, experimentation, research, design and artistic drive.

Is it any wonder that the “transformative” software projects most often come from startups (Apple apparently being the exception with their iPhone OS and demonstrating the amazing culture of design they allow to flourish) and then as they mature become stagnant once quarterly reports drive business as opposed to the development of a product? Or that opensource, where timelines mean nothing, can build great software such as Linux, Firefox and MySQL? Look at what has happened to MySQL over the past 2 years as business “management” has replaced “experimentation” and focus on quality — the key people who built MySQL over the years have left to work on something where strict control is not the focus.

As Tom DeMarco suggests, I hope to be focusing on development where the value is worth allowing the proper time, people, experimentation and development to occur – so that something of true value can be created. If management of “costs” is the most important aspect of the project, the greatest value to be created, I don’t even want to bother. I’d rather work on a project that has the ability to be transformative, and create greater value than the cost of the effort.

software engineering:
An Idea Whose Time Has Come and

Filed under: Management & Leadership

Apprenticing to Learn Software Development

The foundation of my software development skills was set between 1995 and 1998 while I worked under the direction of my friend and mentor Andre Kruger. For a long time I called it “job shadowing”, but I have come to realize that it was an informal apprenticeship.

I have found those 3 years taught me more about software, system administration and technology than most get the opportunity to experience that early in their career – as I was learning and working on the job, tutored by someone who was incredibly intelligent and had years of knowledge and experience to share. He also provide me with invaluable insights and suggestions on what technologies and platforms to follow. It was he who suggested Java (when it was at version 1.0) was what I should focus on, not C – and that has served me well to this day – when the schools were telling me to learn Pascal.

I loved it and sucked up as much as I could learn. I also built software that did real things. Now I recognize how poor the code was – it was very bad. The point was that I was learning through doing real things in an environment where I couldn’t do significant damage and could receive instruction and guidance – and eventually as I progressed I could truly understand the benefits of design patterns, object oriented design and what it meant to be “in production”. It wasn’t theoretical – or some forcefully memorized and quickly forgotten trivia – I knew it.

I didn’t complete college/university – because by the time I got there it bored me to tears, as I had spent several years being apprenticed already and learned quickly on my own through books and experimentation. If I could have, I would have skipped to 3rd year and enjoyed myself, but our society and academic programs don’t work that way.

I believe apprenticeships are the ideal way to learn software development, as I see software as a craft – not an engineering or scientific skill where rules are learned and applied the same way every time.

I wish our society and industry would look seriously at its academic and theoretical approach to training – which I feel does not work very well – and consider a model more similar to apprenticeship.

I also really enjoy mentoring others who have raw talent and desire. Some of my most rewarding work of the past 5 years has been that which has resulted in colleagues progressing and growing, such as a good friend of mine Adnan Memon.

Perhaps I’ve accomplished the “master” status in certain aspects of my work, in others I’m still a “journeyman” I’m sure. I hope to find others who can continue to mentor me as I try do so for my juniors, as I think that’s where the best talent in our industry comes from.

Filed under: Skills

Learning by Pair Programming

Last week I learned how to program on the iPhone using Objective-C and Cocoa Touch by having two 2-hour pair programming sessions with Brent Coursey and about 8 hours of my own playing around.

I am comfortable now with XCode, Interface Building and Objective-C – enough that I can build code to do what I want it to do, compile, run, debug, test and install on my personal iPhone.

I’ve connected to web services via Objective-C and built a user interface to interact with the services.

All in all it was a good experience and great way to learn – and the pair programming was very useful in speeding up the learning process. Unlike 10 years ago where I plenty of time to learn through trial and error, it was much more effective to sit and watch someone and see how everything worked together. I was able to pick it up very quickly that way.

Of course, 10+ years of object oriented programming in Java translates over well to the thinking and expectations – but the syntax and different ways of doing things were far from natural for a java programmer (especially one who had respectfully ignored the C way of doing things), so the demonstration received through pairing was immediately beneficial. (On second thought, ignoring C probably helped since I saw Objective-C as an OO language from the start – not as C)

A 2 hour session with Kent Beck sold on EBay for $405. That would be quite the experience – would love to do that and see how he or someone else at his level does their craft.

Filed under: Skills

Software Development is Not “Computer Science”

These guys are “computer scientists”.

Being a programmer, developer, architect etc does not in my opinion constitute being a “computer scientist” or working in “computer science”.

Perhaps the most general definition of science can be used for “developers” if we stretch:

- a branch of knowledge or study dealing with a body of facts or truths systematically arranged and showing the operation of general laws: the mathematical sciences.

But that doesn’t describe the whole of it like these definitions do:

- systematic knowledge of the physical or material world gained through observation and experimentation.

- knowledge, as of facts or principles; knowledge gained by systematic study.

As programmers we don’t do this – we use technology (the “applied science”) to build things and solve problems.

We may sometimes pretend to venture into “science” as we “research solutions” – but we’re just looking for knowledge and facts the “scientists” have figured out and then applying them in unique and novel ways.

Calling a programmer a scientist is like calling an artist a chemist because they use chemical compounds (paint, graphite, clay, steel, glue whatever).

Why does this matter to me?

Because by training our programmers in theoretical “Computer Science” educational programs, we are not actually creating employable or productive people. Sure, they have basic skills and theory that can then be applied through further effort – but unless they are one of the rare few to study, analyze and experiment with computer science theory – most of the knowledge gained serves little to no value in applying the techology of software development in real-world programming of software.

Filed under: Skills

Detail Oriented

I’m working on a fairly significant document that covers the requirements and high-level architecture for a new system based on SOA principles to replace an aging application.

The document is approaching 150 pages and beginning to approach something that properly describes the vision and needs so that business and technical folks can have a solid understanding of scope, requirements, priorities and how it will work (plus general direction on how it will be built).

It takes a lot of effort and time to sit down and not only read, but understand the scope of this system. It’s not a simple thing. As much as we try to keep it conceptually simple, there’s a lot going on and a lot of details.

In a few weeks I’m to sit down with a partner team to review and collaborate. My plan was to send over the detailed document for review so we could have a productive meeting to truly discuss missing requirements, strategy, execution planning etc.

However, I’ve been told they don’t “want” to read the detailed version — just a summary — bullet points with perhaps 10-15 pages.

These are senior developers and architects. Not high level business folks.

Attention to detail is in my opinion an absolute requirement for technical people. Decision making without details is dangerous and fairly useless.

My opinion is not high for people who do not care or have the attention span to be detail oriented.

An executive who’s not directly involved in the operations of something – a summary makes sense.

A team or person who is supposed to directly impact the design and delivery of something and its ongoing operations – if the details aren’t part of their focus, they don’t deserve to be involved.

If they don’t have the time to be detail oriented, then either they shouldn’t be working on the project, their time needs to be re-prioritized, or the project isn’t worth doing.

Filed under: Architecture, Management & Leadership, Skills

Some Favorites

photo1234404346795

photo-1

Filed under: Personal

Skill and Trust in Business

Dictionary.com defines skill as:

  • the ability, coming from one’s knowledge, practice, aptitude, etc., to do something well
  • competent excellence in performance; expertness;

Trust is defined as:

  • reliance on the integrity, strength, ability, surety, etc., of a person or thing; confidence.

Two common themes are ability defined as:

  • competence in an activity or occupation because of one’s skill, training, or other qualification
  • power or capacity to do or act physically, mentally, legally, morally, financially, etc.

My experience unfortunately is that skill and ability in people are not abundant – and therefore it is hard to have trust.

More problems are caused by lack of skill than anything else I run into.

Making mistakes and learning from them is part of life – it’s the human experience.

However, there is a reason world class organizations have “senior” people  and restrict the impact of “junior” people’s mistakes by limiting what they are allowed to do and affect until they have gained trust – by demonstrating their ability and skill.

Trust nowadays is given away much too freely – desire, eagerness, willingness do not replace ability and skill.

Trust should not be given unless someone has earned it. People should not expect to be trusted until they’ve earned it by showing they deserve it.

I had someone tell me (after failing on something) that I should trust them more and give them “opportunity” so they could succeed (by giving them the ‘keys to the kingdom’). This is backwards. Prove to me on small things incrementally and trust will be earned and greater opportunities given.

Trust does not work like “innocent until proven guilty”. Trust must be earned. Trust stems from skill, honesty, aptitude, competence and most importantly – time.

If business operations are failing, my opinion is it’s generally due to placing trust and unfair expectations on people who do not have the skill or ability to deliver.

Put the money and time on having the right people – and restrict the impact of “junior” people – and operations will improve.

Filed under: Management & Leadership, Skills

Recruiting IT Talent

An interesting article by James McGovern on recruiting IT talent.

The gist of it is that it’s very difficult to rely upon resumes, and that we as an industry seem to put up with “falsification” of skills and keep people onboard who really don’t have the skills they need to do their job.

It closes with the following statement:

“World class organizations are built on foundations where people can trust each other and don’t have to second guess the ability of the team. If you find yourself in a shop that doesn’t get it and you stay, maybe you are getting exactly what you deserve… ” – James McGovern

Filed under: Management & Leadership

Summary of Bad Week for Datacenters

A summary of a bad week for Rackspace, Google and others:

http://www.datacenterknowledge.com/archives/2009/07/06/the-day-after-a-brutal-week-for-uptime/

Filed under: Production Problems

Twitter Updates

View Ben Christensen's profile on LinkedIn
Follow

Get every new post delivered to your Inbox.