Discipline often directed at the symptom, not the cause 5
If the developer just had a little discipline and did it the right way, we would not have this problem.
That’s often a sign that the way something is getting done is hard to do, not supported well or just plain works against against you.
Here’s an example I recently came across…
- Checks out the source tree
- Runs the script
- Starts working
So far, everything is great and this part of their build system is essential to their environment – and good in general.
Here’s the next part…
To add a file to the system you have to:- Create the file
- Update project information
- Rerun the script to regenerate project information.
When I asked how long it takes to add a class, I was told about 5 minutes. So if I want to add a header file and source file, it takes 5 minutes. That’s a big problem. Why?
After this discussion, I heard one of the senior people lamenting that a developer had put another class in an existing file rather than creating a second file. He said something like “If the developer just had discipline, he’d to the right thing.” Those darn developers.
It takes 5 minutes to add a few files to a build. That does not include build time. That’s just the time to configure the build information.
Does 5 minutes seem like very much time?
Here are a few more thins I noticed(before I knew about the build system):- Some header files defined multiple classes
- Some source files had the methods for those multiple classes
- Some of the header files had names that did not match any of the classes defined in that header file
So is this a problem?
Here’s an important rule from Jerry Weinberg:Nothing + Nothing + Nothing eventually equals something
5 minutes may not seem like a lot of time, and if it were isolated, then it’s probably not a problem. On the other hand, when you multiply it by a team and time, you end up with big problems.
Imagine, you need to use class X. Its header file is actually named Q.h and by the way, classes T U and L are defined in that file – none of which you want to know about.
So your class now has phantom dependencies on T, U and L. Also, how did you find the right header file? A quick search (time wasted). Someone changed U, so you end up having to recompile even though you don’t care about nor use (wasted time). I’m sure you can come up with a few things on your own.
So what do you do about it?
OK, first, do not throw the baby out with the bathwater. The original tool solved an important problem. But the first rule of problem solving, again from Jerry Weinberg:Every solution introduces problemsThe problems include (but are not limited to):
- Time wasting adding files
- It requires discipline to add new files, so it doesn’t always happen
- A name is wrong, but it’s a pain to update the build configuration, so it doesn’t happen – not all the time, just every so often
Little by little, things get a bit more chaotic.
So now that we’ve observed a problem – some waste, we need to find a way to remove the need to update the build information and regenerate to even work.
I don’t know what’s going to happen with this group. They are hoping to perform some refactorings. Their system has quite a bit of coupling. One thing we can do to reduce coupling is:- Introduce interfaces
- Inversion of Control
- Identify seams and use some of Feather’s stuff to introduce them
- Etc., the usual stuff to introduce seams and break dependencies.
But many of the refactorings they’ll want to use will involve creating new classes. Since that takes a little bit longer, it will slow everything down – or seem so daunting, it might not happen at all.
Here’s a personal example. A few years ago, I built the security system for one applications and then a suite of applications with single sign on. When I initially introduced the security system, many people wrote tests that would forget to log out, causing problems in both the real system and the simulator.
I kept grumbling. I though, “if people would just do it right, there wouldn’t be a problem.” If they just had a little discipline.
Independent of whose fault it was, it ended up being my problem – and, quite frankly, it was my fault as well. The solution was actually pretty easy:- Create an abstract test base
- Change tests to use it
- In the setup, the base logged in
- In the teardown, the base logged out
- Reduced code duplication
- Increased the stability of the tests
- Made it hard for people to mess up (so long as they used the correct test base – and I updated all of the tests that needed it, so going forward, people had correct examples upon which to base their work).
Ultimately, this removed a lot of my wasted time
Detecting waste is the first thing. Until you know it is a problem, you cannot do anything about it.
So, the next time you think something like:- If that person was only following “the rules”
- If he/she just had a little more discipline
- Stupid user, they should not have done that
Ask yourself if it’s possible that those statements are directed at the symptom, not the problem.
