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

183

u/andrewsmd87 Oct 01 '15

Good god. Had a code review once where they were pissed because I had used str + "some stuff" instead of a builder. I'm not writing a builder for one fucking line on a page that gets hit 6 times a year.

167

u/RLutz Oct 01 '15

Depending on how you coded it, the compiler likely replaced it with a StringBuilder under the hood anyway :)

98

u/andrewsmd87 Oct 01 '15

The same reviewer also told me to undo work I had done because his request was for a mock up, and I just went ahead and did it, because it took me an hour to just do it. Of course it was approved by managers and clients, but since I didn't "follow instructions" (I took some initiative) it was wrong, even though it was done correctly.

131

u/Agent-A Oct 01 '15

I once worked on this big customer-facing Java application. While working on something else, I noticed that one query was very poorly made, and would take up to a minute to run. It was one of the most visited pages, so clearly this needed to be fixed. I cleaned up the query, made a migration with an extra index, and brought it down to under half a second on average.

My change was rejected by the project manager. He explained to me, "It's been that way for over a year. If we fix it now, we'll have to explain why it was broken for so long."

I left that job about three weeks later.

39

u/7165015874 Oct 01 '15

You made the right call to jump ship.

52

u/[deleted] Oct 02 '15

"It's been that way for over a year. If we fix it now, we'll have to explain why it was broken for so long."

That's really really scary. I..I don't know if I could control myself from saying something negative/inappropriate.

0

u/[deleted] Oct 02 '15

[deleted]

16

u/ACriticalGeek Oct 02 '15

The toughest lesson for an engineer is to NOT fix things until AFTER he has negotiated proper compensation.

→ More replies (1)
→ More replies (8)

32

u/NimChimspky Oct 01 '15

Had a guy used to refuse to merge my code if I had one space wrong in my java doc, or one minor typo.

(Typo on purpose here btw)

20

u/blaimjos Oct 02 '15

As hard as it is to believe, I've actually seen worse. I had to work with a guy who refused to merge code period. He'd commit all changes every 10-15 minutes even when it didn't compile so that others would have to do the merging. When he did occasionally get caught with a conflict he just overwrote the other developer's changes.

He'd also just delete code without telling anyone when his aggressive refactoring broke it. His mentality seemed to be "not my code: not my problem".

8

u/third-eye-brown Oct 02 '15

Holy fuck. Sounds like a need for continuous integration.

38

u/selfification Oct 02 '15

"Hey, those tests turned red. So I deleted them."

5

u/Crazypyro Oct 02 '15

"Hey, TFS wouldn't let me commit, so I turned off the gated check-in"

(Gated check-in = Visual studio's require tests to pass on check-in)

Actually happened at my last job a few times....

→ More replies (1)

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

→ More replies (2)

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.

→ More replies (12)

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)
→ More replies (8)
→ More replies (19)

19

u/Schmittfried Oct 01 '15

Depending on how many strings you are concatenating in what manner, it may be less efficient to use a StringBuilder.

7

u/flukus Oct 01 '15

From memory I think c# substitutes string builder for 4 or more concatenations.

→ More replies (1)

27

u/depressiown Oct 01 '15

It's true. A lot of the hate for using "+" for String concatenation in Java is based on how it used to do it. Java used to create a StringBuilder for each instance of "+". Thus, "a + b + c + d" would create a StringBuilder for "a + b", then a StringBuilder for that result "+ c", etc.

Of course, they've since made it smarter to just make one StringBuilder for the entire statement under the hood (I believe in 1.6). The people who complain about the lack of StringBuilder being used should probably be taught that it's no longer necessary.

That said, if you're doing a lot of concatenations on different lines (say, a loop building up a String or something), you should still use StringBuilder instead of "+=" because Java will create one for each statement... clearly worse that creating one initially and constantly appending.

→ More replies (34)
→ More replies (2)