Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


The build-up of WTF code due to shortcuts (team members)

  • You cannot reply to this topic
7 replies to this topic

#1 Petter Hansson   Members   -  Reputation: 602

Like
0Likes
Like

Posted 27 November 2013 - 04:25 PM

Currently I'm thinking about how to approach the delicate matter of some colleagues completing tasks and solving bugs in the most straightforward obvious way possible, slowly resulting in the growth of very WTFish code. Typical example: Someone wants to add a feature in a core module, and then does so while inverting dependencies, resulting in "core" module depending on other modules rather than the other way around.

 

Now, it's quite clear I can't keep it up rewriting bad quality code being inserted in various places by people, so how would I go about educating them to think before they write a "solution" for something? Individual talks on spot? Weekly group talks? Ask them to read a book on software design?


Edited by Petter Hansson, 27 November 2013 - 04:27 PM.


Sponsor:

#2 ApochPiQ   Moderators   -  Reputation: 16079

Like
0Likes
Like

Posted 27 November 2013 - 04:29 PM

What's your relationship to these programmers? Are they your peers? Direct reports? Boss?



#3 Petter Hansson   Members   -  Reputation: 602

Like
0Likes
Like

Posted 27 November 2013 - 04:40 PM

Peer I suppose. We have a very flat organization, by the way.

 

There are better developers than me around here but in this particular project I've gotten the "quick fixers" smile.png Not that I define people who are capable of quickly getting bugs fixed as incompetent either, it's just a problem when they lack insight into software design and are assigned to continuous development on a project. Maybe our organization is at fault here since it gives them complete freedom to mess things up, but I'd rather not go the route of restricting freedom if possible.

 

The problems are under control but I suspect delivery would be a lot less painful if misdesigned code that needs to be rewritten immediately wasn't added to the codebase to start with.


Edited by Petter Hansson, 27 November 2013 - 05:00 PM.


#4 Hodgman   Moderators   -  Reputation: 31202

Like
7Likes
Like

Posted 27 November 2013 - 05:23 PM

Depending on the language in use, you could buy a book for the office such as large-scale c++ software design. Any on-the-spot advice could then be paired with a chapter number so they can get further perspective on the matter in their own time.
Alternatively, you could create weekly mini-lectures, delivering a chapter as a few PowerPoint slides ;)

Regarding the backwards dependencies, at my last job, the lead wrote a little script that would analyze all the 'includes' in each source file, for each folder of source files (each folder was a 'module'). This then created a graph of dependencies between modules, which can be converted into a vector-art diagram easily enough.
If any bi-direction arrows appeared in the diagram (e.g core depending on gfx, as well as gfx depending on core), he'd immediately check the logs, and then use said book and diagram to explain to the person responsible as to why they need to fix their code.

#5 ilreh   Members   -  Reputation: 281

Like
1Likes
Like

Posted 28 November 2013 - 06:16 PM

I know this problem too well. This problem won't go away easily if your release-cycles are very short and/or your tasks quickly change and are flexible - especially if you write performance-optimized code. Try to get one of your colleagues over to your desk and just ask him how you are supposed to make sense of this code and give him examples of how misleading it can be. It might help to make him see it through the eyes of someone else. Generally, quick meetings are a pretty good cure for such environments. If you have to work with messy code on an ongoing basis, make it a habit to sit and go through the code together (quickly, just to have an overview). That's also a great way to maintain exchange of information.

#6 Petter Hansson   Members   -  Reputation: 602

Like
1Likes
Like

Posted 30 November 2013 - 08:15 AM

Hello again, sorry for replying late, it's been a laborous week at work..

 

All good suggestions I think. I guess the key is to actually talk to people and be specific about what the problem is, rather than mention it in passing without them really understanding what I'm hinting at. I'm a conflict avoidant person so I tend to say e.g. "someone inverted dependencies here" rather than "you inverted dependencies here, let's discuss it"; in the fomer case I'm sort of naively assuming they will understand the problem despite me being vague about it. Anyway, I can force myself to arrange small sessions to go it through with them so that's what I'll do I guess.

 

I will consider writing a dependency visualizer just for fun, or possibly just google one up for the language we're using. Perhaps it could also be integrated (in the long run) into precommit hooks so that inverted dependencies trigger commit failure *evil grin*


Edited by Petter Hansson, 30 November 2013 - 08:23 AM.


#7 Eck   Crossbones+   -  Reputation: 3096

Like
0Likes
Like

Posted 09 December 2013 - 09:01 AM

With great power(freedom) comes great responsibility... If you let the mess build up it's going to get worse and worse.

 

There are more of them than there are of you, so you can't redo everything they "fix". You have to correct this problem at its source, or you're going to lose this battle.

 

I recommend tackling one type of problem at a time. For example, the core libraries calling into project specific libraries. It SHOULD be obvious that core libraries aren't allowed to call things from the UI of some specific project... But it isn't obvious to the "quick fixers" as you call them. (very polite name btw).

 

1. Pick one of the quick fixers that you work well with and explain the problem. Create a new project that uses the core modules if you have to show him why his "solution" can't work in the long run.

2. Fix one instance of his code while pair programming with him. Show him some more advanced techniques like dependency injection or whatever is necessary.

3. Encourage (make) him fix one other instance of his code.

4. Encourage (make) him teach one of the other quick fixers with you supervising or while you move on to a different quick fixer. (make sure you trust him to teach the subject properly)

 

Every social dynamic is different and no one likes to hear that they are wrong (even when they ARE wrong). So just be careful how you phrase things. Depending on their personalities it might be better for one guy to hear it from the architect, but another might like to work with you instead. Also make sure your leadership is okay with this plan.

 

Some other things that might help in the future.

* Pair programming - a good programmer with a quick fixer

* Code reviews - doesn't have to be every check-in.

* In this case, an automated build - coming from a computer, it's sometimes easier to accept we were wrong

* Writing down "the unwritten commandments" - it isn't obvious to them... if it was, we wouldn't have this problem!

* Learning lunches - lots of programmers don't take time to read articles, or expand their skills on their own

 

And DO NOT put these guys in charge of a critical area until you really trust them. At my company (a little before my time) they had put 2 of these guys on accounting. None of the good programmers wanted to touch the boring (but complex) accounting and dropped this in their laps.Left to their own devices, they eventually got it to "work"... But a few years later it's starting to collapse under its own weight. Guess who has to fix it? >.<

 

- Eck

 



#8 wodinoneeye   Members   -  Reputation: 861

Like
0Likes
Like

Posted 09 December 2013 - 01:03 PM

Allocate one of THEM to be the  Class Librarian  and let them feel the heat instead of you..

 

Ive worked for enough startups where the personnel were often of the 'just get it done' type (including managers at various levels) while others were the 'over-engineer for every possible potentiality' excess.   Depends if you have the resources even for some middle ground 'standards' to be enforced for the particular project.

 

If it is already accumulated, consider how much work it will be to go back to correct the improper coding.


--------------------------------------------Ratings are Opinion, not Fact





PARTNERS