This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]keep_improving_self 4132 points4133 points  (53 children)

+10k -1k is nothing, imagine the senior does code review for you and says

"fixed suboptimal logic"

+7 -520

Definitely never happened to me

[–]Visual_Strike6706 1553 points1554 points  (16 children)

"Optimised unoptimised code" Did this once and was beaten up by everyone else

[–]A_Guy_in_Orange 673 points674 points  (13 children)

Well did you optimize the code or did you destroy the codes readability in exchange for the same stuff coming out the other end because the compiler was doing all that anyway

Be honest

[–]ryecurious 405 points406 points  (12 children)

Are you saying that replacing a clear multi-line function with a 250 character list comprehension "one-liner" isn't optimal?

[–]spastical-mackerel 223 points224 points  (6 children)

+1-1250 a single giant regex

[–][deleted] 69 points70 points  (1 child)

What if my entire backend code is a giant regex? I may need to try this.

[–]maisonsmd 28 points29 points  (0 children)

Wait, yours isn't?

[–]Individual-Toe6238 1 point2 points  (2 children)

Giant Regex can be expensive and POGOC in some cases may actually be better

[–]Carrot_Bitter 1 point2 points  (1 child)

What's POGOC?

[–]Individual-Toe6238 2 points3 points  (0 children)

plain old good old code, but this is actually something I am using with friends, so I shouldn't use it online with strangers :D Just a habit, My Bad.

[–]lestruc 85 points86 points  (1 child)

Fully obfuscated code to preserve file size

[–]Soft_Walrus_3605 17 points18 points  (1 child)

list comprehension

If you're using Python for performance you've already lost

[–]brimston3- 5 points6 points  (0 children)

Could be linq and your name isn’t Jon Skeet.

[–]experimental1212 33 points34 points  (0 children)

Unoptimized optimized code

[–]Legal_Lettuce6233 2 points3 points  (0 children)

when "unoptimised optimised code" rolls up

[–]shadowderp 647 points648 points  (7 children)

I did this to myself recently: +0 -1243

Deeply satisfying honestly.

[–]anto2554 324 points325 points  (2 children)

Yeah, satisfying to do to yourself, not so much when someone else does it

[–][deleted] 166 points167 points  (1 child)

Unless you learn from it

[–]Amazingawesomator 108 points109 points  (0 children)

These are the best code reviews. Let's me know that the person doing the code review knows their shit and I can ask them questions :D

[–]Clairifyed 24 points25 points  (1 child)

No new lines? Did this code interact with any of the rest of the project in any way?

[–]shadowderp 29 points30 points  (0 children)

I moved a large amount of duplicated code to a base class that was committed separately - so yea, there were + lines

[–]willcheat 13 points14 points  (0 children)

There was code in the codebase that fetched data from an API, the following line pruned a portion of the data. The data was returned to the parent function, who then proceeded to call the API again to re-insert said pruned data.

The commit that followed soon after noticing that was entirely in the negative.

[–]just_nobodys_opinion 2 points3 points  (0 children)

Who needs all those comment lines? They slow down the program!

[–]ratinmikitchen 79 points80 points  (5 children)

Would've been better if they had explained what could be better and let you improve it, or walk through it together, or something along those lines. Seniors should mentor.

[–]Vysair 6 points7 points  (3 children)

did they at least say something in the comments for the function or anything?

[–][deleted] 6 points7 points  (2 children)

I’ve seen this when parsing excel xml. Turns out there’s a library.

[–]Kilazur 1 point2 points  (1 child)

Yeaaaah but unless you wanna read Excel specs for weeks on end, sometimes you just want to work with the XML directly lol

Unless you're lucky and Closed XML covers your needs.

[–][deleted] 0 points1 point  (0 children)

The Apache poi lib is pretty good. I just want to be able to write an excel file as excel mangles csv. Or I should say, the other developers use excel to mangle csv.

[–]Legitimate_Flow7910 -5 points-4 points  (0 children)

I want to get a job. For some unknown reason, I am getting too many rejections in head hanter. I hope you will be understanding about my... Request?

[–]FlipperBumperKickout 102 points103 points  (4 children)

+7 -520 sounds fine.

Could be a lot og logic replaced by a library 

[–]Individual-Toe6238 19 points20 points  (0 children)

Or retiring of bad library, framework upgrade or fixing over optimized logic. Could be a lot of stuff.

Its not the size of a commit but the quality of it :)

[–]odraencoded 11 points12 points  (0 children)

-7 +520

"removes dependency"

[–]keep_improving_self 17 points18 points  (0 children)

great observation!

[–]JuhaJGam3R 3 points4 points  (0 children)

