Vukoje's blog about software development

Thanks to Sorpex I had a great pleasure to visit this year TechEd held in Atlanta. I got a chance to attend many interesting talks and also meet the people from Microsoft that build the tools I have been using for years. In the focus of the conference were the Cloud, Windows Phone and Application Lifecycle Management.

Here are the most interesting sessions available online that I recommend:

As some of you might already know I will be speaking atSinergija10, Microsoft conference held 16-19 November 2010 in Belgrade, Serbia.

Last yearI held two presentations regarding Code Refactoring, Coding Standard and Code Review. This year my presentations will be about Unit Testing (both on Thursday 18.11.2010):

Unit Testing solid fundamentals

Why testing?

How to start?

What (not) to test?

Unit Testing phases

Test Driven Development (TDD)

Mocks / Stubs

Dependency Injection / Dependency Lookup

…

Advanced Unit Testing – real life examples and mistakes

Goals of test automation

Principles of Test Automation

Visual Studio Testing tips

Real life examples

Dangers of UT

…

I would also like to recommend another presentation held by my friend and personal JavaScript super heroAleksandar Mirilović fromDotExe led on Tuesday 16.11.2010. Aleksandar will be presenting DotExe Development Platform (DXD).

DXD is a framework for creating desktop-like web applications without knowing HTML, JavaScript or CSS based on MS ASP.NET 3.5 and Sencha ExtJS. Applications are built using DXD Designer, which is implemented as a Visual Studio Package and also as a "stand alone" application. DXD Designer enables ExtJS forms generation from the Windows Forms Designer which can be run in all leading browsers (Internet Explorer 6, Mozilla Firefox 3, Google Chrome 3, Safari, Opera ...).

The main advantage of this platform, compared to a conventional web application development, is that it allows huge savings in development time thanks to its complete automation of: a client-server communication, data synchronization and ExtJS forms generation, which allow writing complete rich web applications without a single line of JavaScript. You can see the demohere.

It started happening while I was still at college. We students have informally divided into two groups, us that were constantly digging for more knowledge and them that were telling us that we will just be stupid programmers. We wanted to be great at software development, but they said that we will be zombies staring at out monitors for the rest of our lives. They had different future in mind for them, where they would be very smart without any effort, work little and be very good paid for that. My favorite quote from them was "I won't be a programmer, I will be a consultant to other programmers" ... straight from collage. Imagine that!Or "I will stay at the collage and teach others on the advanced software development techniques"... techniques they have never experienced.

Think of some person you admire for what they have achieved in their profession. Do you think they earned your respect by being talented or with their passion and hard work? Do you think they were stupid to push so hard?

Albert Einstein was committed to his work but I never heard anybody says that he was staring at formulas for the whole day. Nobody complained that he was always lost in his taught or that his clothes were always wrinkled. And what about Jimmy Hendrix, when you think of him, do you think he was a freak locked up in a room all day long with his guitar? What about Michael Jordan, can you even imagine his commitment to basketball? Do you know he was rated as untalented player when he was in high school?

The reality check

The key point that I am trying to make here is that you can't be great at anything if you don't commit to it. There is a myth of talent and intelligence, saying that success only depends on it and that you either have it like gift from the God or not at all. From my personal experience and people around me I believe that talent and intelligence have nothing to do with success. Fortunately, research results confirm my thoughts:

"Research now shows that the lack of natural talent is irrelevant to great success. The secret? Painful and demanding practice and hard work. ... The critical reality is that we are not hostage to some naturally granted level of talent. We can make ourselves what we will. Strangely, that idea is not popular. People hate abandoning the notion that they would coast to fame and riches if they found their talent. But that view is tragically constraining, because when they hit life's inevitable bumps in the road, they conclude that they just aren't gifted and give up."

And for all of you dreaming of building a startup and getting rich, you should be prepared for hard work because according to Paul Graham, determination is the key factor for startup success.

"We learned quickly that the most important predictor of success is determination. At first we thought it might be intelligence. Everyone likes to believe that's what makes startups succeed. It makes a better story that a company won because its founders were so smart. The PR people and reporters who spread such stories probably believe them themselves. But while it certainly helps to be smart, it's not the deciding factor. There are plenty of people as smart as Bill Gates who achieve nothing.In most domains, talent is overrated compared to determination—partly because it makes a better story, partly because it gives onlookers an excuse for being lazy, and partly because after a while determination starts to look like talent."

