News for hackers. Stuff that matters.
Re:Spending 3 months investigating a 7-year old bug and fixi... by TehShrike on Friday June 21, 2024 @11:05AM (#40750399)
I particularly liked this part:

> Knowing very little about USB audio processing, but having cut my teeth in college on 8-bit 8051 processors, I knew what kind of functions tended to be slow. I did a Ctrl+F for “%” and found a 16-bit modulo right in the audio processing code.

That feeling of saving days of work because you remember a clue from previous experience is so good.

Re:Spending 3 months investigating a 7-year old bug and fixi... by djoldman on Friday June 21, 2024 @11:45AM (#40750763)
Those are the times one gets the opposite of imposter syndrome.
Re:Spending 3 months investigating a 7-year old bug and fixi... by ASalazarMX on Friday June 21, 2024 @01:07PM (#40751553)
Fortunately it's a temporal state, otherwise there's risk of entering the Dunning-Kruger effect.

"You did awesome, but don't let it go to your head."

Re:Spending 3 months investigating a 7-year old bug and fixi... by dylan604 on Friday June 21, 2024 @02:44PM (#40752406)
F-that! That's one of those times where I re-enact the scene from the Bond Golden Eye film where the guy jumps up extending both arms yelling "Yes! I am invincible!" Of course I totally expect the hubris to be short lived, just maybe not with liquid nitrogen

https://www.youtube.com/watch?v=fXW02XmBGQw

Re:Spending 3 months investigating a 7-year old bug and fixi... by squigz on Friday June 21, 2024 @03:12PM (#40752674)
I alternate between "I am the best programmer to ever exist" and "I am completely incompetent at this and I should quit" while debugging.
Re:Spending 3 months investigating a 7-year old bug and fixi... by dylan604 on Friday June 21, 2024 @03:35PM (#40752870)
I've been known to inform people that the person that wrote the incredibly horrendous code that caused whatever problems to occur should be fired immediately knowing good and well that I was the only dev to write any of the code.
Re:Spending 3 months investigating a 7-year old bug and fixi... by dmd on Saturday June 22, 2024 @08:56AM (#40758813)
me, yesterday: What absolute piece of shit asshole wrote this shell script? my wife: Was it you? me: Well obviously
Re:Spending 3 months investigating a 7-year old bug and fixi... by dctoedt on Saturday June 22, 2024 @09:37AM (#40759054)
> my wife: Was it you? me: Well obviously

"Research shows" (I read long ago) that the happiest men are those take their wives' advice — that's certainly been true for my own N=1, for coming up on four decades now. I'd imagine we could replace "wives" with "spouses" and get comparable results.

Re:Spending 3 months investigating a 7-year old bug and fixi... by Angostura on Saturday June 22, 2024 @12:21PM (#40760136)
> I'd imagine we could replace "wives" with "spouses" and get comparable results.

Haven’t you just risked an infinite loop in your code?

Re:Spending 3 months investigating a 7-year old bug and fixi... by dctoedt on Saturday June 22, 2024 @02:32PM (#40761095)
Hah! I was referring to some men having husbands these days, but I take your point!
Re:Spending 3 months investigating a 7-year old bug and fixi... by saagarjha on Friday June 21, 2024 @07:58PM (#40755056)
Re:Spending 3 months investigating a 7-year old bug and fixi... by 9659 on Saturday June 22, 2024 @02:18PM (#40760993)
If you are honest, it may not even alternate. Both feelings can exist at the same time.
Re:Spending 3 months investigating a 7-year old bug and fixi... by Aerbil313 on Sunday June 23, 2024 @05:31PM (#40770741)
I prefer "Why did I need to see this subtlest detail to resolve the bug, modern software sucks" and "Why do we not have better tools that would have prevented me from writing this bug in the first place, modern software sucks".
Re:Spending 3 months investigating a 7-year old bug and fixi... by brailsafe on Friday June 21, 2024 @07:37PM (#40754962)
This is very true, and we need these moments. Lately I've been struggling to figure out where my place is, how to maybe get back into freelancing, what I'm technically good at etc... lots of ruminating since I've been out of work for a year.

But.. I met someone at the gym who's been struggling with an esoteric problem on an ancient piece of software for over a decade, and they approached me to ask if I could solve it. I said "maybe", sat on it for a few days, and then replicated the issue on my machine and solved their problem in about an hour. I asked for $50 and they gave me double, which was wildly more rewarding than being paid $100k to write react all year, not that that salary is on the table any longer.

Re:Spending 3 months investigating a 7-year old bug and fixi... by manmal on Saturday June 22, 2024 @10:34AM (#40759406)
> not that that salary is on the table any longer

Is the job market so bad right now? I‘m in a privileged position (and not in the US), so have no clue of the state of things.

Re:Spending 3 months investigating a 7-year old bug and fixi... by brailsafe on Saturday June 22, 2024 @04:30PM (#40761935)
I'm in Canada, but yes it's that bad.
Re:Spending 3 months investigating a 7-year old bug and fixi... by 9659 on Saturday June 22, 2024 @02:17PM (#40760984)
$50 for a one off thing, for a gym buddy is fine. in the blue collar world, that would be a 'case of beer' for helping me out.

But in business, you need to charge an honest / fair amount. (sure, sometimes that 1 hour bug fix had $100K of 'value', but we could argue about honest / fair).

You mention being an employee at $100K a year. Double that, gives you a contractor rate of $100 an hour. That is the floor of what you should be asking floor; as in the absolute lowest. Another $50 or $100 an hour is still fair and honest in todays economy.

Re:Spending 3 months investigating a 7-year old bug and fixi... by justinclift on Saturday June 22, 2024 @08:01AM (#40758417)
There's an opposite to imposter syndrome?
Re:Spending 3 months investigating a 7-year old bug and fixi... by Jcowell on Saturday June 22, 2024 @04:04PM (#40761728)
Yes the kids these days call it being “Him” (or whatever third person singular pronoun you may refer to)
Re:Spending 3 months investigating a 7-year old bug and fixi... by sn9 on Saturday June 22, 2024 @07:11PM (#40763099)
The term that came to mind was being "cracked".
Re:Spending 3 months investigating a 7-year old bug and fixi... by justinclift on Sunday June 23, 2024 @02:02PM (#40769295)
Not sure how being crazy is supposed to be the opposite of imposter syndrome?
Re:Spending 3 months investigating a 7-year old bug and fixi... by sn9 on Friday June 28, 2024 @07:08PM (#40826299)
Re:Spending 3 months investigating a 7-year old bug and fixi... by aodonnell2536 on Sunday June 23, 2024 @01:08PM (#40768894)
Not really a new phenomenon, though. People have been been calling others “The Man” for ages
Re:Spending 3 months investigating a 7-year old bug and fixi... by nikanj on Friday June 21, 2024 @11:52AM (#40750814)
This essentially is why senior engineers get much bigger salaries
Re:Spending 3 months investigating a 7-year old bug and fixi... by mulmen on Friday June 21, 2024 @01:37PM (#40751862)
As a total newbie I saved my company a quarter million dollars in Oracle licensing in a single afternoon by rewriting a PL/SQL function. That change was a few lines of SQL. Seniors don’t have a monopoly on good ideas.

Salary is driven by market conditions and nothing else. It is not an approximation of merit or even delivered value.

Re:Spending 3 months investigating a 7-year old bug and fixi... by close04 on Friday June 21, 2024 @02:05PM (#40752117)
Statistically speaking a senior (more experienced) engineer is more likely to consistently deliver time saving results, while a junior is more likely to occasionally do it, if ever.

Proving it’s not a one time thing is what pushes you in the salary and seniority ranking.

Re:Spending 3 months investigating a 7-year old bug and fixi... by nashashmi on Friday June 21, 2024 @03:26PM (#40752790)
Senior engineers have less opportunity to write time consumingly careful code because they get paid so much. Much easier to throw new great hardware at it.
Re:Spending 3 months investigating a 7-year old bug and fixi... by fifilura on Friday June 21, 2024 @05:30PM (#40754034)
Senior engineers have less time to write code period.

And this is what saves the day.

Code is a liability.

Re:Spending 3 months investigating a 7-year old bug and fixi... by JonChesterfield on Friday June 21, 2024 @06:27PM (#40754517)
The corporate structures that reward people who prove especially good at building the product with more meetings and less time building the product are perhaps not optimal in their deployment of resources.

Maximising the fraction of the product built by people who don't know what they're doing would however explain the emergent properties of modern software.

Re:Spending 3 months investigating a 7-year old bug and fixi... by dgfitz on Friday June 21, 2024 @06:34PM (#40754558)
Senior engineers can write time-consuming, careful code efficiently. This is why they are seniors.
Re:Spending 3 months investigating a 7-year old bug and fixi... by stavros on Friday June 21, 2024 @05:55PM (#40754248)
This is laughably false. The highly-paid, experienced seniors produce so much more value than juniors that it's not even in the same ballpark. It's also usually the kind of value that juniors don't even notice, because it's not measured in lines of code.

A good junior will write a hundred lines of code in a day. A good senior will delete a hundred because they realize the user dictated a solution instead of detailing their problem, asked them, and figured out that they can solve that problem by changing a config variable somewhere.

Re:Spending 3 months investigating a 7-year old bug and fixi... by mewpmewp2 on Friday June 21, 2024 @06:59PM (#40754711)
Yes, but they don't get paid as many times as junior engs compared to how many more times value they bring.
Re:Spending 3 months investigating a 7-year old bug and fixi... by klabb3 on Friday June 21, 2024 @09:56PM (#40755556)
Violent agree on variance in value produced. Violent disagree on that junior, senior or other titles or roles have such strong correlations. For very simple reasons: we can’t measure value, and we absolutely can’t measure value within a performance review cycle.

The most devastating value destruction (aside from the rare intern deleting the prod db) that I’ve seen consistently is with senior/rockstars who introduce new tech, takes credit, moves on. There’s a reason for the term resume driven development. Think about what a negative force multiplier can do for an org.

Re:Spending 3 months investigating a 7-year old bug and fixi... by stavros on Saturday June 22, 2024 @03:24AM (#40757134)
I don't know, I think where I work we have a pretty good idea for the value each person brings. I don't know how much they're paid, but I do know how good each person is (including whether they tend to complicate things, to use exciting technologies, etc).

Maybe it varies per company.

Re:Spending 3 months investigating a 7-year old bug and fixi... by mulmen on Saturday June 22, 2024 @05:12AM (#40757577)
> I don't know how much they're paid

But that’s the entire point you’re missing. The pay is not proportional to contribution or technical skill. It’s proportional to market forces and negotiation skill.

Re:Spending 3 months investigating a 7-year old bug and fixi... by stavros on Saturday June 22, 2024 @08:57AM (#40758819)
I know what level each of our people is, and levels are compensated fairly evenly. The fact that I don't know exact numbers doesn't mean I don't have a proxy.
Re:Spending 3 months investigating a 7-year old bug and fixi... by _rm on Saturday June 22, 2024 @08:16AM (#40758541)
How does violent agree/disagree work? Like after you conclude you agree/disagree to this internet text, do you then proceed to scream out on your balcony that which you agree with / smash up your apartment in rage, respectively?
Re:Spending 3 months investigating a 7-year old bug and fixi... by chrismorgan on Saturday June 22, 2024 @09:29AM (#40759005)
> Think about what a negative force multiplier can do for an org.

Negative force multipliers are easily remedied: just make sure you have an even number of them.

Re:Spending 3 months investigating a 7-year old bug and fixi... by atherton33 on Saturday June 22, 2024 @11:16AM (#40759663)
This totally happened on my first team.

We had a guy who would argue about everything that knew the CTO so we had to tolerate him.

Then we hired a second one and they just argued with each other all the time and the rest of the team could finally make progress.

It was awesome.

Re:Spending 3 months investigating a 7-year old bug and fixi... by bravetraveler on Monday June 24, 2024 @02:29AM (#40773055)
I have a feeling I was hired to be this second guy and I really just want to hang up my gloves, man
Re:Spending 3 months investigating a 7-year old bug and fixi... by atherton33 on Monday June 24, 2024 @02:51PM (#40779406)
Thank you for your service
Re:Spending 3 months investigating a 7-year old bug and fixi... by _rm on Saturday June 22, 2024 @08:29AM (#40758628)
It's true, not "laughably false". I've seen with my own eyes the most effective developer in a company being paid in the bottom quartile, as well as a vice versa case.

In the former case, we basically had to demand management raise his salary to the low end of his market value, over the cause of six months, until they finally gave in. It was just so disgusting to us we couldn't let it go.

The reason comes down to a skill bias - it's a different skill set to navigate other people into getting yourself a good salary, versus navigating the ins and outs of coding. The skills don't overlap, so time spent on one detracts from another.

In the end he finally got the message we kept ramming in to his head, applied to work at a brand-name tech company, and instantly more than doubled his salary. He could've done so years earlier.

This stuff is the norm. I've been a manager having eyes on salaries while also having eyes on people's performance (although unfortunately not much of a lever on the former), and rest assured it is often a very jarring experience. Like "that person should be let go immediately / that person should job hop immediately".

Re:Spending 3 months investigating a 7-year old bug and fixi... by stavros on Saturday June 22, 2024 @08:56AM (#40758810)
> instantly more than doubled his salary. He could've done so years earlier.

So it's not true, then?

The GP claims this is universally true. All I need to do is post a counterexample, and I did. Yes, there are shitty companies that try to keep salaries as low as possible, not realizing that that will lose them their best people. Don't work for those!

Re:Spending 3 months investigating a 7-year old bug and fixi... by vaylian on Saturday June 22, 2024 @08:52AM (#40758785)
> This is laughably false. The highly-paid, experienced seniors produce so much more value than juniors that it's not even in the same ballpark. It's also usually the kind of value that juniors don't even notice, because it's not measured in lines of code.

This particular case sounds like someone got incorrectly hired as a junior. Maybe they didn't have enough "real world" corporate experience and that is why they weren't offered a senior position?

Re:Spending 3 months investigating a 7-year old bug and fixi... by mulmen on Saturday June 22, 2024 @01:06PM (#40760470)
I was fresh out of college. But it’s not like that was an isolated incident or that other juniors don’t also have good ideas.
Re:Spending 3 months investigating a 7-year old bug and fixi... by johnnyanmac on Friday June 21, 2024 @06:16PM (#40754425)
Not a monopoly, but a majority. Many juniors who do have that potential don't ever get put in such a situation.

Junior/senior isn't necessarily about skill level; I'm sure many can find a senior with 1YOE ten times over. It's about trust both in technical and sociopolitical navigation through the job. That's only really gained with time and experience (and yes, isn't perfect. Hence, the aforementioned 1x10 senior. Still "trusted" more than a 1 year junior).

Re:Spending 3 months investigating a 7-year old bug and fixi... by dehugger on Friday June 21, 2024 @07:30PM (#40754926)
My view as a burgeoning senior dev is that the "senior" bit is generally less about coding and more about domain knowledge.

Understanding the business processes of your industry, how to solicit feedback from and interact with end users, how to explain things to management/sell on ideas.

If you put a junior dev in front of a panel of executives and ask them to explain requirements for a project odds are quite high they will info dump tech mumbo-jumbo. A senior should be able to explain risks, benefits, timelines, and impacted areas of the business in a manner that non technical people can easily grok.

Re:Spending 3 months investigating a 7-year old bug and fixi... by vsuperpower2020 on Friday June 21, 2024 @08:37PM (#40755234)
For me, "senior" just counts the amount of time they've been doing something. If someone isn't very good at something after putting ten thousand hours into it, they just might work at microsoft.
Re:Spending 3 months investigating a 7-year old bug and fixi... by truncate on Friday June 21, 2024 @09:20PM (#40755408)
>> they will info dump tech mumbo-jumbo

I'm mid-level engineer. Honestly, several staff+ engineers may not be spitting tech mumbo-jumbo, but they do dump all other kind of BS. Political BS, "tactical tornados"[1]. May not necessarily mean they were good at engineering, but just good with people skills. Obviously, not everyone is like that, but I would say many are.

[1] https://news.ycombinator.com/item?id=33394287#:~:text=The%20....

Re:Spending 3 months investigating a 7-year old bug and fixi... by skydhash on Saturday June 22, 2024 @09:02AM (#40758848)
If it will be BS, it should be understandable BS.
Re:Spending 3 months investigating a 7-year old bug and fixi... by drewg123 on Friday June 21, 2024 @03:16PM (#40752713)
If modulus is expensive, and he's checking a power-of-2, why not just use a bitwise AND.

Eg, for positive integers, x % 16 == x & 15. That should be trivially cheap.

Re:Spending 3 months investigating a 7-year old bug and fixi... by ladberg on Friday June 21, 2024 @03:23PM (#40752764)
It wasn't `x % 16` it was `x % y` where x and y are 16-bit integers. A compiler would also have taken care of it if it were just a literal.
Re:Spending 3 months investigating a 7-year old bug and fixi... by drewg123 on Friday June 21, 2024 @03:36PM (#40752887)
Whoops.. I misread what he was doing.
Re:Spending 3 months investigating a 7-year old bug and fixi... by xgkickt on Friday June 21, 2024 @08:43PM (#40755264)
Reading the comments, that's kinda what they did, though they had to learn that first and only now realize they only needed one.
Re:Spending 3 months investigating a 7-year old bug and fixi... by kevin_thibedeau on Friday June 21, 2024 @10:22PM (#40755668)
Any top-tier C compiler will optimize modular division by a constant into a more efficient operation(s). It is better to keep the intent of the code clear rather than devolve it into increasingly obtuse bit-twiddling tricks the compiler can figure out on its own.
Re:Spending 3 months investigating a 7-year old bug and fixi... by beebmam on Friday June 21, 2024 @03:46PM (#40753018)
why is this not considered a compiler optimization and/or language problem? it seems to me that compiler optimizations for expressive programming languages should be able to handle something like this
Re:Spending 3 months investigating a 7-year old bug and fixi... by JonChesterfield on Friday June 21, 2024 @06:24PM (#40754492)
What would you hope a compiler to optimise x % y into?

Higher level change-the-algorithm aspirations haven't really been met by sufficiently smart compilers yet, with the possible exception of scalar evolution turning loops into direct calculation of the result. E.g. I don't know of any that would turn bubble sort into a more reasonable sort routine.

Re:Spending 3 months investigating a 7-year old bug and fixi... by vitus on Friday June 21, 2024 @07:06PM (#40754757)
If y is always a power of 2 (as suggested in the comments), then I'd expect it to turn into an AND of some sort.

And more generally, with older architectures, integer division was much slower than integer multiplication, so compilers would generally transform this into a multiplication plus some shifts [0]. For context in that timeframe, MUL on Sandy Bridge introduces 3-4 cycles worth of latency (depending on the exact variant), compared to DIV introducing 20+ (per Agner Fog's excellent instruction tables [1]). So even computing x - y * (x / y) with the clever math to replace x/y would be much faster than just x%y. (It's somewhat closer today, but integer division is still fairly slow.)

[0] https://news.ycombinator.com/item?id=1131177 (the linked article 404s now, but it's archived: https://web.archive.org/web/20110222015211/https://ridiculou...)

[1] page 220 of https://www.agner.org/optimize/instruction_tables.pdf

Re:Spending 3 months investigating a 7-year old bug and fixi... by wizzwizz4 on Friday June 21, 2024 @07:08PM (#40754777)
> So even computing x - y * (x / y) with the clever math to replace x/y would be much faster than just x%y.

That only works when y is constant. Otherwise, you need to work out what to replace x/y with… which ultimately takes longer than just using the DIV instruction.

Re:Spending 3 months investigating a 7-year old bug and fixi... by vitus on Friday June 21, 2024 @07:14PM (#40754822)
> That only works when y is constant.

Excellent point! That said, that was the case in this particular example.

> This 16-bit modulo was just a final check that the correct number of bytes or bits were being sent (expecting remainder zero), so the denominator was going to be the same every time.

(Libraries like libdivide allow you to memoize the magic numbers for frequently-used denominators, and if on x86 you have floating point operations with more precision than you need for integer division, you can potentially use the FPU instead of the ALU: https://lemire.me/blog/2017/11/16/fast-exact-integer-divisio...)