I'll explain my situation first. This is all java based.
I'm the junior programmer (2012 graduate) in a small business with one senior developer. He's got over a decade of experience on me. He was probably programming when I was learning multiplication. The code he writes is solid, efficient, and produced very quickly; mine is mostly solid, but slower to produce and I often ask for pointers. I know, I will get better with experience. For the last 3 years I've been learning everything I can from the guy. I'm not too worried about it and they haven't fired me; so that's good. I would say I've improved drastically since the start of employment. I've learned more in the first year of working than I did for my entire duration as a student.
Here's the problem.
When I write my own code on something fresh, it's amazing. I'm entirely motivated and don't lose focus. I can think clearly, solve all the problems, debug with ease, and I enjoy it. My code reviews have almost all been positive, only minor changes. I'm able to work with OO code when I write it.
When I work with his code, I get frustrated, unmotivated, and stressed out. It's like the code that I'm writing is totally different. It's all interfaces, builders, factories, abstract classes, multi-threaded, and nested static classes. I mean everything. Every time I work with his code there's something clever going on. It's like he's done away with the "if" statement entirely. It's like 5 class files deep before I find the one function call I need and I can't easily work with it. Debugging it is a nightmare, skipping all over the place trying to follow all the inheritance and function calls. I can tell when I was working on his code just by looking at my commit log. Huge, MASSIVE spikes in LoC when I worked on my own stuff.
I can say, without much ego, I'm not stupid. I'm not a genius, but I'm not dumb. I just can't tell if he's a genius or what? I've read stories about what makes a bad programmer and failed employees. I'm always left asking "wow, they got hired?". I don't feel I relate with those programmers but I haven't really worked with a bad programmer either. He's really the only other programmer I've actually worked with. I can only compare myself to him, someone with at least a decade of experience on me. It's really crushing when I'm proud of something I worked on, only to see his 60 file commit sitting in the queue.
What have you said to your senior about his coding style? Have you spoken to anybody else? You need to be careful if you speak to anybody else. Has your senior been working at the same place all those ten years? If he has become isolated, it is easy for him to spli into bad habits. Is there any chance of code reviews with a third party?
Jamie Orwell wrote:I just can't tell if he's a genius or what?
First: Welcome to JavaRanch, Jamie. Now to your question:
He might be; and he could also be an awful programmer (although some of the things you mentioned suggest he isn't).
I've met a few genuine geniuses in my time who were also crap programmers (and I mean really bad) because their code was so incomprehensible that nobody dared to touch it. And that is the antithesis of good programming, IMO.
However, as Einstein said (sort of): Everything should be as simple as possible, but no simpler.
Some problems - shortest path, concurrency, the game of Bridge (which has taken far longer to "teach" to computers than Chess) - simply are complex; and so are some structures.
All the things you mention - interfaces, builders, factories, abstract classes, multi-threaded, and nested static classes - are there to help reduce complexity and increase flexibility and re-use; but like anything they can be abused. I suspect that your frustration may stem from your unfamiliarity with the "whens" and "whys" of using them rather than from any perverseness on his part ... although it's also distinctly possible that he doesn't document sufficiently (a common problem with geniuses ).
My suggestion: Next time you have to go through a particularly "thorny" program of his, ask him if he'd sit down with you for a couple of hours and explain his design decisions. A couple of bouts like that might help you to work out how his mind works and - assuming he's not an ogre - if you ask questions like "well, couldn't you have done it this way?", you might get some more insight into why he chose a particular path.
Unfortunately, you then have to decide whether he was "right" or not - and many of those determinations aren't black or white.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
Devious Experiments for a Truly Passive Greenhouse!