

Ask Slashdot: How To React To Coworker Who Says My Code Is Bad? 507
A week ago, you read the other side of the same question. Now, an anonymous reader writes "I have been with my company for 10+ years and have seen many development cycles on our projects. We have a developer intern who has not been on the team for very long. On day one he started ripping into my code on how terrible it is. We have a code base of roughly 50,000 lines of code. When he comes to me with a complaint about the code it is simply because he does not have the experience with it to actually understand what the code is doing. He is a smart guy with lots of promise, he is asking good questions, but how do I get him to look past his own self perceived greatness enough to slow down and learn what we are doing and how we have pulled it off?"
Tell him to write goddamn login page himself? (Score:5, Funny)
After all, he's fresh from a CS program where they taught him everything.
Re:Tell him to write goddamn login page himself? (Score:5, Funny)
Code Monkey get up get coffee / Code Monkey go to job / Code monkey have boring meeting, with boring manager Rob / Rob say Code Monkey very diligent / But his output stink / His code not functional or elegant / What do Code Monkey think? / Code Monkey think maybe manager ought to write god damn login page himself....
Re:Tell him to write goddamn login page himself? (Score:5, Funny)
Code Monkey not say it out loud. Code Monkey not crazy, just proud
Re:Tell him to write goddamn login page himself? (Score:5, Funny)
Comment removed (Score:4, Informative)
Or... (Score:5, Interesting)
The answer is really simple:
Step 1) Hire a second, unpaid, intern
Step 2) Give all the current responsibilities the 1st intern has to the 2nd intern
Step 3) Have the 1st intern do nothing but beautify your existing code, with the understanding that he can't change how any of it is written.
Re: (Score:3)
Why does this thread keep reminding me of BOFH?
Ahh, I remember now. It's the hidden ITIL.
Re:Or... (Score:4, Insightful)
I think the best way to resolve the situation is not to distract him by giving him some greenfield work to do. This give him the scope to prove himself without pissing you off in the process. What you actually think of HIS code is a totally different topic.
Re:Tell him to write goddamn login page himself? (Score:5, Informative)
Re: (Score:3, Insightful)
The boss is interested in the long term effects of having code that doesn't suck, such as lower maintenance time. If the boss wouldn't care when directly told this, that just shows he has bad management skills.
In other words, you're basically saying "take advantage of the boss's bad management skills to get the employee fired for doing something that would actually benefit the company".
Re:Tell him to write goddamn login page himself? (Score:5, Insightful)
As programmers its an easy trap to fall into thinking that better code always translates into those dollars and cents management seems so hung up on. Sometimes it does, sometimes it doesn't. Yes, some bad managers are too short term focused, but being able to do the math and figure out if the cost of cleaning up some code is going to be justified in the long run is part of a managers role.
Telling management you want to re-write everything is a programmers perogative. Accepting it when the manager comes back and says "what we have now works, our customers arn't complaining, the thing is end of life in 2 years, and even if this made future maintenance free it wouldn't be worth it" is a reality.
Re:Tell him to write goddamn login page himself? (Score:5, Interesting)
Forgot to add, this guy put it way better than me a while ago (yes, I bookmark slashdot comments that are particularily helpful.. it comes in useful surprisingly often):
http://ask.slashdot.org/comments.pl?sid=1932550&cid=34743614 [slashdot.org]
Technical Debt (Score:5, Interesting)
We always see bad code as technical debt and treat it as debt. When we have cycles we pay it off, when we don't we get some more.
Having been doing this for 12+ years, I have come to realise I have never liked anyone's code and figured out its more of a style or personality than bad or good. Yes there is bad code, but there is no good code per say. Or put another way, if done right its good and you and I still may not like it.
Its just the nature of the beast, its kind of like driving a car, all other drivers seem bad.
Re: (Score:3, Informative)
Bingo, it's bad code in the eyes of the beholder if the code currently fulfills the user case(s). what is good code: What is good code? Readable? Efficient? Academically written? following standard? ingenious? a hack? All depends on the use case... remember those things?
If you're coding for a career, coding is about filling a use case, to make money. It's not a mental exercise--which is left to college students. That's why I see CS prima donnas and Business AppDevs fight so much on code.
If it does the job a
Re:Technical Debt (Score:5, Insightful)
Sometimes I don't even like my own code if I'm coming back to it a year later. It's just the nature of the game. What looks 'good' and 'right' to you changes based on what you know about coding, what problems you've encountered, what you know about the project, what you know about the budget, etc, etc.
Re:Tell him to write goddamn login page himself? (Score:5, Insightful)
This is what a lot of idealistic programmers who are just out of school fail to realize. We should be able to remember that all the code we wrote in college had to be perfect, without any flaws. At the same time, most of these programs were fairly small(
Another problem arises when you have an older developer who is forced to learn new tech where the best practices are drastically different from those he/she is familiar with. For example, if all you've ever done is procedural code(which is what most of my college classes did), and you are tossed into a situation where most of your coding is layered event driven the best practices between the two are so different that you are bound to make mistakes. What I've then see happen in situations like this is that a new developer comes along & sees where there are places that the best practices aren't being followed 100% of the time, and therefore assumes all the code must be crap. Instead, what should happen is the new developer should look at why something was done the way it was & work with the responsible party(not necessarily the original developer) and see if there's a good reason to "fix" the bad code.
Currently I work with a great set of managers. They understand the cost of any project and are very good at prioritizing "fixes". They know that some of the early development doesn't work with the things we are now trying to do, and are will to let us go back & fix things. But they also know that we don't have the resources to fix everything, even things that might reduce the errors & crashes. I have a fellow developer that not fixing everything drives him crazy, and that was one of his first lessons. Nothing's perfect, nothing will be, and our job is do the best we can & worry about the problems only when we are told to.
Re:Tell him to write goddamn login page himself? (Score:5, Insightful)
There's also the matter of rewriting things introducing new bugs and getting the "so what good did it do to rewrite it when the new code doesn't work?" element. Worse is when the new bug is difficult to reproduce or troubleshoot.
Sometimes it is just best to let sleeping dogs lie, and do something better with the next product.
Re: (Score:3)
So where are all these bosses with "good management skills"? I haven't seen it since the early 90's. The long term effects of code that doesn't suck do not seem relevant to any manager's career goals, apparently.
Re:Tell him to write goddamn login page himself? (Score:5, Insightful)
The boss is interested in the long term effects of having code that doesn't suck, such as lower maintenance time. If the boss wouldn't care when directly told this, that just shows he has bad management skills.
Rewriting is very often the last thing to do with working code. IChucking out working code and reproducing it usually involves relearning all of the reasons those last guys did it that horrible way.
Re: (Score:3)
If you have a long term codebase that has been managed by people that have come and gone, no rewrite or refactoring should be embarked upon lightly. If the codebase isn't subjecting the busines
Yes, this is the problem. (Score:3)
This is the reason most software is terrible.
Re:Tell him to write goddamn login page himself? (Score:5, Insightful)
I've had my code criticized before by people who I knew were in a lower league, and all I did was explain it to them proper and I consistently get back "oh, ok" and it's dropped, every once in a great while I may learn a minor thing or two even.
Re:Tell him to write goddamn login page himself? (Score:4, Insightful)
Source code is like shit, you can't smell your own (Score:4, Insightful)
I've been in the game for a long while, I have never seen anyone walk in and comprehend the inner workings of a non-trivial source tree in under 3 months, but I've seen plenty of inexperienced people that think they can. The real problem is that code is much easier to write than it is to read. When a coder rewrites something only one thing is certain, it will be an education for the coder. However that coder is now the SME for that application and other coders will have to try and read his code. An old friend of mine, an excellent coder and all round pragmatist, described this phenomena perfectly with the expression; "Source code is like shit, you can't smell your own".
Disclaimer: Self-taught coder, BSc CS/OR, 22yrs commercial experience, 28yrs coding experience.
Re: (Score:3)
That was my thought. You'd be doing him a favor. He's an intern and that means he's there to learn. That'd teach him an important lesson to take into his professional life.
I feel a development team has to constantly stretch. Somebody who comes in and challenges you to do better is in itself a good thing. But most coding these days is a collaborative effort and there's no place for prima donna behavior or theatrics. Those things are unprofessional, and wages of unprofessional behavior are dismissal.
This is
Old problem (Score:5, Insightful)
This is an ancient problem, with 10 years experience I'm amazed you haven't run into this constantly throughout your entire career. New guys (even old guys) perceive everything they didn't write as shit.
How you deal with it is dependent on a lot of things.
First: is he right? Maybe your code does suck. Hell maybe you suck! At minimum. code that has been around for a while, has been written by multiple people over a long period of time, been adjusted and re-worked to meet changing requirements, and been done under a deadline usually does suck at least a little. Admitting this is hard.
New guys want to re-write everything and don't understand the value of code maturity... most of the time a re-write isn't practical, and even the shittiest code usually attains remarkable stability by virtue of having all the bugs pounded out through years of use. Reminding him that this isn't a university project and a certain level of ugliness should be expected might help.
If you don't think he's right, learn how to properly describe why you do things the way you did, and conversely expect him to explain why they are wrong. This is the biggest thing to learn when doing code reviews, and applies here. If you can't objectively describe what is wrong using with references to either standard or internal best practices or conventions, arguing code ugliness just becomes subjective. If you want to defend your code, learn how to describe how it doesn't suck.
Having some company guidelines will really help, because it gives you something to point at in defending a decision. Ultimately what one guy considers good code may be considered bad by another. You are always going to have cases where someone thinks your code is too abstract, or not abstract enough, or sacrifices too much performance for maintainability, or too much maintainability for performance. At least with standards, the new devs will rail against the standards rather than personally attack you, and a standards document is a lot easier to defend (and yet still allows good changes without too much politics of hurt feelings).
Mod this up! (Score:5, Insightful)
Re:Mod this up! (Score:5, Informative)
No. You only say that until you are almost permanently awarded with mod points.
Re:Old problem (Score:5, Insightful)
Good answer.
Your keyword "deadline" didn't really get the emphasis it deserved. I know that I've been guilty of writing some pretty shitty code (and fully realizing it) because I simply did not have the luxury of the time to "do it right".
Sometimes this is because I made a bad assumption early on. Sometimes there was a surprise change in the specs that didn't mesh well with the design. At times, it is because I'm working in unfamiliar territory and still learning about some aspect of the project. Sometimes it is because I am working with existing bad code someone else wrote (possibly because of one or more of the same previously given reasons), and I have to do my best to work within an existing bad implementation.
In the real world, sometimes you have to make the choice of doing things right, or actually getting them done.
Re: (Score:3, Insightful)
Re:Old problem (Score:5, Insightful)
While a virtual disregard for a deadline is a big part of the reason that Linux kernel is as good as it is, that does not mean that quality first is the only way to go, and even the Linux kernel has plenty warts that were compromises. A kernel requires a level of perfection that very few other types of software require. There is a vast range between that and, for example, a convenience shell script.
It's mature developers who both, know how to create high quality software, and also recognize the value of trading perfection for many other goals at the right time who are the most valuable. And Linus Torvalds is one of them. RMS probably is not.
I, and I'm sure many other highly skilled developers, find your assertion, that anyone who compromises quality as incompetent, insulting but more importantly, wrong.
Re:Old problem (Score:4, Insightful)
Most likely you don't understand the term quality. Might I recommend that you read Zen and the Art of Motorcycle Maintanence, or re-read it if you have already done so? Any developer who sacrifices quality is incompetent by definition; that holds doubly true for those who know they are doing it and do so anyway. .
Re:Old problem (Score:4, Insightful)
In my experience, in the real world, the invocation of this phrase is usually used as justification for doing things in a manner that is so bad that what is actually done doesn't actually qualify in any meaningful way as doing the thing that was supposed to be done at all, although it often has enough of the superficial appearance of doing so that the people involved might reasonably hope that they will be out of the radius of accountability when it is realized that what was supposed to be done wasn't done.
So when I hear it, I mentally translate it into "in the real world, sometimes you have the choice between admitting that things can't be done as requested with the resources alotted and pretending that they can and hoping not to be held accountable when the failure is revealed."
Re:Old problem (Score:4, Interesting)
Actually the Space Shuttle Challenger was a design choice to save on the cost of shipping the tanks to Florida. The alternate one piece design didn't fit through one specific tunnel along the railroad from the plant to Florida, and would have required overland transit. It was well known within the industry. The other tank design was nearly identical to the design used by Russia. I was in an aerospace engineering class when this happened, and we studied the problem. I'm positive my professor already knew the answer, he was part of NASA's team.
Re:Old problem (Score:5, Insightful)
New guys want to re-write everything and don't understand the value of code maturity
I've been working in this industry for 20 years, and I've never experienced this. Instead, the "new guy" is intimidated by me because I'm constantly explaining things to him, and he quickly realizes that he doesn't know anything.
Re: (Score:3, Insightful)
Re:Old problem (Score:5, Interesting)
I came into a new position, my first serious one (when I was in my forties, second career field, after a couple years of good community college studies). I have experienced in depth 3-6 (3 thorough exposure, 3 partial/peripheral exposure) different, substantial code bases. Two of them where horrendous ("devil spawn"), one was not exactly a work of art, but manageable, managing considerable (reporting and logging) complexity, and the other 3 were solid to the point of being elegant, and naturally readable. And mind you, this was my first serious in depth exposure, across a variety of development platforms, including both proprietary and open source.
"Man is the measure of all things." -Protagoras
Re: (Score:3)
So this the first thing I would add. It the problem with code that it is not p
Re: (Score:3)
Shittiest code does not attain stability because "all the bugs" have been removed. More often it attains stability because it cannot be changed, the odd undocumented bug-like "feature" can be the expected behaviour by some client which you really cannot change ('cause you'd end up in an avalanche).
Then what I have noticed is that new code is usually bad: when you implement something, integrate and test you'll usually notice how to do it better. But then it might be too late to rewrite it.
Old coding practice
Re: (Score:3)
First: is he right? Maybe your code does suck.
I'm thinking of a case I've been in. The code didn't necessary suck, but it was almost completely uncommented. Maybe Mr. "I have 10 years of experience!" should go back and comment his code so the new guys can understand what's going on.
Re:Old problem (Score:4)
Regardless of right or wrong the other thing to expect is that sometimes the other guy will be able to better argue their position than you can defend yours.
In that case you may find yourself "made redundant" by an ass hat.
If that's the case chalk it up to experience and find a better place to work.
Alternatively, if they have arguments that you can't answer, realise that you were in fact in the wrong, and fix your code. This applies to newbies, and old hats alike, you should be listening to other people's arguments and figuring out if they're actually right or not (based on whether you can actually find an answer for why they're wrong).
Very simply (Score:5, Insightful)
Re:Very simply (Score:4, Insightful)
It boils down to two questions:
1) Does it work?
2) Will I ever touch it again?
If yes to the first question and no to the second, quality doesn't matter.
Re:Very simply (Score:4, Insightful)
You can never answer #2 with 100% confidence and if you are a seasoned coder, coding it properly won't be harder than hacking it together.
Re:Very simply (Score:4)
Is he right? (Score:5, Insightful)
Take a step back and seriously consider his criticism, as if he were one of your 10+ year coworkers. Whether or not he's right informs the right reaction.
Re:Is he right? (Score:5, Funny)
Maybe, but we know that he posts to Slashdot as well. [slashdot.org]
Re:Is he right? (Score:5, Funny)
Whether he is right or not is immaterial. Now is the time to assert your dominance. Sucker punch him and urinate on him while he's down to put him back in check.
Re:Is he right? (Score:5, Funny)
This works and it's a good fundamental method, but it's not extremely efficient.
I typically like to hire them in a groups. Initially, lay quiet and see who is the more uppity of the bunch. Let him have his moment in front of the new kids and really start to build an alpha status for himself.
Shortly there after you really want to just casually stroll up to the fresh example and just stab him in the kidneys a few times. This will deal with the problem candidate and build your reputation as someone who gets things done. In fact, it is unlikely anyone will question your authority for some time.
Re:Is he right? (Score:5, Funny)
We are primates, the proper response is to throw poop at him.
Re: (Score:3)
You just made me consider something I have never thought about before.
Do wild monkeys throw poo?
I would think that the ones in zoos throw poo because they can't actually get close enough to rub it in your face and then bite your face off.
Well, he's young, so you're a moron (Score:3)
By definition your code sucks, because it's legacy code and you wrote it.
So what? Does it work? Does anyone want to fuck with it? Is he willing to risk his job to change the code and break everything?
New developers want to rewrite everything, and don't understand that new projects don't happen often - and when they do, they don't get to work on them unless they have skills. That doesn't mean they need to kiss ass, but it does mean that they have to write code that works.
Maybe there -is- a better way to writ
Re:Is he right? (Score:4, Insightful)
It's a geek problem. There's often more than one right answer. You can't always get a single correct answer for every question. And that confuses and frustrates people new to some areas where it's true.
Re:Is he right? (Score:5, Informative)
First step is to understand that young or old, lot's of experience or little, a person can have valuable contributions. For a good team you have to put ego aside. Sounds like there is ego on both sides of the equation in this particular issue. Listen carefully to what he thinks is wrong and he should listen back about the design decisions etc.
My experience tends to make me think that there are serious issues with the codebase. Depending on language, 50K lines isn't much and could be rewritten by a couple smart people in a matter of months. Obviously the product works, but how long are bug fix turnarounds? How extensible is it? How quickly can you add new features? Do new features ever break other parts of the code (i.e. coupling issues)? You can be proud of what you achieved, but also be honest. I've written some code myself I wasn't proud of (I'm sure we all have). A good developer isn't the same coder as they were 6 months ago, because it's a continual learning process.
If this jr has valid input, good ideas for restructuring (once you look at your code honestly, "Yeah, there was a better way to solve the issue..") then why not let him lead the dev for the next gen product? If you are honest about the code and he's just an egotistical little shit not willing to discuss things like an adult (some back and forth and actually listen to you and others).. get rid of him. Seriously. It's not going to help your team at all and he's going to cause problems anywhere he goes. If he's right and you're all wrong, then he's better off elsewhere anyhow (though if he's bullheaded and egotistical I doubt that's the case).
Re: (Score:3)
Fire him (Score:4, Funny)
Firing him might be the best lesson he ever learns...
You Are Not Your Code (Score:5, Informative)
You Are Not Your Code: http://sstephenson.us/posts/you-are-not-your-code
Looks like that other guy figured out how (Score:4, Funny)
Ask Slashdot: How Can I Explain To a Coworker That He Writes Bad Code? [slashdot.org]
Become Jonathan Coulton v2.0 ? (Score:3)
< insert witty song about geeky stuff here >
4 o' clock (Score:4, Funny)
outside, at the gate.
bad code offsets (Score:3, Interesting)
You can always learn, and the world can always stand to benefit from more people offsetting their Bad Code.
Do you always let interns tell you what to think? (Score:5, Insightful)
And a follow up question: do you have any internship openings?
Seriously, if he was hired as an intern I take it he has little/no real experience, and may not have even finished his formal education. He thinks your code is bad because it doesn't look like the code of whatever professor he most admired in school, or it violates some rule of some particular coding sect that he subscribes to. Tell him to write his objections down in a safe place, and come back to them after a year of working "for Real" and you will gladly sit down and listen to what he has to say then.
Re:Do you always let interns tell you what to thin (Score:5, Insightful)
It's also possible the younger coder learned a trick developed since the older coder got his skills fairly solidified, and the older coder never saw, or came up with in his own experiences.
Just because the new guy is disagreeing and less experienced, doesn't make him wrong. Yes, 9 times out of 10, the new, less experienced guy will be wrong, but that 1 time out of 10, makes it worth giving the other 9 times a fair hearing as well.
Re: (Score:3)
Just because the new guy is disagreeing and less experienced, doesn't make him wrong. Yes, 9 times out of 10, the new, less experienced guy will be wrong, but that 1 time out of 10, makes it worth giving the other 9 times a fair hearing as well.
I honestly don't think "experience" has anything to do with it. How long you've sat in front of a computer monitor doesn't directly translate to your understanding of software development. I've worked with a few guys with 15+ years experience. One created more work than he produced over 6 months (we were cleaning up shit from him a year after he was canned), another whom I bitched about in the last question really had no fucking clue how to structure code. He'd write stuff that "worked", but basically misus
It depends on how he goes about it. (Score:5, Insightful)
I would be as blunt, harsh and straightforward back to him, as he is was me, were I in your shoes. I might add a few nails to the coffin of the argument.
Him: "Your code sucks."
Me: "Back it up. What suck why."
Him: *explanation*
Me: "Well, I can understand you not realizing X, Y, and Z, being new and ignorant, but give it a few years."
Him: "Why'd do you do [pattern X, Y, Z]? Isn't it better to do [pattern A, B, C]?"
Me: "In certain circumstances, sure, but in [insert current circumstances and logic for X, Y, Z], this methodology works better."
Put him in his place if he needs it, otherwise, just educate. Also, listen - just because he's less experienced than you doesn't mean he hasn't picked up something useful. I know a lot of people who think they don't have anything to learn from the new guy, when the new guy had a few tricks up his sleeve. I've been one of those people who's learned from the new guy he didn't suspect. I've also been the new guy with unsuspected tricks.
Re: (Score:3, Informative)
You should also try to avoid my typos and grammatical errors. Those will not help your case.
Re: (Score:3)
I definitely try not to make typos when having a verbal conversation. You're right-- it does help.
Re: (Score:3)
I think the "what suck why" phrasing goes an extra step into emphasizing the dismissive attitude. His objections are so far beneath you that he does not even deserve the time it takes to create a properly formatted sentence with all of those useless articles.
Re: (Score:3)
Templated examples. I like it, we should do more template meta posting.
Comment removed (Score:4, Funny)
Re: (Score:3, Funny)
I thought if you were supposed to call in sick if you had a bad code. :-)
*ducks*
I got debug bad.
Is Your Code Designed to Build Walls or Bridges? (Score:5, Insightful)
Somewhere in the process of learning to write production ready code, it occurred to me that it was necessary to work the process backwards. Begin a project by setting up your hosting or distribution environment before starting to code. Write unit tests before starting to code. And so forth.
Getting other people to contribute to your project requires the same kind of thinking. Set up a project page before you start to code. Write a vision statement before you start to code. Write installation instructions, coding style guidelines, and operations support instructions before you start to code. That way, as you proceed in the project, you have clearly build up the documentation that other people are going to need to join your project. These things shouldn't be started after the fact.
If you can't point a new dev to a website and say 'download the source and instructions' here, it's probably too complicated and will meet resistance.
Re:Is Your Code Designed to Build Walls or Bridges (Score:4, Interesting)
A good opportunity (Score:5, Interesting)
From your description, the guy isn't mean spirited. He's likely never had to deal with multiple revision code bases before.
On the other hand, if this is code that has been through multiple revisions and re-purposes, admit to yourself -- it probably is bad. I'm the lead engineer and dir. engineering at a company I've been at for 10+ years, and I'll be the first to tell you that the code-base I am most proud of (30-50k lines of embedded/DSP code, mostly mine) is TERRIBLE! I wouldn't wish that code-base on my worst enemy. But its also been bread and butter for the company for the last decade and is stretched to its limit.
We've had at least two hotshots come onto the project in that time who have been terrified seeing that code-base and declaimed it as schizophrenic at best, and they are right. It is bad code, poor coding practices, and everything else bread out of necessity to keep the project(s) going and alive.
Your mission -- accept that whatever reasons are out there for the code being the way that it is, it probably is poorly structured and could use a rewrite. SO - this is a good chance for him to learn that not every bit of code that should be rewritten can be. Its called business reasons and experience. Whatever the reasons, you probably, as a company, don't have the time or resources to rewrite from scratch (we surely don't!), but a fresh out of school developer probably has not experienced these -non-engineering- reasons for bad code, and certainly was not there for the blood, sweat, and tears that went into them. He won't know about those all nighters that "saved the company" that you and the rest of the team probably went through en-route to this codebase.
Don't be a dick (Score:4, Insightful)
How's your documentation? (Score:5, Insightful)
I'm sure if he re-reads your internal design specifications, coding standards, and comments in the code he will understand your design.
Re:How's your documentation? (Score:5, Funny)
I'm sure if he re-reads your internal design specifications, coding standards, and comments in the code he will understand your design.
What's the giant whooshing sound? It's as if thousands of blissfully ignorant "senior" coders suddenly missed your sarcasm, all at once. Well done, sir.
Those who are not satisfied with others . . . (Score:5, Interesting)
. . . are really just not satisfied with themselves.
Give him a copy of "The Psychology of Computer Programming", and tell him to read the bit about egoless programming . . .
Re:Those who are not satisfied with others . . . (Score:5, Informative)
This, a thousand times this -- but remember, it works both ways.
The professor I worked with closely in university was a strong proponent of this. Sit down, go over the code, look at what can be made better and why, and what may need to stay crufty because it's arcane, and if someone doesn't understand something that's an excellent time to explain it. Walk through and review everything, and don't let your vanity get in the way of writing better code.
He called it egoless programming back in the 90's (no idea how old your book is), and I've found it extremely handy -- objectively look at your stuff and see if he's right. If he's wrong, explain it to him. In the end, the better solution should win out (unless someone is being stubborn or the 'better' solution is technically feasible, which does happen).
Get over the whole "I'm a code guru who knows everything", and be prepared to explain, justify, or even accept that you're wrong. In the end, you review your code to make sure it is as good as you can make it (within reason) and your junior guys get up to speed and understand things better. You get better code out of it, your junior guys get up to speed faster, and you might even learn something along the way.
It's still how I work with co-workers, and it helps in a lot of ways -- instead of saying "here's the solution", you start with "here's a solution, what have I missed?"
You won't agree about everything, but you can pick your battles and try to reach quorum -- the cats don't need to be herded when they're on-board in the first place.
I've seen really awful, and really good ideas from junior coders -- part of the process is helping them understand which is which. In a year or so when he's got more real experience, and knows he can have the discussion, both you and he might actually be better coders for it.
Different philosophies (Score:3)
Well I am back at the place where I was 10 years ago. I thought the code was great then, I think it is shit now.
But what I've learned in the intervening time, and having been a software development manager myself, is that code is optimized on a few axis:
- Brevity (get er done!)
- Clarity (I'll be able to read this again in 5 years and understand it)
- Structure (Object models)
- Formatting
- Efficiency
All of them factor into a meta category, which I call "Maintainability", where you want high clarity and structure. Maintainability is by far the most important aspect to an organization. Your n00b developer won't have your company's maintainability desire in mind. Efficiency is the dead last because increased computing power is cheaper than the development time to make it efficient, save some scenarios.
So my recommendation is to have him rate his code on those axis and your code on those axis. Hopefully he'll learn there's more than one way to code. It is very likely he's just out of school and his head is filled with registers and asymptotic running times. Those are important, but not as important as shipping maintainable code on time.
Re:Different philosophies (Score:5, Insightful)
I've said this at several workplaces:
What the Business values:
1. Correctness
2. Reliability
3. Maintainability
4. Speed
5. Coolness
What the Developer values:
1. Coolness
2. Speed
3. Correctness
4. Maintainability
5. Reliability
Don't believe me? Look at practically ANY open source project. Most are unreliable and impossible to contribute to. They are often incorrect, but they are usually fast and the programmer always thinks what he's doing is mega-cool.
Developers need to adjust their mindset to be valuable to the business, but sadly most business code looks more like the second list than the first.
Maybe you code _is_ bad? (Score:3)
The only way to deal with this professionally, is to look at his complaints in detail and either refute them or acknowledge them. Code quality is an area that cannot tolerate any power games. Have him actually explain in detail why he things some piece of code is bad and then explain to him why it is not, or why there are external circumstances that require it to have the form it has. Make that perhaps a repeated session, until one of you learns something about their coding skills. Go into this open and with a pure technical PoV. If he should happen to be right, then he is right. If not, you have to be able to explain why. That will also deal with the most common source of this behavior: The younger person feels under-appreciated and not respected.
If that approach goes nowhere because he cannot admit limits in his skills or is unwilling to learn, escalate to management. But make very sure the problem is not on your side before you escalate. Typically, escalation will not be needed, but some junior engineers are so convinced of their own superiority, that they cannot see anything else and cannot learn. I had that twice. In one case it resulted in the termination of the lady in question. That one was so set in her ways, she was not even willing to implement an interface designed by somebody else, but could not explain why it was bad. (It was not. She was just not able to implement anything not of her own design.) Zero team-working skills and zero ability to learn. It happens and it is not your job as a developer to resolve it.
Define "bad" (Score:5, Insightful)
As an engineer, I've adopted the maxim that there is no good and bad, only fitness for a particular purpose. I prefer a discussion of trade-offs to statements of principle.
I tend to ask "what requirements does this code fail to meet?" And very often, the reviewer has invented his own new requirement! Depending on your process, your response might be anything from "good point, let's add a test case for that" to "you should submit a Requirements Change Form for that. Make sure to get all the required signatures."
And if the criticism is for something immeasurable like "readability" or "maintainability" you can let your critic make the case to the boss why fixing this code is worth the cost.
Personally, I would... (Score:3)
stare him directly in the eyes and, in an outrageous French accent, curtly state "MIND YOUR OWN BUSINESS!"
Klingon Programmers (Score:5, Funny)
Re: (Score:3)
An oldie but a goodie:
http://gradha.sdf-eu.org/textos/klingon_programmer.en.html [sdf-eu.org]
Top 20 things likely to be overheard if you had a Klingon Programmer:
The first problem (Score:3)
The first problem is that you regard the code as "yours" rather than "the project's" or "the company's." Engineering discussions should not be personal, and getting emotionally attached to the code is unlikely to help you evaluate it objectively.
Years ago (Score:4, Funny)
Years ago I worked with a senior guy who was very good but very critical of everyone else's code, often for poor reasons. One day I showed him some code and asked his opinion. He starts ripping on it and asks me why I did it that way. I reply "You tell me, this is your stuff from a couple years ago.".
Re: (Score:3)
Oh, to have some mod points right now... You'll have to accept this virtual "+1 Funny" instead.
The two rules of programming (Score:3)
Quite a while back I came across the following two rules for development:
1. The code written by the guy who came before is junk.
2. Eventually you will be "the guy who came before".
Rule #1 tends to work because it's rare to be unable to find some way to improve code when you come back to it again with more experience or a fresh perspective.
Rule #2 helps keep you humble.
Your code IS bad (Score:4, Insightful)
Your code IS bad. I know this because it doesn't look like my code.
I really want to imagine (Score:3)
That this and the linked story are really about the same two coders.
as usual: xkcd (Score:4, Funny)
There is only one correct reaction (Score:3)
Fasten your teeth in his trachea, and pull your head back backward sharply until the trachea comes free from the body.
What is Good? (Score:3)
My top 3 practical criteria to judge whether code is "good" or not.
1) Performance. How fast does the application actually run.
2) Complexity. How many layers and levels and do you have to trace down into to debug something.
3) Flexibility. Can it be modified easily as new change requests come in.
Re:timothy is apparently easily trolled (Score:5, Funny)
yep.
What next? "I am some code. How do I tell my new maintainers they suck?"
Re:timothy is apparently easily trolled (Score:4, Funny)
That's easy.
Perform a Core Dump.
Re:timothy is apparently easily trolled (Score:5, Funny)
"How can I stop my employees from fighting over who's the best coder?
I don't care about code one way or another. I own a bakery, all I care about is selling bread. I just hired this CS college dropout because he was my cousin's nephew and I owed him a favor, and the kid turned out to be a good employee. Even suggested we bought a computer for keeping our budget electronically, and that worked out well. So, as I was satisfied with this somewhat bright kid, when I had to replace our janitor, I hired a second CS dropout. The problem is they started disagreeing right away about the most irrelevant things you can imagine and now they bicker all the time, have heated, uncivlized arguments about who is the better coder, what sort of software license works best, their choice of cellphone and whatnot. It's really disturbing the workflow around here. Nothing works properly anymore. For example, I never know whether my computer will have LibreOffice or MS Office installed, which means that at any given day I can open only about half my files properly. My customers are also placing complaints and I'm fed up with the food fights they cause. Can someone tell me how to make them stop or, at least, how to properly discern compatible nerds in the future?"
Re:Possibly related? (Score:5, Funny)
This questioner says he's been at the company 10 years and the new kid is hassling him. That prior question says the guy he's hassling has been at the company longer than the hassler has been alive. If they've hired a 9 year old as a coder then they deserve all the atttitude they get.
Re: (Score:3)