Lurker News
There are a couple of engineers on my current team that I can only describe as being a little too smart for their own good, and I'm struggling a bit with how to work with them. I've worked with this sort of engineer on previous teams as well, and they all share a few traits:

- They're brilliant, I mean very smart people (in an almost academic way?)
- They have a big appetite for adding complexity to systems
- They also have a big appetite for adding work to their own plates
- Their code has no consistent style
I work in embedded systems, so I'm generally writing C for resource-constrained systems. This sort of environment is rife with footguns, and I spend most of my time just trying to avoid those. A big part of that is keeping the things that my team controls as simple as possible, and while we are resource constrained, it's a balance. The tension comes when someone's more than happy to, for example, implement a complex caching scheme from scratch to save a few hundred bytes here, a handful of microwatts there. To me, adding that type of complexity for those sorts of performance improvements is missing the forest for the trees.
When an engineer like this proposes something that adds unnecessary complexity, it's usually hard to argue with. The proposed change typically does indeed make the system objectively better, and they're the one taking responsibility for doing the work and ensuring its correctness. But the overall system becomes a little more brittle, and a little harder to reason about, two things that are much more difficult to measure than memory and power.
Here's an example: an engineer on my current team recently proposed adding a significant feature to a module I wrote to make something dynamic that's currently statically defined at compile time. I pointed out that we could just change a couple entries in a static table to accomplish his goals, and we were able to avoid the extra work. What was notable, though, was his immediate willingness to write that feature. Maybe I'm lazy, but I'd sit there and think of half a dozen other ways to do it before settling on changing the module itself. But because he's smart enough to easily reason about a complicated solution, and he's willing to take on the extra work, he stopped there without weighing it against the larger system.
Have you worked with engineers like this? Do you have any thoughts on how to work with them in a productive and friendly way?
--
One more example if you feel like reading more:
In a past role, I got into a debate about code style with the smartest person I've ever worked with. It boiled down to me advocating for more whitespace in his code and him arguing that adding whitespace made the code harder to read. It took a bit, but eventually I came to understand that he is so good at reading code that he just wants it all laid out in front of him as densely as possible. He can effectively run it in his head, as long as he can see it.
That was baffling to me, I walked away thinking that I must be pretty bad at reading code. I use a very consistent style with long variable and function names, I keep my solutions as simple as I can, and I use whitespace generously to provide visual cues about the code's structure. All of this is to minimize the amount of brainpower I needed to understand my code, so I can put that energy toward thinking about the problem itself.

Comments (474) 222 threads

Show all comments

Showing thread 4 of 222

sublinear7 replies#
I can't directly speak to any particular work you're describing, but "smart" people don't usually add significant complexity and aren't hard to work with.

Their solutions tend to be obvious in hindsight and simple.
They work within the constraints they're given. They don't merely find one solution and push it through. They get satisfaction finding which fits best. If there's conflict, it's probably because they don't know how else to solve something.
It's true that sometimes there's only one solution, but that's rare and implies you're hitting bedrock fundamental stuff or have an over-constrained codebase that needs some refactoring. In those cases it would be apparent in other places too, not just when dealing with their code or opinions.

taneq2 replies#
All of this. Truly smart people make things easier for everyone, and usually solve problems in beautifully simple ways.
shapefrog#
That often goes unnoticed and can, to an outside observer, look like a "lazy" worker.
ilyt#
I think that's overloading the meaning of the word.
muzani7 replies#
I think I understand what OP means. I work with some smart people who use code like

    val x: Pair>
instead of say

    data class Status(key: String, value: String)
    data class Item(name: String, status: Status)
    val x: Item
To the smart ones who can keep everything in their head, the first block of code is trivial and obvious and they don't even notice that it's hard for others to read and easy to make mistakes in.
zepolen1 reply#
The actual smart ones would realize they are writing code for others rather than themselves and go with the latter.
delecti#
That's a very useful lesson. Also recognizing that you won't remember the code the next time you see it. It only took me a couple instances of "what moron wrote this? ...oh, it was me" before I started including myself in the "dumb future people" I'm writing my code for.
killingtime74#
Your way is better because when compiled it is the same bytecode and it’s clearer
nohuck132 replies#
It could also be inexperience.

If your experience is limited to academic projects, grinding leetcode, even competitive programming, you've done things where first one is nearly always optimal.
Once you are on a team optimizing for continued feature delivery over time, the cognitive load of picking up and understanding old code full of raw maps and strings starts to justify the overhead of a bit more semantic scaffolding in places.
IMO the necessary judgment has to be learned even by smart, academically talented people.

