Random Software Inklings http://random-software-inklings.posterous.com Most recent posts at Random Software Inklings posterous.com Sun, 19 Jun 2011 00:58:00 -0700 Minimum Rcov http://random-software-inklings.posterous.com/2011/06/minimum-rcov.html http://random-software-inklings.posterous.com/2011/06/minimum-rcov.html Uncle Bob, has stated that all code should be 100% covered, but 100% is an asymptote.  Therefore he expects something less then 100%.  This might be true in the Java, or C version of Rcov, but not for Ruby Rcov.  Also, I personally think that 100% is a bit low.

All 100% coverage means is that at least one test touches every line.  And in truly simple code that is usually enough.  But I work on systems, not simple code.  Rarely do I write single use code.  In most cases I write code that does one thing well, but is used by a lot of different part of the system.

Errors are very rarely in core modules, but rather in the runtime combination of core modules.  This is covered by integration testing which is not usually pulled into rcov.  I think this is a mistake.

The following is how I think about a minimum level of Rcov:

  1. Exclude libraries from rcov metrics. That is unless you decide to include their unit testing within your own.  Either way this will give you a more accurate reading of coverage.  Seeing rcov at 90%, but thinking it is 100% because rcov can't see libraries isn't a valid assumption, IMHO.
  2. Include integration testing in rcov.  Rcov has an option to aggregate several runs into a final number.  You should include both unit and integration testing in the final number.
  3. Expect greater then 100% coverage.  Actually, including edge cases, positive, and negative testing the number will be closer to 1000% percent covered.  You read that right, every line of code should be covered by at least 10 tests.
  4. Include the rcov threshold test in CI.  You should, before committing, always run all unit tests, integration tests, and rcov threshold.  At first set the threshold low (about 80%) and move it to 100% ASAP.  And by including threshold test in CI then the code can't go out the door without the correct amount of coverage.
  5. Review tests first and last.  If your teams doesn't already do code reviews, it should.  If it does then start with the tests and then review the code.  This lets you ensure the obvious edge cases are covered without being swayed by the code.  After reviewing the code re-review the tests to ensure there are no new edge cases need to be covered.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/cPumFsV6gthpw john Kamenik jkamenik john Kamenik
Tue, 07 Jun 2011 01:21:00 -0700 Ext4 Impressions http://random-software-inklings.posterous.com/2011/06/ext4-impressions.html http://random-software-inklings.posterous.com/2011/06/ext4-impressions.html I have been using Ext for years, starting with 2.0.  In most cases this is paired with Ruby on Rails on the server and has generally been nice.  There were some growing pains in understanding that Ext is not like jQuery.  It isn't meant to enhance the page it is meant to control it.  Once it is understood that ExtJS is an event driven UI layer much like MFC (Microsoft) then things are rather easy to grasp.

In fact, Ext (pre 4) is almost just like MFC in that it is primarily a collection of UI widgets that you can put together in any way you wish.  This is great for very small UIs that do not have a lot of interconnected parts, but once the number of interconnected item reaches more then a few (say 5 or 6) then it is nearly impossible to map all the emergent properties mentally.  Enter MVC.

MVC is a design patter created over 30 years ago, whose sole purpose is the separation of concerns.  Business logic (model) is separated from UI (view) and they communicate via a defined set of actions (controller).  Anyone familiar with UI programming should be familiar with this pattern.  It is used in almost all major UI libraries except ExtJS, until now.

