Archive

Archive for the ‘TDD’ Category

Whitespace is a code smell

March 23, 2007 11 comments

Do you space out your code so there are line breaks between the pieces of logic? Whydo you think this isnecessary? Typically this is done to separate chunks of logic so that they can be easily distinguished. If it is a complicated enough chunk, then it may even make sense to put a comment at the top of the chunk. At this point, the Agile police will jump on you and tell you to turn your comment intoa method name and perform an Extract Method refactoring. This is great practice (fellow Agile police member here!) and it makes a lot of sense since it abstracts the concept and makes the code more self describing.

But let's thinkback to those line breaks again … if it needed the line breaks, then there is code smell. If your code needs whitespace in the method to make it cleaner to read then it is probably doing too much. Of course, this is very subjective and easy to argue (heck – our team can't fully agree on this either!) but think carefully the next time you find yourself adding extra whitespace to your code and think:

  • Is this code as simple as it should be?
  • Does this logic all belong here or could it be broken out into other methods/classes?

Jonathan Cogley is the CEO and founder of Thycotic Software, a .NET consulting company and ISV in Washington DC. Our product, Secret Server is an enterprise password management system for teams to secure their passwords. Where do you keep your passwords or do you use the samepassword everywhere?

Pair Programming improves your communication skills

March 20, 2007 4 comments

Many developers in our industry prefer a dark corner to the presentation podium. This is often explained away with references to introverted personalities and geekish tendencies. While this may be true for certain individuals, there are definitely many benefits to breaking away from this stereotype. One of the best ways to progress in the business world is to develop strong communication skills – customerswant to be understood and the combination with technical ability provides a powerful skillset when understanding problems and providing solutions. As with so many things in life,excellence in communication can be achieved through lots of practice.

Pair Programmingis the process where two developers work together on the same code with one person typing and both constantly discussing the requirements, design and code. Pair Programming alsoprovides an excellent opportunity to hone your communication skills. To be “in the zone” when pair programming requires that you continually verbalize your ideas in a way that your pair partner can follow your thinking and stay engaged.

This sounds easy, but to do it effectively requires:

  • Verbalizing raw ideas as they come into your head in a way that your pair can follow
  • Asking questions when you don’t understand
  • Focusing on someone elses way of thinking to stay engaged in their thought process
  • Moving in a methodical way so that your pair can keep up
  • Compromising on an approach to a solution and agreeing together on the next steps to take

Any periods of silence when pairing can often indicate a problem:

  • The pair is stuck and doesn’t know how to proceed
  • One or both members of the pair are distracted and are no longer engaged
  • One member of the pair is driving while the other has lost interest
  • One member of the pair is proceeding without explaining their actions to their partner (and that partner has given up asking questions)

As you can see it requires a lot of effort and mostly soft skills to bring out the best in your own technical thinking and that of your pair partner.

We value communication so highly that we practice Pair Programming wherever possible on our development team. We also encourage our team members topresent at development team meetings, user groups and code camps to further improve their communication skills. This is good for our team in that our productivity is enhanced through all the apprenticeship/cross-training and our verbal/soft-skills are enhanced daily through all the practice.

Come along to the upcoming Code Camps in the Mid-Atlantic area to see several of the Thycotic team members present and many other great speakers too.

Jonathan Cogley is the CEO and founder of Thycotic Software, a .NET consulting company and ISV in Washington DC. Our product,Secret Server, is a secure web-based solution for teams to secure their passwords. Where do you keep your passwords or do you use the samepassword everywhere?

Writing "good" code: How do you understand code?

March 19, 2007 2 comments

John Morales has a great post on understanding complexity and how to think about difficult concepts.

I think John hits on a key concept in the idea of “good code” while I realize it wasn’t the main focus ofhis post: good code is simple for everyone (the team in question) to understand. I think this falls in nicely with our typical #1 goal on projects – writing maintainable code.

I always smile when I hear the saying “if it is was hard to write, it should be hard to read” and nothing could be further from the truth.

Remember the three purposes of code according to Bob Martin:

  • Perform the job (in other words, actually work)
  • Be maintainable
  • Clearly communicate its intent

Communicating clearly typically means simplicityfor the intended audience.

In many ways, writing good code is like teaching. A good teacher will keep the message clear and simple and appropriate for their audience. In tackling a difficult programming task – our job is to bring the right metaphors for the system and team, then present it in a clear manner that we will easily understand in 6 months and the most junior person on the team could maintain (sometimes a tall order but who said things were easy) and therein lies OUR challenge.

Nicepost John! 🙂

Jonathan Cogley is the CEO and founder of Thycotic Software, a .NET consulting company and ISV in Washington DC. Our product,Secret Server, is a secure web-based solution for teams to secure their passwords. Where do you keep your passwords or do you use the same one everywhere (snicker)?

Code Review – Standing on the shoulders of smart people

March 19, 2007 4 comments

A veryintelligent person once said:
“If I have seen further it is by standing onthe shoulders of Giants.”
The person in question, is of course none other than Sir Isaac Newton. He was able to go further with his discoveries because others had solved some of the details already and provided a layer of abstraction for him to improve upon.