franciscop1 reply#
I've rarely worked in a team where the extra scaffolding was ever worth it. In fact chasing the scaffolding scattered through varied files through the filesystem was a lot trickier usually than fixing the actual bug I was trying to fix.

Continue this thread — 1 reply

collyw2 replies#
As someone getting close to 50, inexperience also seems to correlate with the ability to hold more in short term memory.

Continue this thread — 2 replies

protomolecule1 reply#
I once worked with a guy with a rather good memory who wrote code like that and could maintain it for years. I was impressed with his ability until he hit his limit and made half a dozen of subtle bugs in one commit.
peteradio1 reply#
Geez never make a mistake in front of this guy or your years long reputation gets shredded.

Continue this thread — 1 reply

dusted2 replies#
That's not about being smart or not.. But about brevity and a bit of experience.

I'd certainly recommend the first one, there's simply less stuff to parse, it's easier and quicker to read.
x is a pair with key of type string and value of pair with key of type string and value of type string.
The other one is overly verbose to read, it takes more effort to read and understand.. But it could have merit, for instance if you need to extract status into a variable of declared type later..

collyw7 replies#
Used to do a lot of Perl, which is a wonderful language for writing obfuscated code. If something is an advanced feature of the language and I felt the need to use it, I would ad a comment explaining what the code was doing.

Continue this thread — 7 replies

pivo2 replies#
The first implementation is bad. It’s less stuff to type, but if you’re parsing it, you’re trying to understand it, and the second implementation makes the meaning clear while the first implementation is mostly meaningless. Code is written once but read many times. Be kind to your readers, which includes yourself in the future.
dusted1 reply#
I strongly disagree.

My comment was from my immediate experience parsing what he wrote right there and then. The first one is easy to read and quick to understand, the second on is already like "oh god, now comes a bunch of stuff" and then "okay, he declares that, it's this.. fine" "Okay, he declared this thing and then the other thing is part of that, yeah" and finally "oh, okay he wanted a variable named X with a pair> geesh fuck just get to the point already!"
Like, seriously, it's like the analogy with the little kid explaining every little thing in excruciating detail, actually managing to make it sound like something is happening while nothing's happening.. Don't talk up this giant thing and tell me what you want to tell me.

phailhaus2 replies#
> The first one is easy to read and quick to understand

No it's not. Let's look at it again:

    val x: Pair>
What does x represent? You don't know. Actually, there's no way for you to know what the person writing this code meant when they defined this variable. Sure, you know its structure, but how is it meant to be used in the context of the application?

This is one difference between junior and more experienced engineers. Junior engineers know what they meant when they wrote the code, but often forget to consider their teammates or future selves.

ethanwillis3 replies#
The difference is that self-documenting code is bad. Code isn't documentation for humans. Documentation is documentation for humans.

One comment right above this that gives a direct example of what x "is", is easier to understand. And then the structure of this line is also easier to understand more quickly than the second example.
Is this bad?

  // A tuple defining an item with a status. (item-name (status-key status-value))
  val x: Pair>
But even knowing what x "is" either with documentation or with verbose "self-documenting code" it still doesn't answer your question of "how this code should be used in the context of the application"

Do we save x somewhere? Do we fetch something from somewhere else based on status-key? None of this is known. You get that from description, you get that from surrounding context. Except if we write all of our code like the second example then when we start reading the surrounding context it's going to be more painful.
We're hiding the structure with extra verbosity in the pursuit of not having to write documentation or use the best tool we have for communicating with other humans... natural language.

stirfish4 replies#
>The difference is that self-documenting code is bad. Code isn't documentation for humans. Documentation is documentation for humans.

Surely you're joking? Code is meant to be read by humans. The comment above your single-letter variable doesn't count - just give it a proper name and use the type system.

Continue this thread — 4 replies

john_fushi1 reply#
> val x: Pair>

This just describes the structure. Structure without intent is useless.
Comments and out of code documentation both have the same problems : - Blindspots - Rot
That is not to say they are useless, but they are rarely if ever sufficient.
In the end, the most complete and trustworthy source of truth for the code is the code itself.
Help others by having your code describe your intent. Using appropriate variable name and using appropriate types _help_ to keep displayed intent in sync with reality.
Another point to consider is that for the same intent the structure may need to change, to evolve. Proper typing can insulate the code from those changes.

Continue this thread — 1 reply

phailhaus4 replies#
What happens when you pass that variable around? Imagine looking at a function that takes "Pair>". What the heck is it?