"Deliberate practice is activity designed specifically to improve performance, often with a teacher’s help; it can be repeated a lot; feedback on results is continuously available; it’s highly demanding mentally, whether the activity is purely intellectual, such as chess or business-related activities, or heavily physical, such as sports; and it isn’t much fun.….most of us, as adults, are just doing what we’ve done before and hoping to maintain the level of performance that we probably reached long ago. Deliberate practice requires that one identify certain sharply defined elements of performance that need to be improved, and then work intently on them."

If you don't believe it, see Deliberate Practice in Software Development, excellent presentation that takes scientific data to show that in any work (sport, art, engineering…) there is no substitute for hard work and practice.

Einstein advices

So to get back to Einstein, he left us with his 10 universal principles that can be applied to any work where someone wants to achieve excellence. So here are some of the things one of the greatest scientists of all time had to say:

On Determination

“I have no special talent. I am only passionately curious.”“It's not that I'm so smart; it's just that I stay with problems longer.”

On Value

“Strive not to be a success, but rather to be of value."

On Experience

“Information is not knowledge. The only source of knowledge is experience.” “A person who never made a mistake never tried anything new.”

On Self-improvement

“Insanity: doing the same thing over and over again and expecting different results.” “You have to learn the rules of the game. And then you have to play better than anyone else.”

Conclusion

So the question is do you want to be excellent at your work and what are you doing about it? Are you better than others? Do you have skills that will bring value to your employers/clients? What are you currently trying to learn/improve?

In my previous blog post I have mentioned that most of our job candidates state in their CV-s that they work great under pressure. The thing is ... nobody works grate under pressure. The only difference between people is whether they break under pressure or not.

The pressure is something well known to probably every programmer, but hopefully it isn't present every day. When I say pressure, I don’t think of managers forcing programmers to code for long hours. I rather think about situations when you must finish something that you care about very much, but the situation makes it almost impossible. This is often the truth for developers because we:

have deadlines,

do complicated things that are error prone,

lack engineering practices and tend to throw the ones we got the first time we hit the wall

Because pressure is probably guaranteed thing, first thing we can do is become aware of it. I have met two kinds of pressure: negative and positive.

Negative pressure

This pressure emerges once you start to break your deadlines only to find out that your solution didn't satisfy customer requirements. The code is very bad, there are problems everywhere and everybody is pushing the problems under the rug because there is too much of them. Nobody can get anything done because of the piled up impediments and codebase that have become super complex and meaningless. Even when you get something done, you later find out that some existing functionality was broken by your changes. You wake up in the morning sick of thinking you are going to the same unsolvable problems again. At the end the tension between teammates becomes evident because someone must be quality for this state. Is it the programmers, the testers, the managers?

The only positive thing in this situation is that you will learn many things that you shouldn't do as a programmer because they will come back to bite you. Also you will have a scary story up your sleeve that can come in handy when you need to dramatize bad practices that could cause another project to get in this state. Until this state becomes just an anecdote, listen to Freddie Mercury's advice, it may help.

Positive pressure

Negative pressure is pretty obvious with its causes and side effects, but positive pressure is something much more subtle and hidden. It happens in opposite situations, when group of people has a big challenging goal ahead of them. This is never an easy task but everyone is doing the best they can. You could say that everyone is striving for perfection. Because perfection is impossible and mistakes are happening, the positive pressure emerges.

When people in these situations are really really dong the best they can, thinking of the challenging problems when they go home, trying to help everyone, they become very tired and sensitive. If they feel that their efforts are unappreciated they will be devastated. The more everyone is committed the more likely they will neglect this social component of successful projects.

As you can see, there is no real problem here, because this is only a slight problem in communication, but with possible serious outcomes. So if you identify positive pressure, talk about it with your collages and say how much you appreciate their work. Everyone will feel that they are fighting on the right side again and keep doing the best they can.

As you can guess I wasn't too happy about it because I had other important staff to do and I don't like judging people, especially not based on some resume. But still, this is a small effort compared to potential impact on our firm. Last thing you want to do is to misjudge people and spend few months getting them in the business to find out that it is not going to work out.

A: Incompetent programmers. There are estimates that the number of programmers needed in the U.S. exceeds 200,000. This is entirely misleading. It is not a quantity problem; we have a quality problem. One bad programmer can easily create two new jobs a year. Hiring more bad programmers will just increase our perceived need for them. If we had more good programmers, and could easily identify them, we would need fewer, not more.

CV content

The whole CV evaluation process would be much simpler if CV-s I have read were better written. When I open a CV I want to see candidate's:

