News for hackers. Stuff that matters.
Re:What I learned working with a senior engineer as a new grad by yodsanklai on Friday August 19, 2022 @08:01AM (#32519940)
I've noticed many of these articles about what it takes to be a good software engineer talk about code quality.

I recently started to work in a team of very senior engineers (with relatively little experience) and what I've noticed is that code quality is rarely mentioned. Everybody write "good enough" code and there's never much discussion around code quality (occasionally a few remarks in code reviews) or design.

Generally, there's very little bikeshedding on code quality and that kind of things. People are pragmatic and wants to get the work done. It also means there are trade-offs regarding code quality (also dictated by management and pressure to deliver).

The challenges are elsewhere. Prioritising, communication, relationships with colleagues, setting up roadmaps and milestones, proposing designs, solving various challenges.

Generally, I found software engineering is less and less about writing code. I'm impressed how my colleagues are good at everything. Fluent in most programming paradigms, able to debug complex production issues, do low level performance analysis and so on...

Re:What I learned working with a senior engineer as a new grad by dionidium on Friday August 19, 2022 @10:19AM (#32521277)
I used to work with a guy who took "gets shit done" to a level I'd never seen before. It changed the way I look at programming. He was actually a pretty good engineer. Wrote good-enough code. But he wasn't precious about anything and he didn't care all that much about finding the 100%-guaranteed-socially-approved-correct way to do things. What he had was an incredible ability to diagnose and fix problems quickly, strong intuition about how to architect greenfield projects, and the complete confidence of his bosses, with whom he very quickly earned a reputation as the person to go to when something absolutely needed to get done. He knew what to prioritize. He knew which parts of the code to plow through and which to take his time on. He knew exactly where in the code to start looking when a bug came in. And he knew which things were important to management and which weren't.

I learned way more from him than I ever have from the kind of peers who have opinions about how to structure every line of code.

Re:What I learned working with a senior engineer as a new grad by alexashka on Friday August 19, 2022 @11:18AM (#32522059)
He is almost certainly way above a pretty good engineer.

Nobody can quantify 'good-enough code' but everyone can quantify meeting a deadline.

How much engineering is anyone really doing anyhow - or are we calling using React to build yet another set of forms users fill out with some error handling engineering nowadays? :)

Re:What I learned working with a senior engineer as a new grad by enraged_camel on Friday August 19, 2022 @10:45AM (#32521634)
In my experience it is useful to have such people on the team, but if they make up most of the team then the codebase becomes a gigantic mess over time, and it negatively impacts everyone else.
Re:What I learned working with a senior engineer as a new grad by skrtskrt on Friday August 19, 2022 @12:10PM (#32522814)
Yep I tend to be more on the spectrum of focusing on code & architecture quality over raw productivity, and I find the "plow through it and get it done" engineer to be the perfect foil to have on my team.

Ultimately it gets done faster than it would if the whole team was my personality, but with higher quality than if the whole team was their personality.

Re:What I learned working with a senior engineer as a new grad by pablok2 on Friday August 19, 2022 @01:25PM (#32523785)
If you're lucky enough to have someone buy into a centralized code/arch strategy then this is idea, the issues arrive when the code/arch strategy isn't a hard sell for the plow engineers.
Re:What I learned working with a senior engineer as a new grad by mmmpop on Friday August 19, 2022 @11:16AM (#32522042)
Perhaps but having "that programmer that management likes" is worth 10x more than whatever mess is generally being made.
Re:What I learned working with a senior engineer as a new grad by bick_nyers on Saturday August 20, 2022 @02:06PM (#32533987)
I consider myself a plow engineer, and I definitely agree with you, a team full of people like me would descend a codebase too deep into chaos. A dance between balance of order and chaos is ideal, as too much of the other has significant negative side-effects.
Re:What I learned working with a senior engineer as a new grad by cpeterso on Friday August 19, 2022 @12:23PM (#32523007)
Fixing bad code is easier than fixing bad architecture. And if your architecture is modular and cleanly decoupled, then the bad code’s impact can be contained.
Re:What I learned working with a senior engineer as a new grad by yodsanklai on Friday August 19, 2022 @02:09PM (#32524318)
This is a good point. Modularity is the key to managing complexity. Unfortunately, I think writing a good architecture is harder than writing good code at the local level (because most developers have less experience at writing code in the large). And projects with a good initial architecture tend to diverge as developers add new features and introduce new dependencies. They often don't understand the original design and want/need to get things done quickly.
Re:What I learned working with a senior engineer as a new grad by ignoramous on Friday August 19, 2022 @10:35AM (#32521491)
If I may, you should encourage your ex team-mate to share their side of things: https://staffeng.com/stories
Re:What I learned working with a senior engineer as a new grad by opmelogy on Friday August 19, 2022 @10:49AM (#32521691)
> Everybody write "good enough" code and there's never much discussion around code quality (occasionally a few remarks in code reviews) or design.

This approach probably works out because you have senior engineers laying out a lot of the core structure and architecture for how things built. There's a tendency for newer people to tacitly adopt patterns that already exist and replicate.

However, this approach can be really problematic when you have a team that's primarily newer engineers. I've seen it multiple times and it's always the same result - productivity almost grinds to a halt over time because there are so many problems in the code base. The worst example I saw was switching teams and seeing the team velocity. We measured all the work in story points and used the exact same task as a baseline story point. The previous team with mostly senior engineers, a point took .5 days. With the new team that was started by all fresh grad engineers, a story point took a minimum of 3 days and usually bumped up to 4 days. This velocity lasted multiple years, even when the team had a much more balanced spread of senior, mid-level, and fresh grad engineers.

Re:What I learned working with a senior engineer as a new grad by pca006132 on Friday August 19, 2022 @12:00PM (#32522663)
Are you sure that the discussion should be around code quality but not architecture? I think they are quite different...
Re:What I learned working with a senior engineer as a new grad by P5fRxh5kUvp2th on Friday August 19, 2022 @04:50PM (#32525755)
In addition, I think it's the fault of management if it's all young engineers.

I've often said the difference between a senior and a junior isn't writing software successfully, it's writing software that's maintainable 5 years down the road. The only way to learn that skill is to deal with a project over years and learn the pain points that aren't immediately obvious w/i the first 18 months.

Re:What I learned working with a senior engineer as a new grad by pjmlp on Friday August 19, 2022 @08:16AM (#32520057)
Make it work, then make it pretty.

Undelivered pretty code doesn't deliver any business value.

Same applies to 100% code coverage that isn't running on customers computers.

Re:What I learned working with a senior engineer as a new grad by tpoacher on Friday August 19, 2022 @09:19AM (#32520613)
The counterpoint to this is "Rough Prototypes have a bad habit of being shipped out as End-Products". And technical debt 'does' kill products.

There's probably an optimum somewhere in the middle of each philosophy, but it's certainly not close to either extreme.

Re:What I learned working with a senior engineer as a new grad by karmicthreat on Friday August 19, 2022 @09:35AM (#32520757)
I would say technical debt is a better problem to deal with. At least the project is alive at that point and you are able to get feedback from actual users.
Re:What I learned working with a senior engineer as a new grad by Retric on Friday August 19, 2022 @10:40AM (#32521567)
> an optimum somewhere in the middle

Reasonable code isn’t technical debt. The obvious tipping point is when spending X hours now likey saves people less than X hours in the future. Which unfortunately depends a great deal on the details of the actual project involved and therefore requires experience not some universal methodology.

Re:What I learned working with a senior engineer as a new grad by pjmlp on Friday August 19, 2022 @01:27PM (#32523814)
Sure, in the other extreme they never got shipped in first place, and that marvelous piece of art ended up in a museum.

It is a balance that needs to be learnt, and a trait of seniority.

Re:What I learned working with a senior engineer as a new grad by ericmcer on Friday August 19, 2022 @10:27AM (#32521383)
It depends, if it has a bunch of nested loops and easily abstracted code but it works sure, who cares. If someone decides to store JSON as a string in the db that will work and deliver business value, but 8 months later when you want to query information in that JSON string you have a very difficult/dangerous migration due to someone just "making it work".

This philosophy less relevant in larger companies with more engineers also.

Re:What I learned working with a senior engineer as a new grad by pjmlp on Friday August 19, 2022 @11:04AM (#32521889)
One of the traits of seniority is to understand what that "it depends" means in reality.
Re:What I learned working with a senior engineer as a new grad by P5fRxh5kUvp2th on Friday August 19, 2022 @04:51PM (#32525764)
Do you know of any RDBMS's that can't take a text column and treat it as BSON?

I get your point, I just question the specific example.

Re:What I learned working with a senior engineer as a new grad by mupuff1234 on Friday August 19, 2022 @09:27AM (#32520681)
I don't care if it's pretty.

Make it work and make it as straightforward as possible.

Re:What I learned working with a senior engineer as a new grad by nsxwolf on Friday August 19, 2022 @10:15AM (#32521214)
If by "straightforward" you mean "readable" I agree. If I can read it easily, it's pretty enough.
Re:What I learned working with a senior engineer as a new grad by karmicthreat on Friday August 19, 2022 @08:33AM (#32520189)
There are a ton of people at all levels that don't get this.
Re:What I learned working with a senior engineer as a new grad by cainxinth on Friday August 19, 2022 @08:55AM (#32520375)
I think it was Judd Apatow who said “You have to give yourself permission for the first draft to be shit.”

The hardest part of making anything is getting to the minimal viable product. Editing and refining and upgrading aren’t necessarily easy, but they are typically less daunting than staring at a blank page that you need to fill.

Re:What I learned working with a senior engineer as a new grad by dinosaurdynasty on Friday August 19, 2022 @09:18AM (#32520605)
Problem is the business will often never let you improve it.

So you better not tie your self worth to the quality of the things you produce.

Re:What I learned working with a senior engineer as a new grad by vsareto on Friday August 19, 2022 @10:20AM (#32521281)
It's not a universal thing.

You can go into some interviews, say you write code just good enough to ship, and that will be a red flag to them.

You have to choose your tribe on this issue and be comfortable with the other tribe hating your style.

Re:What I learned working with a senior engineer as a new grad by pjmlp on Friday August 19, 2022 @11:03AM (#32521877)
Surely, I have given up to the pretty tribe on a couple of pull requests, as I have better things to do with my time, and it is easier to make their wishes come true than endless arguing.
Re:What I learned working with a senior engineer as a new grad by ignoramous on Friday August 19, 2022 @10:37AM (#32521511)
> Undelivered pretty code doesn't deliver any business value.

See also: https://apenwarr.ca/log/20211024 (Wants, needs, and chasm crossing).

Re:What I learned working with a senior engineer as a new grad by ChrisMarshallNY on Friday August 19, 2022 @10:37AM (#32521523)
Depends on where you are.

In the company I used to work at, code quality was a huge deal. I think, destructively so.

Nevertheless, I exercise pretty extreme code quality in my work (see for yourself[0]). It's long reached the state of "muscle memory," and I work very quickly.

As I am the person that most frequently has to go back and fix the code I write (I eat my own dog food), I write code that is what I want to see, when revisiting, six months later.

On another note, this industry considers six years to be "senior." I find that interesting.

[0] https://github.com/ChrisMarshallNY#browse-away

Re:What I learned working with a senior engineer as a new grad by yodsanklai on Friday August 19, 2022 @02:25PM (#32524464)
> I exercise pretty extreme code quality in my work

I'd say maintain good code quality on your own project is much easier than within a team. It's like living in a house with different people: not everybody has the same standard regarding keeping the place tidy and clean, and compromises have to be made.

This was one of the biggest pain point for me, moving from my own personal projects to working with other people.

Re:What I learned working with a senior engineer as a new grad by ChrisMarshallNY on Friday August 19, 2022 @03:54PM (#32525329)
This is true. Many things suddenly become much more difficult, when even one other person is involved.

Managers often neglect to take team overhead seriously.

Re:What I learned working with a senior engineer as a new grad by hellisothers on Friday August 19, 2022 @08:56AM (#32520386)
At some point your craft is good (or good enough) that progressing further on it is not moving you forward as an engineer. It is often a difficult thing to notice and a trap one can easily fall into of over-focusing on craft and not realizing you’re plateauing your overall career or skill set.
Re:What I learned working with a senior engineer as a new grad by tom-thistime on Friday August 19, 2022 @09:18AM (#32520606)
For benefit of a friend new to HN (and anyone else who might be new here): Yes, the comments and the articles are almost separate, parallel discussions. The articles can be interesting in themselves, but for purposes of reading the comments, the articles are often just kind of inspirations or writing prompts.

So, yeah, the OP doesn't even mention code quality. The comments do. That's ok. It's just how the site works.

Re:What I learned working with a senior engineer as a new grad by twic on Friday August 19, 2022 @01:33PM (#32523877)
HN maintainers should optimize page load time by just omitting the actual link to the article. The discussions would be pretty much the same.
Re:What I learned working with a senior engineer as a new grad by yodsanklai on Friday August 19, 2022 @09:23AM (#32520652)
Article start with variable names (which pertains to code quality)

> Variable names are important because they communicate to the reader what’s happening. That’s their only job in code, so it’s important to name them well. Long verbose names don't cost anything:

Re:What I learned working with a senior engineer as a new grad by johnthuss on Friday August 19, 2022 @10:00AM (#32521030)
Except in JavaScript ;)
Re:What I learned working with a senior engineer as a new grad by blueblob on Friday August 19, 2022 @10:09AM (#32521132)
And legacy c/opengl, where the variables names tell you the return type...
Re:What I learned working with a senior engineer as a new grad by ebiester on Friday August 19, 2022 @09:28AM (#32520691)
It's certainly there, but it comes in different avenues: tech lead meetings (where is our technical debt?), early in projects (as everyone is building a consensus for the project), and code reviews (where they're talking about a facet to make code more understandable or testable or otherwise fulfilling non-functional requirements.)

The conversations aren't about code quality -- they're about a finer point of it and in concrete terms rather than in beginner terms.

Re:What I learned working with a senior engineer as a new grad by toomanyrichies on Friday August 19, 2022 @01:32PM (#32523866)
> I recently started to work in a team of very senior engineers (with relatively little experience) and what I've noticed is that code quality is rarely mentioned. Everybody write "good enough" code and there's never much discussion around code quality (occasionally a few remarks in code reviews) or design.

I'll play devil's advocate and argue that this could just be the code equivalent of privatizing the benefits while socializing the costs. You mention that your team writes code without explicit discussion of its quality. The benefits of that choice are front-loaded, while the costs of that choice won't be apparent until later. Furthermore, the team members who have to pay those costs may not even be the current team members - it may actually be those on the team months or years from now, after the original code authors have left for greener pastures.

So it may be too early to declare that your choice was a successful one. As the article mentions, code is read much more often than it's written.

Re:What I learned working with a senior engineer as a new grad by yodsanklai on Friday August 19, 2022 @02:20PM (#32524421)
I'm not saying that my team writes unmaintainable code, but rather that because they're all strong and experienced, writing decent code is a given and the focus is on other, more challenging, problems. That being said, our code is definitely not as readable as it could be, but I understand it's a trade-off and there are more important things to do than refactoring code, unless it really gets in the way.
Re:What I learned working with a senior engineer as a new grad by battery_glasses on Friday August 19, 2022 @01:38PM (#32523937)
I used to feel this way until I started working with a very senior engineer (20+ years) who writes some of the worst code I have ever had to work with.

Functions are regularly 50+ lines with 10+ logical expressions. Most features are written as single classes with 3k-5k lines. Everything is written imperatively (that 50 line function declares a variable at the top and mutates it 10 times as it works through the control flow.) The same magic values are redeclared multiple times through the codebase instead of using a shared constant. His PRs are usually 3k-5k lines and take hours to work through. etc. etc

His code takes way more effort to understand and takes orders of magnitudes longer to change than it reasonably should.

Also his code works. It generally does what its supposed to do, covers edge cases, and is reliable. He also delivers with decent speed, but all that saved time is being pushed on the poor sap who has to work with the code next.

Re:What I learned working with a senior engineer as a new grad by pmelendez on Friday August 19, 2022 @08:40AM (#32520254)
It depends what is understood as code quality. After a while, writing code that is not verbose, fairly maintainable, and readable, is a given. There is a minimum bar that each team set and it is gated by code reviews. The tradeoff start to happen after those minimums are reached.

I think quality in terms of correctness is always the target, and performance usually has a target SLA.

Re:What I learned working with a senior engineer as a new grad by lhnz on Friday August 19, 2022 @08:48AM (#32520312)
I wouldn't fully agree, because while senior engineers don't often discuss "code quality" syntax/aesthetic issues, it is quite common for people to discuss bugs/edge-cases that need fixes or to discuss simpler approaches to achieve business goals or getting rid of difficult to maintain logic/services.
Re:What I learned working with a senior engineer as a new grad by mad_vill on Friday August 19, 2022 @11:06AM (#32521909)
This is touching on something I have been thinking a lot about as I progress in my career.

The thing good and bad code have in common is the fact that it needs to updated. Either for bugs or changing business need.

So focusing on the operational side becomes much more important. Code is the trivial part. Creating systems that can be modified reliably is the hard part.

I rather have ownership over a "poorly" coded service with proper ci/cd, integration tests, monitoring, and a team that reasons about and follows strong operational processes, rather than some beautiful code in a vacuum.

Re:What I learned working with a senior engineer as a new grad by zmgsabst on Friday August 19, 2022 @12:22PM (#32522992)
My experience is that “good” code enables all of that — CI/CD, meaningful testing, monitoring/logging, operational tooling, etc.

Making any of that work for spaghetti is rough, since it lacks the boundaries and entry points those things rely on. And even if you ostensibly have it for “bad” code, it tends to be fragile and unreliable. (As my many, many overnight pages have shown.)

Of course, that may be different perceptions of “good”.

Re:What I learned working with a senior engineer as a new grad by P5fRxh5kUvp2th on Friday August 19, 2022 @04:46PM (#32525720)
yep.

A common refrain is that if you're not looking at code you wrote 6 months ago and thinking it's poor quality then you're not growing as a developer.

This is probably true for the first few years of a developers career, but there are only so many ways to build an authentication system (for example).

At some point your improvements are at the design and systems level. You start to develop a nose for what can be problematic and how to avoid it. Linus Torvalds referred to it as 'taste'.

And as you said, often times there are organizational and procedural challenges that have a much larger effect on the success of a project than purely code concerns. Not that code concerns are irrelevant, but good enough is good enough, there's generally an expectation that developers can read code. In the same way there's an expectation that readers of a novel are at the literacy level to understand novels. No one would blame James Clavell if a 5th grader couldn't understand Shogun, even though it's true that Shogun could certainly be improved from a prose perspective.

Re:What I learned working with a senior engineer as a new grad by nine_k on Friday August 19, 2022 @02:18PM (#32524400)
For me, code quality boils down to two aspects: (1) current operation cost and (2) future maintenance / alteration cost.

You can cut a lot of corners, as long as you don't paint yourself into a corner. OTOH an extra hour not spent today on doing the right thing may and will result in extra weeks and extra thousands of dollars spent in a few months.

Re:What I learned working with a senior engineer as a new grad by adamsmith143 on Friday August 19, 2022 @10:18AM (#32521255)
Sounds like a startup? Title inflation is pretty rampant at smaller newer companies. The expectation is definitely ship the product before all else. Obviously if you are an established company serving services to hundreds of thousands or millions of customers code quality and reliability becomes an order of magnitude more important.
Re:What I learned working with a senior engineer as a new grad by rullelito on Friday August 19, 2022 @09:05AM (#32520484)
IMO too many coders can't write high quality code even if they tried. So when they write code that they feel is good enough, it rarely is good enough objectively.
Re:What I learned working with a senior engineer as a new grad by xeromal on Friday August 19, 2022 @10:13AM (#32521186)
What even is high quality code? I was on a project with a seasoned grey beard once and all he bitched about was dumb stuff like insisting NOT to prepend variable names with is and forcing a python project to have dependency injection. Sure, those things can make a high quality project but often misplaced and strangely opinionated.
Re:What I learned working with a senior engineer as a new grad by smrtinsert on Friday August 19, 2022 @11:15AM (#32522029)
Depends on the seniority imo. If you don't make code quality a thing with early in their career devs, you might open up a door to some bad habits to take hold.
Re:What I learned working with a senior engineer as a new grad by debacle on Friday August 19, 2022 @10:25AM (#32521347)
There are a few hard and fast rules around code quality (and every rule is meant to be broken), everything else is just preference.
Re:What I learned working with a senior engineer as a new grad by goodpoint on Friday August 19, 2022 @08:27AM (#32520135)
Learning how to write good code is a topic for juniors. Any senior would already know how to that so we focus on other things.