Well, since we decided to use opaque types, we now have to do a bunch of spelunking. We have to grep around for usages and trace that parameter alllll the way back to where it was defined in order to find that "useful" comment. Or, we could just use better types!

Continue this thread — 4 replies

tjrDL6MjB2Zwwa#
both snippets suffer from being stringly typed, that is not what is being discussed. Change the string types to something else mentally if it bothers you that much.

It was an example.

tjrDL6MjB2Zwwa#
No way, the first one I understood the intent with a single pass, the second one had me jumping across all 3 lines to understand.

Succinctness is a virtue when used correctly.

Olreich1 reply#
Which of these is better is a matter of distance and scope. If x is only used locally and within a screen or two of the declaration, adding a data structure screens or files away will make things harder to parse. If x is used in many places, passed around to many functions, or is otherwise far away from where it’s needed, it should be replaced with something that has better naming and more robust structure. If it’s the latter, you should rename it away from x as well, as the name of the variable is the first thing that should get documented as you increase distance. If you have a `Status` type already, then you should use that even if X is hyper-local.

Of note, the nesting here seems suspect, why not use a three item tuple or a flattened data class? In many cases I find where people start arguing about naming or abstraction, there’s a way to simplify things further so it’s readable for everyone and easier to use inline. I always look for those now when I’m reaching for “you should rename this” or “you should restructure this” kind of comments.

joelfried#
I think you're missing the forest for the trees here somewhat. What I believe GP to mean is that rather than use written out names and data structure layouts that make code easy to digest for others on the team, some folks choose code that makes their personal mental models easy to construct. This can be extremely valuable, but is also very bespoke and difficult to maintain.

I completely agree with your last point regardless: those kinds of arguments honestly held between well meaning team members are definitely a strong indicator that the implementation used is mismatching the use case at some level.

gptgpp#
Hmmm, I don't know about this example.

I'm kind of a certified idiot and the first one seems way more intuitive than the second one because it is succinct with much less abstraction. It's easier to "keep in my head" than the second one for me and, again, I cannot stress enough that I am not a clever man.

lawn2 replies#
Yeah, I see the people OP describes as clever but not wise (and thus not smart).

And I've been one of them, and I now try to avoid complexity if possible and try to make peace with the fact that the smart solution is most often not the clever one.

bayesian_horse#
The word you're looking for is "mature".
icepat1 reply#
I think the main problem is the reverse Dunning Kruger effect. It can be very hard to tell what's not obvious to another person when the entire thing is self-explanatory to you.

The two most intelligent people I know write code that works incredibly well, but you can tell it was coded out in one shot based on an idea they had. Makes it difficult to read, but to them it "just makes sense".
A really good friend of mine is like this. When I read over his code, it's highly compact, and makes use of language features that are pretty obscure. The stuff he builds out addresses problem I would never have thought of. But the catch is I can't follow, or understand half his code.
Sometimes though, there's an advantage here. Someone like that can get all the ideas out "on paper" (so to speak), then pass it off to someone who can make it legible for everyone else. There's a lot of value in someone like this, but you need to pair them up with the software equivalent of an editor. You'd be surprised, some people enjoy doing that!

tjrDL6MjB2Zwwa#
To quote Dennis Ritchie.

"I can't read German, does that make it unreadable?".
Or to put it another way, we don't criticize James Clavelle's novel Shogun because it's difficult for a 10 year old to understand.

ilyt1 reply#
> I can't directly speak to any particular work you're describing, but "smart" people don't usually add significant complexity and aren't hard to work with.

I feel that's really unrelated to how "smart" person is. It's more due to experience when you start to appreciate the simplest approaches to solve the problem.
Many people chase some new and cool features and want to use them just because it is more interesting that clapping out boring code day in day out and that's where you get those overly clever blocks of code. I've seen every level of competence fall into it. Hell, I suspect like 3/4 of k8s and related deployment are exactly that, devs bored and wanting to play with new toy.

rubyfan5 replies#
To build on your comment…I think picking simple or anti-complexity is a values call perhaps enabled by emotional intelligence and being secure in who you are.

I have met many people whose identity is wrapped up in being smart. When faced with choosing a clever solution or an understandable solution they will choose the former. This is where preserving their identity outweighs empathy for you or even for themselves. Some people also like to be the hero. If they are the only ones who get the solution then they are more likely to be the hero to fix it in some future moment of need.

Continue this thread — 5 replies

Continue this thread — 3 more replies