Age

Picture

Education

Working history and experience

names of the companies and employment period

projects on which candidate has worked on, with short description of project domain, used technologies and candidate's role in project

I was horrified to find out that most of CV-s didn't include information about candidate age nor his/hers picture. You might argue that these are not relevant factors but I think they are, especially once you want to build picture about some person in few minutes.

Information about education was usually present but it was usually encrypted in English form so we were constantly guessing which colleague candidate meant.

On the other hand, working experience is the key information and it was almost always present in some form. If we had additional questions or misunderstandings regarding it we called candidates on the phone to ask them additional questions to get a clearer picture.

CV trash talk

With all this badly written CV-s and my other responsibilities, I was trying to make a person assessment keeping in mind that great engineers don't necessarily write great CV-s.

Above all listed problems one really annoyed me, the corporate trash talk. The worse the candidate was there was more trash talk. It turned out that every candidate:

is motivated to work in dynamic environment

is eager to learn new technologies and advance

works great under pressure

is a team player

has excellent communication and organizational skills

is self-motivated and self-organized

...

Disaster... I am not sure why is this corporate trash talk culture happening but it’s definitely out there. One thing is for sure, it is not the truth nor relevant and I don't want to read it.

The horrible truth

At some point I started to nag to my manager that I don't want to see any CV ever again. So she showed me the horrible truth... my own CV.

Oh my God! I haven't seen it for almost 3 years and it was horrible. No I'm not going to show it to you. I will just show you a small quote (trash) from it:

My Objective:

To use my IT knowledge, theoretical and practical software development and management skills in dynamical environment which will give me opportunity to advance in further professional carrier.

Lesson learned

Guess what I learned is that you can't really judge a person by his resume but at the end you have to. You must try to read between the lines (trash) and you must not hesitate to spend a lot of time on it because new employees can make a huge difference. You might be getting your new super-problem-solving-best-friend or your worst nightmare.

Missing data gathering also turned out to be useful. Few minutes of talk over the phone can make much difference in understanding some resume and making better and faster decisions. It would probably help if we created some CV template or little guide for writing it.

In the effort to follow my own CV advices I have updated my objectives.

Few days ago I saw same ordinary scene on street while going to work that got me thinking... about code off course :) Car driver was complaining to parking service employee about a parking ticket he has just received. He said that he was late for only 15 minutes (parking ticked is valid for 2 hours and drivers are notified with SMS 15 minutes before expiration). At the first moment I taught that 15 minutes isn't that much of a big deal, but then I started thinking what about 20 minutes? Still OK? And 30 minutes? Too much?

The real question is where to draw the line? Because we obviously can't do this, the right answer is that there should be no tolerance. OK maybe 60 seconds :)

You said something about code?

Unfortunate driver reminded me about a question I often encounter on my work. Is all code important? Should really all code follow best coding practices and coding standard?

Same day I heard that driver complaining, my collage and I asked ourselves if small repeated blocks of code in Unit Test Mock classes are really important?

If we assume that all code is not important (which will usually happened) you will be constantly wondering where to draw the line between important and not so important code? The answer is same as for parking time overdue, the line can't be drawn. You will end up with universal excuse for having sloppy code, although you have adopted best practices and maybe you even created a full coding standard.

But could we have saved time if we could draw the line?

I think not. If some code is less important, rarely used, and doing trivial staff, than it's usually easy to implement and hard to get it wrong. This means that code probably won't need any refactoring to enhance its design. I said at my previoustwo presentations, and I will say it again, I can write code by coding standard in same time as if I didn't code by standard. In fact I can maybe write good code even faster than bad code because I'm already constrained by the standard so I don't have to wonder or think about lowest level solutions (Event design, choosing between Class and Struct etc.).

I hope that this statement provokes you to show that I am no better than you because I know that everyone can write good code with just a little focus and discipline.

As programmers fight every day with deadline pressures to deliver meaningful software to customers on time, there is one code principle that can speed up and simplify their effort. This principle is called YAGNI, which is short for "You Aren't Going To Need It".

YAGNI is the principle in extreme programming stating that programmers should not add functionality until it is necessary, meaning that you should always implement things when you actually need them, and never when you just foresee that you need them.

The reason for enforcing this principle is that anticipation in software is very hard and usually leads codeoff track, while also spending valuable resource - time. Anticipation leads to half baked implementation that you maybe didn't need in the first place, and that implementation can turn out to be constraint on implementing some vital functionality that you really need. So what you have is lose-lose situation, you wasted your resources and made situation harder for yourself.