Ext4 aims to fix this flaw by retooling the framework to be MVC.  It is almost successful.  There is a major problem in separating models from collections (which is understandable given Javascript's nature) but there are more elegant solutions then the one Ext4 uses (see SproutCore and Backbone).  There are far too many annoyances at the model level for me to detail here, but as an example the LocalStore and MemoryStore are broken as of this writing and cannot update or remove models since they do not fire events.  This problem can be seen is a number of their own grid demos.

I also tried to use the compatibility mode to convert an older Ext3 app to Ext4.  I was successful in removing all of the errors and most of the warning, but could not get the page to render.  Each component thought it was rendered, but no DOM was presented to the browser.  Lots of digging later and it turns out you can't mix MVC Ext4 objects with non-MVC Ext3 like objects.  Not sure why, and without errors it is hard to tell what went wrong.

Finally I started from scratch and created extjs4-frame so that I could dig in without having to worry about Ext3 compatibility screwing things up.  Thing did not go much better.  I watched the videos and then dove right in.  As expected what was shown on the videos (obviously dumbed down) worked as expected, but as I started to add complexity things would break in mysterious ways.  Turning to the documentation was only marginally helpful, since it appears that it has not been full updated.  Also, some of the documentation does not match the JDoc comments in the source (probably human error in generating the docs).  This is an annoyance to be sure, but not a show stopper since I know how to read Javascript (as anyone that would be using ExtJS should).  However, documentation error (especially when generated from embedded comments) are indicative of a lack of attention to detail and since they do not provide their unit tests I can only guess that their storage engines are not well tested either.

Pros

  • Documentation videos are a nice touch
  • Simplified code due to the MVC nature
  • Sensible file structure (forced)
  • Auto-loader (turn off in production, but great for development)
  • Better stack and error handling (as compared with Ext 2/3)
  • Trees use real models (meaning the server can respond with any hierarchical objects)
  • Non-flash based charts
  • Smaller size (as compared to Ext 2/3)
Cons
  • Difficult to understand (even for those with MVC and ExtJS experience)
  • No backwards compatibility (the compatibility mode is a joke)
  • 4.0.X versions are not guaranteed compatible (there are still a lot of internal changes going on)
  • Documentation does not always match source comments and is not always correct (save some time and just start with the code)
  • Inconsistant Model/Container behavior
  • No generator scripts provided for aiding design patterns
  • No unit testing framework provided
  • No JS compiler/minifier provided (one that can read the requires directive is almost a must now that they exist)
Overall
Wait for 4.1 to see if things stabilize.  Or switch to SproutCore.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/cPumFsV6gthpw john Kamenik jkamenik john Kamenik
Mon, 10 Jan 2011 14:19:00 -0800 Problems with Agile Implementation http://random-software-inklings.posterous.com/2011/01/problems-with-agile-implementation.html http://random-software-inklings.posterous.com/2011/01/problems-with-agile-implementation.html I really like agile programming.  It keeps me close to the action, and makes me have to think about my next moves.  It also keeps me informed as to what is going on around me.  But in my many years of using agile I realize that, though the process itself is very nice, its implementations can tend not to be.

Problem don't arise from agile itself, but who and how it was implemented.  If the implementer's goals do not match the Agile Manifesto there is little chance of success.  I have used scrum many times and the most common problems I see are:

  1. Agile as Micromanagement
  2. Agile as a Whip
  3. Agile as an Excuse
Agile as Micromanagement
It looks like:
  1. Having to break task down into hourly segments of work
  2. Having to break task that logically have to be done by a single person
  3. Having to account for ALL time taken, even time not related to code like attending meetings
Agile tenet misused:
  1. Individuals and interactions over process and tools
  2. Working software over comprehensive documentation

This happens when a manager (chicken role) is the Scrum Master or when the Product Owner has say over implementation specifics.  It is a confusion of roles, which in turn leads to a confusion of goals, which in turn leads to over documentation.

Agile as a Whip
It looks like:
  1. Filtering a burn-down on an individual basis
  2. Placing more in the sprint then can be done (but still requiring it all to be done)
  3. Associating points with people (publicly)
  4. Associating number of tasks done with effort
  5. Associating points with hours
  6. Basically anything where measured output is more important then people
Agile tenet misused:
  1. Individuals and interactions over process and tools

Anytime you associate numbers with people you have created a crab mentality.  Their focus will stop being on software, but on making their numbers better.  Those that are better at number games will succeed, those that are better at software will fail.

Anytime you put your people under undo pressure then simple mistakes are made.  This is going to later erode confidence in the team.  It is going to happen like this: "you missed a comma in a Javascript file which causes it not to work in IE.  That was such a simple mistake to have tested for that I am not sure you are testing any of your code."  The problem was caused by 4 hours of sleep in 72 hours of coding at the end of an over-extended sprint.  The programmer was nearly delirious.  It is shocking it was the only mistake, not that it was a simple mistake!

Unfortunately I have seen this situation start innocent enough, with comments like "we don't want to over work the staff" or "we want to make sure they always have something to do" or "we want them working on the correct things".  If the "we" in question is management (chicken role) then there is probably already micromanagement going on, and Agile is being used as whip to solve the problems created by the bad implementation.

Agile as an Excuse.
It looks like:
  1. "You said it would take XXX.  It took YYY.  You need to make up the difference out of your own time"
  2. "We cannot slip these date, and you have already pared back the release N sprints ago.  You need to put in extra effort"
  3. "Agile is about being agile.  Even though we are mid sprint we are radically changing direction, but we are not canceling the sprint or doing sprint planning.  We are just swapping out some tasks for others."
  4. "You picked the language.  It is now your problem to bring this project to conclusion and under budget."
Agile tenet misused:
  1. Individuals and interactions over process and tools
  2. Responding to change over following a plan

These are all excuses I have heard.  Each time given by a person in chicken role (managers) because they are ignoring changes in the field (military term).  Every choice has a set of outcomes: some good, some bad.  The attempt with agile is not to mitigate bad outcomes, but to allow those outcomes to contribute to the overall direction.

Sometimes the bad outcome will be that something took to long, or that one language/tool was not the correct choice given the problem set.  If for every problem that happens the developer has to take their own time, or face embarrassment, to solve the problem then they will stop making choices.  Not just choices that might have bad outcomes, but choices altogether.  At which point someone in a chicken role will start making more choices then they should.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/cPumFsV6gthpw john Kamenik jkamenik john Kamenik
Sun, 12 Dec 2010 18:15:00 -0800 Dealing with Email overload http://random-software-inklings.posterous.com/2010/12/dealing-with-email-overload.html http://random-software-inklings.posterous.com/2010/12/dealing-with-email-overload.html This isn't strictly software related, but a lot of us have to deal with the horror that is email.  Email is not a good solution to any problem, but it is ubiquitous so it is used for all things: personal correspondence, commit tracking, defect notification, task notification, etc...  Email is all to often used as a mechanism to pass-the-buck.

The only way to deal with this email overload is to set boundaries on email usage.  A lot of people will find these boundaries annoying, if not unworkable.  Just stick with it and lead by example.  Eventually, in a time of high stress, you will be able to get to important messages fast and they will be left floundering.

My results
I am putting the summary first in hopes that you might actually try some of these suggestions.  On average I get 50 to 200 work related emails a day.  In any given day (saturday and sunday included) I will need to respond to 5 to 10 of them.  That means that I get between 40 and 195 junk emails that pass (and should pass) my junk mail filters.

By focusing on making sure my inbox only includes import emails I have reduced my inbox to 3 to 5 message each check (and I check twice a day).  On busy days I only ever check my inbox, relying on others to contact me via a different medium if they really need me.  When there is a less busy day I go through the other inbox and deal with those messages.

At the time I am writing this (on sunday) I have 1 email in my inbox and 91 emails in my other inbox that were all sent saturday.  A quick read of the 1 email and I will have to spend 5 minutes reviewing code, but the rest can wait until monday.

Use the right messaging system
Use email for messages that do not need an immediate response.  Since there is no message size limit, make sure you use the most of it.  Write emails that are well detailed and specific.  If at any point a message can be answered with "Ok" or some other monosyllabic word then email was not the correct choice.

Use Instant Messages (IM,IRC,etc...) for conversations that need semi immediate responses, and a possible record.  Many IM packages can log conversations for later viewing, which is useful when you forget things.  There are message length and formatting restrictions so this forces the messages to be brief and specific.

Use Phone, Skype, or face to face contact when a response is needed immediately.

Use Twitter, or some other global message posting service to track commits, continuous integration fails, defects, etc...

Use a wiki, or blog to track generic instructions or documentation.

Check email twice a day (only)
The easiest way to train people not to use email as a crutch is not use it as one yourself.  Only check email twice a day, and give a concerted effort to reduce that to once a day within a month, and once a week within 6 months.  Setup the other messaging systems so that email is used only for what it needs to be.  And when people step out of line, correct them.

Email should not be the first thing that you check in the morning, as you should not be working out of email.  It should also not be the last thing you check as it will disrupt your already stressful commute/home life.  Instead check email 2 hours after the start of the day, and 2 hours before the end of the day.  If you work a 9-to-5 that means once at 11am and once at 3pm.

The day you start doing this, tell the people that send you the most email and the ones that you will most affect by the change, and no one else.  You are not trying to be sneaky, but if you blast an email to everyone then you are going to make it a big deal; which it is not.  The others will learn over time.

When someone tells you that you need to check your email and read their message do it, but only check their email, ignore all other messages.

Don't use Inbox as an archive
Once you are finished reading an email, either deal with the email and delete it or archive it.  Create a separate archive folder and move emails there if you need to save them.  Your goal is aways to reduce the inbox to zero

Create an other inbox
Create a filter that will dump any messages where you are not the direct recipient into a different folder.  This should be the first filter you create, but the last filter that is applied to any message.  Create as many other filters and folders as you can to move useless messages round.  The goal is to remove any message that you do not need to act on so that what is left is just what is important.  The trash can is a good folder to dump things that are truly useless.

Use the server's filtering mechanism
When possible have server do all the filtering that way you can use multiple email clients and will not be dependent on leaving an email client on.  All Exchange servers and many online email services can do server filtering.  When using Outlook, be careful, the ease of creating filters is sometimes offset by the fact that it lies about what filters can be saved to the server.  Though harder, since MS didn't spend much time on the server-side features of Exchange, it is better to build the filters on the server directly.

Reduce the inbox to zero (in one sitting)
The goal is always to reduce your inbox to zero.  Once all the filters are in place, the only thing left to actually deal with all the important emails (at least that is the hope).  When dealing with email decide if the email should be dealt with, deferred, or archived.

If time is really an issue then find the messages to archive and defer first, and move them.  That way what is left is just the stuff to deal with now.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/cPumFsV6gthpw john Kamenik jkamenik john Kamenik
Mon, 06 Dec 2010 04:00:00 -0800 How to be a bad boss http://random-software-inklings.posterous.com/2010/11/how-to-be-bad-boss.html http://random-software-inklings.posterous.com/2010/11/how-to-be-bad-boss.html Being a boss is a complicated thing. It is your job to get people to do things, sometimes things they do not want to do. And it is especially complicated in the software industry, where it is like herding cats.

I see a lot of posts on how to be a good boss, but the problem there is that they often forget to mention the things that can and will immediately erode any success you might have had. I am going to assume that as a reader you strive to be a person who others are willing to follow.

Nobody is perfect, so you will probably have done at least one of these things in the past.  Or you do then without even knowing.  Now is your chance to stop, and be a constructive boss who people want to work for.

Be smarmy

Yep, this is number one. Smarmy people are falsely friendly (think used car dealers).  Notice I did not say do not "be mean." As a boss sometimes you will need to be mean, or at least not very nice. And even that should be kept to a minimum, but it is never OK to be smarmy. All it does is make people uncomfortable confiding in you, which means they will either find better employment (if they can) or they will sabotage you.

Here are some examples of what I mean by smarmy:

  • Suggest that a problem can be solved by the employee working overtime
  • Using scrum (or any general meeting) to point out an employee's failure
  • Joke about firing an employee
  • Make any sarcastic comment about an employee in the presence of others
  • Only talking to an employee when you need them to do something (i.e., I am only talking to you because I want something)

Some ways to tell that you have already failed at this:

  • All laughter stops when you enter the room
  • Conversations between you and an employee die quickly
  • Employees no longer tell you about issues they are having

Be a hypocrite

A hypocrite is someone who says one thing and thinks or does another.  It can be as overt as being prejudiced (racist, sexist, etc...) or as covert as being passive aggressive.  Being a hypocrite is risky because when other people find out, you are just being deceitful, and no one wants to deal with that.

One example is saying that code needs to be high quality but not leaving time for testing.  Overtly this often resembles explicitly adding a testing phase at the end of coding and then cutting it if coding goes long.  Covertly this is often assuming that testing is done as part of coding, but scoffing at longer estimates.  Speed and quality have a tenuous relationship.  Something done slowly may or may not be of quality, but something quickly is almost never of quality.

The best way not to be a hypocrite is not to bring your values and prejudices into the equation.  To do this though you have to understand what your values and prejudices are.  In the case of the no testing, quality is explicitly stated as the important part, but speed is implicitly stated as the important factor.  More specifically speed at the cost of quality is stated as the import factor.  To avoid this, it is important to explicitly state the importance of all three tenets of the project triangle: that way you avoid the embarrassing case where one tenet goes to 0 unintentionally.  See: Project Triangle.

Be arrogant

I am not talking about being hard headed or stubborn.  I am talking about being truly arrogant.  Stubborn people will listen to reason, assuming the opposing argument is good enough; arrogant people cannot be directly convinced.  There are two forms of arrogance to watch out for: arrogance of idea, and arrogance of presenter.  Arrogance of idea is simply dismissing an idea because it is in direct conflict with your internal ideas or values.  Arrogance of presenter is rejecting an idea because of who presented it.

Two engineers approach you with different solutions to the problem of releasing on time: one says to keep the feature set and stop doing unit testing, and the other says reduce the feature set but keep the unit testing.  Which do you choose?  If you choose "keep the feature set" then you wrong.  If you choose "keep the unit testing" you are also wrong.  If you chose either (based on only the information provided) then the choice you made was based on you internal values only and not based on the problem being presented.

In the context of work the truth is that new hires probably know more about a given framework than you, and certainly will have a different perspective on how things should be done.  They are probably offering you this knowledge, because they have already encountered the problem you are now seeing and have found an appropriate solution.  It is tempting to dismiss this simply because a new hire presented it and they don't know the full business impact of their suggestion.  But ask yourself: if the system architect presented you with this idea would you accept it?  If yes, then you are suffering from arrogance of presenter and should tread lightly.

I suggest instead that you judge an idea (never a presenter) on its merits in the context of only the problem (never on facts you assume to be true).  And make sure you are consciously and actively judging the idea, and you are not adding your own problem or values.

Offer post hoc rewards

A post hoc reward is a reward given after work is complete.  In physical work the effects of post hoc rewards are well known and lead to better results, but in knowledge work offering post hoc rewards has a distracting effect. Work will take longer and be of lower quality. It will make employees very good at performing work that maximises their incentives, and not at developing a quality product.  Be aware that offering reward for work done defines a tangible value for that work, which may demoralize an employee who feels under compensated as a result.

Intrinsic rewards can and should be used.  These are things that are given universally and without reservation.  Basic examples would be vacation, and health benefits.  Other examples would be a free day to work on any project the employee wanted, or free soda/tea/coffee.  These intrinsic benefits help endear you and the company to the employee.

Accept estimates less than 4 hours

This may only be true in software, but tasks never take less than 4 hours.  A task is really an atomic complete chunk of work, so to be considered complete it must be coded, tested, reviewed, and committed.  However, some employees will claim they finish tasks sooner.  Often these people are cutting corners (not testing, or not getting a review) or they are doing a bunch of tasks that should have logically been considered one task.

Either way they are playing a game with the numbers to get their counts higher, which means that you are probably rewarding over aggressive estimates, and have a huge defect backlog.  Well done!

Assume research is intrinsic

I have seen this bite so many bosses, where they say something like "tasks cannot take longer then 4 days."  The problem is that now you have employees trying to split tasks that have little or no real research done.  So when it comes time to implement you have a bunch of small tasks that are too small to warrant research, but no real clear direction because no real research was done.

Estimates of several weeks or months are fine early in the process.  But enough time needs to be given to investigate feasibility prior to high level scoping.  Prior to implementation, time should be given to research an implementation and split the tasks out.  All of this time should have been blocked in as a single unit during high level scoping.

Require meetings

Meetings cost time and money.  And in addition to the meeting itself there is time before the meeting where people ramp down, and time after the meeting when people need to ramp back up again.  Both ramping phases are about 10 minutes each.

To monetize this for you, let's say you have 12 employees going to a meeting, and on average they make $24 an hour, and the meeting is 15 minutes (a scrum).  The total chunk of wasted time is 35 minutes or about $14 per employee.  For the company that means you wasted $168.  And that does not include any prep time employees had to take.

In general, meetings need to be kept to a minimum and kept on track because they will end up being the single most costly event both in terms of money and productivity.

Watch your employees work

Nobody is comfortable being scrutinized.  Do not set up your office so that you are looking into your employees' cubes, and don't wonder around aimlessly, and never under any circumstances hover.  By doing this you are showing your employees that the most important thing is to look busy (a function of the keyboard and finger), not to solve problems (a function of the brain).  At the point where your employees feel scrutinized they will work just hard enough to not get fired, and will partake in CYA games.

The best example is Office Space the movie.  Little more needs to be said.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/cPumFsV6gthpw john Kamenik jkamenik john Kamenik