When doing a code review,I often encounter a little defensiveness. Since we practice pair programming almost exclusively, this code review usually happens when reviewing code (as a pair) to make a change for a new feature or bug fix. Often the code was not written by the pair reviewing it so it becomes easy to get offensive instead of defensive.Either way, thisworks against the purpose of the code review and can be solved by thinking aboutthe code reviewin a different way…

The pair (or person) who wrote the original code was dealing with different complexities and challenges – they solved these problems with the code in question. Our job when reviewing is not to solve these same challenges but rather to look at *theirsolution* and decide how it could be improved. In this light, it is very unfair to compare our improved solution with theirs since we had a very different task. This is a subtle but very important distinction. Remember this when doing code reviews and it should help you to move beyond the personalities and egos involved (well, maybe :)).

How do *you* solve the human challenges of a code review?

Jonathan Cogley is the CEO and founder of Thycotic Software, a .NET consulting company and ISV in Washington DC. Our product,Secret Server, is a secure web-based solution for teams to secure their passwords. Where do you keep your passwords or do you use the same one everywhere (snicker)?

Yet Another Mid-Atlantic Code Camp – but AGILE!!! (April 14, 2007 8am-6pm)

February 26, 2007 1 comment

Do you breathe agile? Do your progress bars always turn green? Do you refactor in your sleep? Then I need you for the agile track … We are looking for attendees, speakers and volunteers! This is the first Mid-Atlantic Code Camp to have an official Agile track (and I am the track chair – woohoo!)

Attendees
Register here, now, just do it.

Speakers
What are you waiting for? Fill in this form and upload it here.

Volunteers
Send an email to volunteers at novacodecamp dot org

The official website for the Code Camp is here.

I have attended all of the previous Code Camps at Reston and they have been very worthwhile and havedrawncrowds of people and lots of cool prizes.

Jonathan Cogley is the CEO and founder of Thycotic Software, a .NET consulting company and ISV in Washington DC. Our product,Secret Server, is a secure web-based solution for teams to secure their passwords. Where do you keep your passwords or do you use the same one everywhere (snicker)?

Will TDD become mainstream?

February 25, 2007 3 comments

I have been asked a number of times in the last few years if I think TDD (Test Driven Development) will go mainstream. Firstly, we need to agree on what mainstream is – Wikipedia does not give any hard numbers (http://en.wikipedia.org/wiki/Mainstream) but it seems like 20% would be a good number for software development (I pulled this out of thin area – please share your thoughts). For TDD to have that much mindshare (in the stubborn software development world) would firmly seat TDD as an established and accepted way of developing code. So how much mindshare does it have now? Again I don’t know how you would get a measure (Gartner studies maybe?) but my experiences with software development in the Washington DC Metro area makes me think it is far less than 20%.

Will this change – will it gain wider support? I don’t think so for the following reasons:

  • TDD takes discipline – many developers don’t have discipline when coding.
  • TDD requires “buy in” at all levels within an organization.
  • TDD takes time to learn the practice effectively – this is difficult given the deadlines most teams face.
  • TDD works well with Pair Programming which tends to be too contentious to get by most management teams.
  • It is difficult to produce hard evidence for TDDs benefits since software is abstract and hard to compare across projects (and seldom would you build the same software twice just to compare techniques). This evidence will be necessary to persuade many decision makers.

Please don’t think that I am bashing TDD or Pair Programming – we use both everyday and believe in their enormous value! I am happy that TDD is not mainstream since this gives a great competitive edge over other software development teams.

If you are looking for a position with a company that believes in and practicesTDD and Pair Programming, we are hiring.

Jonathan Cogley is the CEO and founder of Thycotic Software, a .NET consulting company and ISV in Washington DC. Thycotic Secret Server is a secure web-based solution to both “Where is the password for this router?” and “Who has the password for our domain hosting?”. Secret Server isthe leader in secret management and sharing within companies and teams.

Speaking on TDD at the CMAP Architect Group in Maryland tonight (2/20/2007)

February 20, 2007 Leave a comment

I will be presenting on Test Driven Development at the CMAP Architect Group in Maryland. Session details and directions here.

Abstract: TDD is hard. It is hard because we have to unlearn the way many of us have always coded. Instead we have to start writing unit tests and what is more; we have to write the test BEFORE the code. Come along to learn the history, theory and then participate in an onscreen coding session TDD-style. There will be lots of opportunity to ask questions and see if TDD is for you.

If you are looking for a position with a company that believes in and practicesTDD and Pair Programming, then don’t forget that we are hiring.

See you tonight!

We will also be giving away two free 10 user licenses to Secret Server ($389 each!) at the meeting.

Jonathan Cogley isthe CEO and founder of Thycotic Software, a .NET consulting company and ISV in Washington DC. Thycotic Secret Server is a secure web-based solution to both “Where is the password for this router?” and “Who has the password for our domain hosting?”. Secret Server isthe leader in secret management and sharing within companies and teams.