Often you will be building some class and you’ll hear yourself saying "We’re going to need...".Resist that impulse, every time. Always implement things when you actually need them, never when you just foresee that you need them.

The best way to implement code quickly is to implement less of it. The best way to have fewer bugs is to implement less code.

You’re not gonna need it!

The art of delaying

Any problem can be solved if you can delay it long enough, but of course you can't always delay things.

You must remember those situations where Microsoft or some other vendor solved all your problems shortly after you implemented your custom solution. These are really painful moments because usually vendor does it much better than you did and it usually comes free of charge.

Or maybe you remember those painful to implement tasks that altered your core architecture before you found out that they weren't really that important for business and that they will probably be thrown away?

Hart of the justification of YAGNI is that many of these potential needs end up not being needed, or at least not in the way you'd expect. By not doing them until they are really needed you'll save a good deal of effort.

YAGNI and The Big Design

As developers, I think we also tend to be far too optimistic in assessing the generality of our own solutions, and thus we end up building elaborate OOP frameworks around things that may not justify that level of complexity. To combat this urge, I suggest following the YAGNI doctrine. Build what you need as you need it, aggressively refactoring as you go along; don't spend a lot of time planning for grandiose, unknown future scenarios. Good software can evolve into what it will ultimately become.

To make design of your whole big project before you start coding it you need to know/assume most of the requirements. This is the only way you can plan application design that will last for next few years. Reason why YAGNI won't let you create big upfront designs is because they are almost always wrong. They are wrong simply because it is impossible to foresee all user requirements and think of all possible variations of Use Cases and potential design problems. Even if you could do all of this, requirements will change before you finish your project. What you should do instead is start from some basic design that will evolve to finally product. Basically you should design a minimum that works, without over engineered grand designs of feature.

What about prototypes?

YAGNI is in direct conflict with concept of software prototyping, but the difference is that when you build a prototype you know that you are doing it because you don't know the real requirements (you know that you don't know). This is also why you should throw away your prototypes, or at least evolve them to real code.

As I already announced, I have held two presentations at Sinergija 2009 in Belgrade. Presentations were on the same subject as my previoustwo presentations in .NET Belgrade user group, only this time they were more refined (I hope). I approximate that I had around 100 listeners at both presentations which is my new record

In every agile development early customer feedback is very important. Today I will talk about even earlier feedback… I mean feedback from your team members. This is earliest feedback you can get and maybe most important, because often this is only technical feedback you can have. If you are building some API or planning some architecture, than at that point other programmers are your customers as your API users.

The question is why is this feedback needed any way? Thes because variations, combination and potential code usage scenarios are uncountable. Ok, maybe they can be counted, but rest assure that when the time comes, you will not have them all in you head. One more thing we want to avoid with this is over-engineering.

So tell your ides to your teammates and ask them for opinion. If you do this, you will often hear the phrase "The problem with that is...". And there it is, one future gotcha you have just avoided.

In the past I was annoyed with this feedback that was constantly proving my "super" ideas wrong, but today I cherish them as a proven strength of positive critics. Always give, cherish and encourage positive critics in your team.

Another way to look at this early feedback is as early WTF?!. Instead of living some other developer thinking many WTF!? while trying to understand your code, you cam tell your ides and wait to here WTF!?.

Sanity Checks

Programmers, as pure technicians, tend to lose focus to business value and end goal of software they are building. Once they dive deep in to code they can forget customer needs, deadlines, weak plans, planned designs… heck we will forget our friends and families. You can say that, from business perspective, developer have gone mad and this is why regular sanity checks are very important.

This is exactly why in Scrum you need Scrum Master whose main role will be “sanity checker” (team conscience) who will be checkingdeveloper sanity on daily scrum meetings. On these meetings every developer answers 3 questions:

What have he done from last meeting?

What will he be doing until next meeting?

Does he have any problems with his work?

After everyone has answered these 3 questions, whole team should be informed about each other’s work but also it should be obvious if someone have gone insane. For example, developer could answer that he has not been doing what was planned and has started to build his own parsing tool in some experimental technology that will be supper cool.

After this madness is discovered, everything is easy. Scrum Master asks simple question: “Why?” and keeps repeating it until developer realizes his mistake. This is known as 5 Whys technique.

Do your team sanity checks and check yourself daily. Focused team, building minimum that customer required can do amazing things, so go and be amazing.