Thursday, December 11, 2014

Pragmatic "Software Craftsmanship"

Not all of us in IT are programmers, nor do all of us write code, but I believe the principles which are embodied by "Software Craftsmanship" may be applied to a larger audience in IT. 

I am aware that there is a manifesto called "Software Craftsmanship", and I will state for the record, that while I believe in the principles of that manifesto, I have not bought into it "as is", and I feel that certain phrases could be improved upon.

 Regardless, I do believe that technology work should be treated as a craft, and as we provide technological solutions and systems to our customers and clients, we need to keep in mind "well-crafted solutions".

 It has been commented that with "Software Craftsmanship" it is easy to devolve into egotistic "my way is better than yours" thinking. In order to counter that, the key point to remember is that our products and solutions are designed and crafted not for ourselves, but for our consumers, who will ultimately be the beneficiaries of our expertise.

I would recommend further reading and research into the subject by anyone interested. This will give a more complete picture of the concept and assist in forming a more pragmatic approach, unique to each practitioner, as our individual experiences and philosophies will undoubtedly be varied.



Thursday, October 9, 2014

Experience versus Inexperience in the software field.

What is the difference between true experience and inexperience in the software field?

As an Information Architect, I very often I see individuals proclaim about knowing their subject. But, how well do they know their craft or work? This is particularly evident in technology fields. Personally, I hold the opinion that just because someone can string some code together, does not mean that they qualify to be called experienced or knowledgeable about the software language.

Experience is not something which can be gleaned from a textbook or from simply attending courses, nor is it due to a accumulation of hours, days, or years spent in a particular field. Experience is something gained and cultured over significant exposure and deep involvement in an person's craft. Experience gives elegance, efficiency, and practicality.

To illustrate my point, let's look at a "gem" I found online. The code in question is regarding a query for object locks in Oracle. I would personally consider this code to be an example of something which an inexperienced practitioner would produce. Sadly, this is also typical of a lot of the "off-shored" and "outsourced" work that I have come across in my daily work, but that is a completely different topic for another day.



The first clue I see is the lack of formatting. I'm not talking about italics or bold formatting. I mean indented code formatting. Let's rearrange this to something more comprehensible. 

Ignoring the column formatting statements, I shall focus on the select statement itself. 


select 
    a.session_id
  , a.oracle_username
  , a.os_user_name
  , b.owner "OBJECT OWNER"
  , b.object_name
  , b.object_type
  , a.locked_mode 
from 
    ( select 
          object_id
        , SESSION_ID
        , ORACLE_USERNAME
        , OS_USER_NAME
        , LOCKED_MODE 
      from 
          v$locked_object
    ) a
  , ( select 
          object_id
        , owner
        , object_name
        , object_type 
      from 
          dba_objects
    ) b
where 
    a.object_id=b.object_id


There are many conventions for code indentation, I have a personal preference for a specific style, others may have different preferences. It doesn't matter, as long as the code is logically arranged, indented and most importantly is easily comprehensible.

Once arranged this way, several other clues showing that this is inexperienced code begins to be very apparent. I'll address the most serious shortcoming first, and that would be the needless and redundant  sub-selects.  This entire query can be coded in a much more efficient and simpler fashion.


select 
    a.session_id
  , a.oracle_username
  , a.os_user_name
  , b.owner "OBJECT OWNER"
  , b.object_name
  , b.object_type
  , a.locked_mode 
from 
    v$locked_object a
  , dba_objects b
where 
    a.object_id=b.object_id
;

The sub-selects were inefficient and needlessly complicated for the query engine. Nothing in those sub-selects contributed any significance to the main query. Personally, I would also even go so far as to remove the redundant "OBJECT OWNER", as I feel that it doesn't add any significant value at all. But, it could be argued that it adds clarity. It is subjective and really a very minor thing, and I'm willing to accept that.

So, what is the difference between experienced and in-experienced. Personally, I feel that the word "experience" has been misused, especially in recent history. 

If a job candidate had produced the query in the screenshot and claimed that they have been in this field for over 10 years and are very experienced. I would right away suspect something is not quite right. They may have been doing the same thing for over 10 years, but they have learnt nothing but the simplest actions, and do not possess true experience.

With the right attention, it is easy to identify experienced work from inexperienced work. I would personally love to see interviewers of information and technical positions ask for a sample of a candidate's work, produced on the spot and not prepared before-hand. It doesn't have to be a complex request, just something simple that would demonstrate experience. For example, how would they call a certain sub-routine or function.  Are they aware of commonly provided code libraries and thus call them with one statement, instead of coding that same functionality from scratch?

Finally, I would like to encourage every coder and information professional to humble ourselves, have an open mind, and continually strive to perfect their craft. Understanding that true perfection may never be achieved, but appreciating that the journey there will undoubtedly gain us invaluable experience and insight into our craft, whatever it might be, whether it be java, PL/SQL, T-SQL, PHP, Ruby, C++, C#, etc.