Live data from Hacker News

Code Runs on People

rachelbythebay.com

21–30 of 35 posts

Re: Code Runs on People

#21
post #2

I find this kind of exhortation to be useless in practice, because while everyone agrees that code shouldn't be too clever, no-one agrees on what kind of code is being too clever. For example, I'd argue that using C/C++ at all is probably "too clever" - humans are good at simulating the happy path, but very bad at simulating all the possible different ways such code might actually be executed. But all too often peopl…

If building something new, there are good alternatives to C/C++ that end up being more manageable for the human writing it.

That said, if you're stuck with C/C++, there are still many grades of complexity within that that can be tackled. Write boring code, instead of writing something complicated to save a few lines of code.

Re: Code Runs on People

#22

One person's too-clever code is another person's attempt to prevent O(N^2) lines of unmaintainable noob code from being added. Problem is, I've seen people with years of experience put this crap in. When you show them how much better it can be, they don't tend to take it well. It implies they're not the "senior engineers" their resumes claim.

They really aren't if they can't take criticism and feedback on board, or can't see how their code is objectively bad.

Senior is just a job title / pay grade, it does not mean someone is a good developer. Thankfully I've never had a label like junior/medior/senior attached to me, because while I have plenty of experience I don't think the job descriptions for senior developers applies to me. Probably impostor syndrome but still.

Re: Code Runs on People

#23

I agree with the larger point being made, but equally I’m getting a bit tired of statements like these: > “ If it takes an hour to figure out what's going on, well, that's an hour that wasn't spent doing something else more useful and interesting.” What exactly is “doing something else more useful”? As a software engineer your main job (yes I know talking to stakeholders and blah) is to write and to read code. If as…

> If as a software developer you optimise for writing as little code as possible and not having to spend much time reading code either then what exactly are you working on? Minimizing code read/written _per unit of work_. The less code you have to work with for a particular task, the more tasks you can accomplish in a fixed time frame. I'd much rather read and understand three tasks in an hour than only one.

It still doesn't add up to me. I take your "less code" as more terse and straight to the point code, which would go towards "clever" code instead of long, verbose and "simple" code. Which would go against most of what she rants about.

Re: Code Runs on People

#24
This feels all over the place.

Is she ranting against "clever" code ?

Or is it about "wicked, nasty, complicated, Klein-bottle-wannabe tricks", which wouldn't fit a "clever" category IMO ?

But she mentions "how far they read into the spec", so these are language features she doesn't know about ?

Oh, but "Nobody will ever have more state about the code than the original author" so it's not about syntax or tricks, but code states and complexity ?

What is there to take from this rant aside from her not liking her coworkers' code each in every possible ways ? I am really not sure to get it.

Re: Code Runs on People

#25
post #4
post #2

I find this kind of exhortation to be useless in practice, because while everyone agrees that code shouldn't be too clever, no-one agrees on what kind of code is being too clever. For example, I'd argue that using C/C++ at all is probably "too clever" - humans are good at simulating the happy path, but very bad at simulating all the possible different ways such code might actually be executed. But all too often peopl…

Yeah, I agree, it's the old complex/complicated conundrum. What's easier: a super compact representation of the problem that uses high-level concepts, or a verbose listing of dumb procedural code? Chances are it depends on both who you ask and the problem at hand.

I once read a HN comment the made an analogy to reading levels in a newspaper or other natural language. I found this very apt.

If you have a rich vocabulary and so does your audience, you can explain an idea succinctly. Imagine a chain of function compositions in one line, very declarative. You grasp it near immediately or else its very difficult.

If you don't, you use simpler words and need more of them. Imagine a few nested for loops in something like Go that you need to execute in your head to realize what's going on, but anyone can figure it out given a little time.

People frequently talk past each other on this topic. It can be very frustrating.

Re: Code Runs on People

#26
post #2

I find this kind of exhortation to be useless in practice, because while everyone agrees that code shouldn't be too clever, no-one agrees on what kind of code is being too clever. For example, I'd argue that using C/C++ at all is probably "too clever" - humans are good at simulating the happy path, but very bad at simulating all the possible different ways such code might actually be executed. But all too often peopl…

I think “too clever” often equates to “too short.” There is real intellectual pleasure in figuring out how to express an algorithm in as few lines as possible. I personally love doing this. And, usually, shorter code is better code. But I have seen many cases where people take this too far. People reduce their code so much that it becomes incomprehensible. (No doubt I have been guilty of this.) So to your question of…

"We're not a development shop"

OK, so I've inherited a Single File App with multi-screen a multi screen main() function. I can tell what it's doing at a glance, except that there is a bug report, and something may be wrong.

First instinct "make the problem smaller". But how?

People who put effort into avoiding effort frequently succeed in moving effort.

Re: Code Runs on People

#27

This feels all over the place. Is she ranting against "clever" code ? Or is it about "wicked, nasty, complicated, Klein-bottle-wannabe tricks", which wouldn't fit a "clever" category IMO ? But she mentions "how far they read into the spec", so these are language features she doesn't know about ? Oh, but "Nobody will ever have more state about the code than the original author" so it's not about syntax or tricks, but…

The article was a meditation on the Keep It Simple, Stupid (KISS) principle.

My grief is that, given time constraints, I'll put in a list comprehension rather than an explicit loop, where appropriate.

Am elevating the task above n00b level? Sure. Welcome to the real world.

Re: Code Runs on People

#28
> Nobody will ever have more state about the code than the original author at the time of creation.

I would add "including myself". It always happens when I go back to old code, even if it's my own code.

It's not that I don't understand my own code, or the lack of comments. But while coding (at least it happens to me) I have a global awareness state of what is going on, what's missing, what's failing, where I want to go, etc. You are plugged.

Losing and recovering that state is pretty hard and that's why (long) interrupts are so annoying.

A simpler language like C helps me recovering that state quickly. A mess with templates or 1000 levels of abstraction takes way longer.

Re: Code Runs on People

#29
post #18
post #8

Earlier quoted context omitted.

it's a workaround for a lacking type system

Sounds like that it's more a workaround for lacking a proper macro system.

How is a straightforward solution to some development problem (create multiple language entities, like enum + data tables, from a single point of definition in the source code) a workaround for some lacking thing?

Maybe you could clarify by posting a better version of what GGP suggested.

Re: Code Runs on People

#30
post #2

I find this kind of exhortation to be useless in practice, because while everyone agrees that code shouldn't be too clever, no-one agrees on what kind of code is being too clever. For example, I'd argue that using C/C++ at all is probably "too clever" - humans are good at simulating the happy path, but very bad at simulating all the possible different ways such code might actually be executed. But all too often peopl…

Actually, I am a big fan of C++ code. Smart code may cause problems and I agree with that. You know what else causes problems? Tool churn and language churn. At any time of the night and day I very much prefer figuring out somebody elses smart code than figuring out yet another tool that we apparently need. It may not necessarily be that one thing wastes more time than the other but I am 100% sure where my preference is as far as what kind of problem I like to work with.
Post reply on HN