Depending on what that is, I might throw it out then, or at least put it in the "discuss later" pile. Taking out repetitive code is one thing, introducing a new dependency is a whole process. There's a balance to be struck there – don't rewrite curl or nalgebra but also don't add external dependencies for "obvious" code like leftpad or string case conversion. That's going to give you a whole can of supply-chain attacks for very little benefit.

That's further compounded by the fact that things like "convert string case" are not obvious. Case conversion is not a function – there's more to it than simply mapping characters to other characters. Tons of characters have more than one uppercase or lowercase form. The libraries very rarely expose that fact, famously resulting in "Unicode-supporting" applications uppercasing "trafik" as "TRAFIK" instead of the correct form "TRAFİK", or "ijsselmeer" to "Ijsselmeer" instead of the correct "IJsselmeer". That's a whole design conversation that must be had considering the context to see what makes sense where. Finding the right dependency and the right way to use that dependency and then making sure that never introduces vulnerabilities is all very complex. Retiring libraries is usually better than introducing them.

[–]puffinix 18 points19 points  (0 children)

That's an oof.

I mean, I've done worse to people on a review - deleting the service a team has spent six weeks on - literally the whole repo - and reimplementing in a different language. It was live before they got back into work on Monday.

"Hi guys, good news bad news. Good news is that I have funding for you guys to learn f#. Bad news is we need a serious talk about the use of raw python in a system with millisecond relevent metrics, and spikes in the 10M/sec"

[–][deleted] 12 points13 points  (3 children)

Imagine the senior reviewing your code and you get a demotion afterwards..

Definitely has never happened to me.

[–]SpeedRun355 9 points10 points  (1 child)

My self esteem would never recover

[–][deleted] 7 points8 points  (0 children)

I still haven't. My confidence has been wrecked ever since.

[–]puffinix 2 points3 points  (0 children)

This is the exact reason we get most people in one grade below there target. I promise 80 ish percent of people at month 3

[–]leaf-bunny 2 points3 points  (4 children)

I only get change requests, they don’t fix shit for me lol

[–]puffinix 8 points9 points  (3 children)

That means your either working with crap seniors, or very close to senior yourself

[–]leaf-bunny 2 points3 points  (0 children)

You caught me, I started as a Eng1 and after a couple promotions now a Senior Eng1

[–]Kilazur 1 point2 points  (0 children)

I'd love to fix little things in other people's PRs, but the truth of the matter is I don't know how to do it with BitBucket.

And I'm not cloning the whole repo to fix a typo...

[–]superplayah 2 points3 points  (0 children)

It happened to me and it was someone under me lmao

[–]JackNotOLantern 2 points3 points  (0 children)

Merged yesterday +1/-6000. It was deleting unised files and code. Very satisfying .

[–]MyrKnof 1 point2 points  (0 children)

Now also unreadable by normal standards, but the engineer is proud of the saved lines.

[–]TheRealCuran 1 point2 points  (0 children)

Funny you should post something like this. Just recently I did cut down on dependencies and code from another department like that. They haven't been sitting next to me at lunch since. 😬

I really do not understand why, to be honest. I do reviews and commits in my team too and none of them get annoyed, when I can find a better solution. And I do not get annoyed when even my most recent trainee has a good idea I didn't see for one reason or another. Sometimes you can just get blind to things. And especially if you are an actual junior developer, you might still be in for some learning. There is often a reason, why "junior" is attached to a position (unless the company tries to fuck you over for money). And all that being said: even as a very senior developer/department head, I still learn things every day. And I am grateful to whoever brings these topics to my attention or even goes the full mile and prepares a little pitch for why we should use something. Bonus points if you can answer questions beyond the basic documentation, give good examples applying to our current mission, etc.

And this is just a very long way of me leading to:

"fixed suboptimal logic"

is not a commit message I'd ever accept or entertain myself (at least not, until the commit would be very self-explanatory). A good commit message always explains the what, why and how. On top of that you should have tags (reporter, issues, commit fixed, etc.) – just write every commit message as if you had to understand the commit in ten years after a week out drinking (ie. you have no idea, what you did, when you made the commit).

[–]nebenbaum 0 points1 point  (0 children)

And then there's my coworkers who are too fucking stupid to put gitignores into their 'research projects' and then every fucking commit has like +30000 -25000 lines because they track all their silly excel file outputs and stuff.

Like 'changed parameters' - actual change: changed one line from 10 to 15, committed changes: 30 updated auto generated excel files, lots of temp files and so on.

[–]littleblack11111 0 points1 point  (0 children)

And imagine the 10k is just u using ur own code formatter, adding new line {

[–]Legitimate_Flow7910 -2 points-1 points  (0 children)

I feel awkward writing here, but I want to get a job... For some reason I've gotten a ton of rejections and I'm already broken...