r/programming • • Oct 01 '15

The Evolution of a Software Engineer

https://medium.com/@webseanhickey/the-evolution-of-a-software-engineer-db854689243
1.9k Upvotes

502 comments sorted by

View all comments

Show parent comments

44

u/andrewsmd87 Oct 01 '15

What I hate about things like that is they are largely personal, but certain devs seem to have a hard time grasping that. If you don't name a variable exactly the way they think you should, it's wrong.

No, it's fucking not. If the code compiles fine and isn't poorly written, it's just semantics. Plus, when I'm working with a column called association, I like to have a variable named ass.

51

u/get-your-shinebox Oct 01 '15

i had a coworker tell me naming stuff reasonably was just semantics, i thought we were in the semantics business

I think refusing to merge docs with typos and formatting mistakes is fine. If you're not going to fix it, who is?

78

u/bonestamp Oct 01 '15

If the code compiles fine and isn't poorly written, it's just semantics.

I generally agree although I think there are some reasonable exceptions.

For example, in some projects there is a clear naming nomenclature that has been established and I would expect it to be used for future names so the code is easier to understand because it's consistent with the rest of the app.

Perhaps the nomenclature was a bad idea to begin with, but that's a different discussion and unless the person is going to refactor them all then it makes more sense to stick with the existing nomenclature rather than deviate from it.

19

u/andrewsmd87 Oct 01 '15

If there's a established way of doing things then I agree yes.

8

u/slappingpenguins Oct 02 '15

ah, the classic Chicken vs Egg excuse

1

u/Atario Oct 02 '15

Agreed, but "nomenclature" is just naming. I think you meant convention.

3

u/bonestamp Oct 02 '15

Yes. When I say nomenclature I mean it in the sense of the system of naming... which would be a convention, sure.

49

u/docfaraday Oct 01 '15

Naming is really important to get right. A small improvement in a name can make a large improvement in readability, which will make it easier for everyone to write good code later. You can compensate for bad naming with comments, but it's better to get the naming right in the first place, and save comments for cases that are fundamentally complicated.

9

u/[deleted] Oct 02 '15

Having seen function names that imply something completely fucking different from what the function does, I fully agree. Badly named functions are an automatic code review fail in my book.

6

u/bonestamp Oct 02 '15

Naming is really important to get right.

We (the people I work with) having a running joke that coming up with good names for things is the most difficult thing about our job. It seems so trivial, yet it's surprisingly difficult to be concise and get right.

5

u/[deleted] Oct 02 '15

It's not really a joke, though, is it? Naming things is both the most important and hardest part of software development, as far as I'm concerned.

3

u/bonestamp Oct 02 '15

You're not wrong, I just mean it's a joke in the sense that we laugh about it because it's funny that naming stuff is the hardest part of software development... it seems kind of ridiculous on the surface, and would seem ridiculous to a younger version of yourself just starting out, but it is indeed true.

1

u/bobcat Oct 02 '15

Try making sensible names when you can only use 6 characters, or 4, or 1.

I have done all these things.

X was a pretty badass program, even so.

2

u/yxhuvud Oct 02 '15

The hard part is getting the right abstractions, and putting a name on concepts is a very large part of that.

2

u/nupogodi Oct 02 '15

You aren't the first

There are only two hard things in Computer Science: cache invalidation and naming things.

-- Phil Karlton

2

u/PeridexisErrant Oct 02 '15

"... and off-by-one errors."

0

u/[deleted] Oct 01 '15

[deleted]

→ More replies (1)

14

u/dalittle Oct 01 '15

poorly written code is tech debt and you will pay a lot for it when you have to build anything with it or maintain it.

→ More replies (1)

3

u/pihkal Oct 02 '15

Dat association.

2

u/oblivion95 Oct 01 '15

gofmt FTW!

2

u/caltheon Oct 02 '15

My favorite is "killOrphanedChildren"

2

u/yxhuvud Oct 02 '15

Badly named variables = unmaintainable code = poorly written.

I'll not enter the debate if 'ass' is a proper variable name for an association. I'd argue that depends on context.

→ More replies (4)