Ask HN: Are my expectations on code quality and professionalism too high?

271 points by veggiepulse ↗ HN
I have lost perspective on what is reasonable to expect, and need a reality check from HN.

Some time ago, I left a large-ish company with what I perceived as overall quite good engineering to join a smaller company. When I say "quite good", I don't mean perfect, but what I consider the basics were there

- Code review, where we would consider architectural concerns, failure cases, etc. ensuring maintainability. Shortcuts were taken intentionally with a plan to address them

- Test coverage was good enough that you could generally rely on the CI to release to production

- Normal development workflow would be to have tests running while developing, adding tests as you introduce functionality. For some projects that didn't have adequate test coverage, developing might involve running the service locally and connecting to staging instances of dependencies

- Deployments were automated and infrastructure was managed in code

Those are what I consider the basics. Other things I don't expect from every company and am fine setting up myself as needed.

In $current_company, I was surprised that none of the basics were there. All agree to do these things, but with the slightest bit of pressure those principles are gone and people go back to pushing directly to prod, connecting to prod DBs during development, breaking tests, writing spaghetti code with no review, leaving us worse off than we were before. This is frustrating since I see how slow dev is, and I know how fast it is to develop when people write good code with discipline. Most devs in the company don't have experience with other kind of environments (even "senior" ones), I think they just can't imagine another way. My disappointment isn't with the current state, but that people of all levels are making it worse instead of better.

These setbacks are demoralizing, but I'm wondering if my standards are unreasonable. That this is what mid-sized companies are and I just have to endure and keep pushing

305 comments

[ 3.1 ms ] story [ 168 ms ] thread
I don't think your standards are unreasonable.

Good practices pay off in overall being able to produce more _correctly working_ code. Even if in the short term it feels like for example writing unit tests "slows you down".

You can try and softly push towards better practices but if it's an organisational issue you will likely fail. Your standards are not unreasonable so it might pay to find a better company
I think you just don't want to work with people who accept such state of affairs, so no point trying.
Usually these trade-offs that logically follow different priorities. With a large company, it's important not to break things. With a small company, the speed of iterating and moving things forward can be much more vital from a business POV.

However, if you say you're confident that

> I see how slow dev is

it's just crappy quality and not a trade-off, as I would assume in a usual case.

I would say your standards are very reasonable and should be implemented across the board.

In my experience it's very easy for company culture, namely in smaller businesses, to get the impression that code quality is a luxury rather than a necessity. And it's even easier to have good intentions, but due to a lack of cultural enforcement just keep them at intentions and never implement anything.

So I would say that you either try to get your standards across or learn to live with lower standards .

Your standards seem to make sense. But I suspect there is immense variability between different companies.

You should I believe push for changes with examples of good development practice. Start with easy things that can have impact, and hope the improvement in quality of life due to better practices will stir more interest in improving their process.

But if you have to be the jerk about everything and people just end up resenting you for it, well I think you know what to do.

good luck.

Eeek. Doesn't sound like you're being unreasonable in your expectations at all!

I've been a small business owner, and a software contractor, so I've seen a fair few medium/large python codebase of varying age and quality.

To address your points from the ~10 codebase I've worked on in recent memory:

- Code review: Always in place, though often the CTO has a tendency to merge without review on evenings/weekends

- Test Coverage: Often a challenge - or rather tests are there for coverage, but are of poor quality and don't really assert anything that useful

- Your suggested normal workflow _is_ the normal. Sometimes there's been a dedicated QA team that verifies the changes as seen by the end user too.

- Deployment: Yep. Heroku or k8s have been common, but at least some form of 1-click deploy/promote

Perhaps I've just been super lucky! There are often still major problems in the codebase and refactoring/rebuilding needed to address the challenges, as well as resistance of the existing team to truly change their mindsets to address the problem v.s. the band-aid (or instant gratification) of a quick fix.

Don't give up the fight!

Adequate test coverage is hard without rebuilding from scratch. Hard to expect in a big, old company. Except when a huge codebase have to be rebuild because python2 have to be replaced (one of our software provider is in this case).
Out of all the items on the list (code reviews, CI, etc), it seems like test coverage would be the simplest to improve? Assuming it has a test suite at all, use one of the various test coverage scanners (simplecov, coverage.py, etc) and check the output for a file with a low % of lines covered. Then write one or more tests to cover the edge cases not yet tested.

It's a purely mechanical process unlike most of the other problems which depend on changing the behaviour of people in different departments and/or with more influence than you.

Depends, code that was not written with testing in mind can be very difficult to cover without some major refactoring.

Adding the first tests can be a slow and painful process.

Now, once you have those few tests? Yep! Add a few tests along the ones for the new functionality every time you touch a piece of code or pick the low hanging fruit every now and again and you can get to a useful test suite in no time.

"It's a purely mechanical process" - I thought on this for a while. I think if your testing is purely mechanical then you're probably not getting much value from it. Good tests need to be "smarter" than the code they are testing in a way.

Unit testing, for coverage (as a vanity metric) can be mechanical maybe, but integration tests are the way more valuable ones (for the most part) and way more complex.

These don't sound unreasonable. I've been in a similar situation before. In my experience, if the culture in the org is generally positive, it is worth taking the effort to champion good practices. You can become the go-to guy for setting these standards. Future developers will thank you for having done so.

However, if you think the culture is not conducive to positive, large scale change, it might end up being a waste of your time and energy. Having to constantly say no, and ask for everyone else to fix stuff in PRs can be exhausting. There is also a real risk of others perceiving you as someone who always finds faults with everyone else. That is a hard tag to shake off. Balancing that is the real challenge.

I don't think your standards are unreasonable but maybe they are a little too high.

Tests, CI that runs the tests and does not allow release to production if any of the tests is broken, and automated deployment are probably a must.

Code reviews are probably not.

Not sure about infrastructure managed in code.

The book "Working Effectively with Legacy Code" by Michael C Feathers is an excellent book in which he talks about, amongst other things, a process of selling the concept of proper unit testing to teams. And how he's managed it in the past.
No, i would say that your standards are quite reasonable. I would also say that there are many companies that do not meet those standards. Usually they have no excuse for doing so, just that no one there knows or most likely just don't care.

There are also many companies that go overboard with their code review and tests, get none of the intended gains, produce more slowly than they can, because of an attempt to cater to the lowest denominator. But I suppose if you're going to pick one of two extremes, that would still tend to be the lesser of two evils.

There are also many companies that go overboard with their code review and tests, get none of the intended gains, produce more slowly than they can, because of an attempt to cater to the lowest denominator. But I suppose if you're going to pick one of two extremes, that would still tend to be the lesser of two evils.

I'm not sure that's necessarily the case. IME, not much will kill both the pace of development and team morale faster than poorly conducted, heavyweight code reviews, but one of the few things that will is a dogmatic requirement to have some unnecessarily high level of code coverage in a test suite where everyone is just writing make-work tests to get the number up.

Testing is a skill to learn like anything else. Teams that dogmatically apply any new practice or process without making a genuine effort to learn that thing will never extract value from it. If your team can try, fail, and learn from mistakes, you are in a mature organization. If your team gives up quickly because of fear of dogma or has no strategy for dealing with the challenges of learning new skills, it's unlikely your team will ever extract value from testing until the team culture itself changes.
IME, the problem more usually happens because someone in management read a book and thought "I know, we can change our entire development process to do this thing I just heard of and overnight my team will all become 10x developers!"

If you've got a team that is genuinely interested in improving and willing to work on new ideas to make the best use of them, both reviews and testing can obviously be very helpful. That's not really the situation I'm talking about above, though.

I think if we're considering the morale of the engineers, then they would prefer to work in a wild environment rather than an overly rigid one. In a sense, it's fun to write bad code, commit it without consequences, and just watch a report of your LOC go up (the key metric for engineers in this strawman company).

I think from the business perspective, they would rather have slow to no changes rather than breaking changes. Presumably there is already a product that makes money, and would continue to do so if kept in a maintenance mode. Layer on poorly applied practices, and you've effectively turned it into that.

Oh my. Run away.

If that is their current culture, there will be a lot of pushback if you want to initiate changes. Especially among the senior (responsible for the mess) ones who get defensive real fast.

Maybe ask more about how their engineering culture is next time around during interviews.

Unfortunately I have to second this advice. There's very little chance you'll be able to make things change so better to move on now than when you're depressed in a few months or years.
Yes, run.

I've been trying to improve our standards for years, it never gets traction.

Not in my experience.

The devs in teams I've worked with (including me) are most of time all quiete aware of the places where their code en setup is lacking and as long as they don't feel personally attacked are very happy with people who come with implementable solutions.

The not feeling attacked and implementable parts are key.

This. I've never had a negative response when I joined a project and discovered obvious problems when I explained why I think that they are or are going to be a problem and offered to help fix them. Nobody likes the guy that shows up, says "that's all shit, you need to fix it", and vanishes again. But I've never seen anyone hate the guy that shows up, says "I've noticed there's a lot of friction around X. I think we could make it easier to work with and more stable by doing Y".

And I've always liked it personally when somebody does that to me. When somebody with a lot more experience and/or skill helps you, it's like some super high level player carrying you through boss fights: you level up much quicker than if you did it on your own.

I'm of the same opinion. I love getting feedback, better if it's constructive, but all kind of honest feedback is useful and welcome. And it doesn't always come from people with more experience, sometimes a greenhorn will see things that a greybeard like me doesn't.

But I've seen people giving negative responses to the best feedback. Hell, I've had people complaining for hours because someone else replaced their manual process that took an hour to do with a script (and copy&paste of the result) that took literally seconds to run.

Yeah, I've seen that as well. I believe it's mostly fear-driven, in a way of "if this gets automated, why would they need to keep me around". It's a terrible mindset for everybody involved. It really slows the team down, and it's a major issue for the person themselves. It's like impostor syndrome on steroids. Not only do they worry that they might be found out, they worry they might be replaced by a script.

I've never personally seen somebody getting fired because a script can do their job. I've seen them being freed from doing the same repetitive bullshit day after day though, and finally being able to actually tackle new challenges.

But unfortunately, that kind of mindset is not something you can change through rational arguments, at least in my experience.

Yes I think the not feeling attacked part is a responsibility of both parties. And therefore sometimes unavoidable.
If the author is not going to accept the challenge, then yes, run away is the best choice. On the other hand, the situation is unique, and the author can try to show himself with these challenges.

But I agree with the last sentence. This is a huge mistake, and it seems that the author did not ask these proper questions during his interviews. Perhaps, this is the most valuable lesson to him from the story. You have to know which company you are going to join and the state of engineering.

Your standards are very reasonable. You should keep pushing for higher standards. Preferably these also should be enforced technically. I.e., it should just not be possible to push something to development without code review. At first you can also just make sure you have good quality in the parts of the application that you are working on. It will at some point become quite noticeable that thing are going better there. I.e., the tests will catch something that would have otherwise failed in production. This can work as an eye-opener.
Those seem like reasonable policies to aim for. What isn't immediately clear is whether they are missing because of a lack of understanding or a lack of willingness to change.

If it's the former and you've come into the small company with more experience than most people there, you might get a long way and become quite popular with your colleagues if you share the benefit of that experience intelligently. For example, with the agreement of the senior people, you could show everyone how to set up a good CI system or automated deployments, if that's something you know how to do and they don't. These kinds of things tend to have obvious benefits once they're up and running, but setting them up in the first place can be a barrier depending on what else you're using, how everything you've already got fits together, and of course the level of knowledge and awareness of the people working on it.

On the other hand, if everyone is well aware that they should be doing something and they know how to but just can't be bothered, that's a cultural problem that you're unlikely to be able to change as the newbie. Probably no-one else is either, unless they're doing it from the top down and have hiring and firing privileges to force the issue by bringing in more people who expect it and, if necessary, letting go anyone who stubbornly refuses to engage. If this is the environment you're in, unfortunately putting up with it or getting out are probably your only certain options.

This has been my experience as well.

If it's a skills problem, by all means set everything up and be the hero.

If it's a cultural problem, run.

This seems below average. No tests or code reviews is common but pushing directly to prod or connecting to prod databases is unusual. It seems you've gone from one extreme to the other. From what I've seen, even at companies were people work in silos producing untested spaghetti code, production is protected. In any case, among small companies, you'll have a hard time finding the same level of quality you were used to. I'm not saying they don't exist but I'd say it might be 10% of them.
This is how it struck me, as well. There is a big gradient, and this is the extreme opposite end.

Just be thankful the devs can “push” to production and aren’t individually rsyncing their code into the app servers. :)

(comment deleted)
Would you say its good practice to ask specific questions to uncover the problems mentioned in the OP at the interview stage?
This is an engineering leadership problem. Your new company does not seem to have an engineering leader who understands the cost to the business of having the engineers act the way they currently are. I don't think you have to run away, and you don't have to become such a leader yourself, but you should talk with your leadership and show them why what the team is doing now is not good. Make sure to first understand what your leadership values, then present to them better ways of doing engineering where you show the impact it has on the things they value.

So like for automated tests if the leadership currently thinks that test code isn't actually doing anything for the customer so why should it be done? Then you have to show how much money/time/whatever has been spent by engineering fixing the same bug over and over because you lack regression tests and compare that to how much would have been spent to write a test case for that regression.

The standards you've described are totally reasonable! This sounds like an amazing opportunity for you to have a really wide impact and a great chance for the company to level up their game using your experience. I'm sure you've thought about this already but it doesn't have to be a "fight" - in many cases what people need is some appealing reasons, e.g. describing how their world would be much more amazing if they implemented X, Y and Z. Depending on the size and stage of your company it might actually make sense to do it in a 'quick & dirty' way (e.g. dominating the market might be more important at an early stage than doing it in a sustainable way) but even then they (tech decision makers) should be aware of the tradeoffs and if they are, they should be communicating the reasons to the whole company.
I recently joined a company(for less than ideal reasons) knowing they don't follow basic software practices. I felt frustrated in initial months and then took on challenge of evangelizing and implementing X.

But I'm getting too much resistance from "senior" developers who've been there for 15-16 years. Everyone agreed to do X and circumvented it the very next day.

This consumed so much of my time(outside office hours) and energy that now I feel why do I bother making a change when I'm not getting paid or even recognized for it.

My perspective is that quality is a process and a project rather than just a goal or a fixed property of a team. This new team is like a project that's barely begun and you're coming off a project that was in maintenance mode.

So like any project it works best if you do one thing at a time and build up some momentum. You can't fix everything at once.

See if you can get people to buy in to just getting the indentation consistent (my favorite place to start), or preventing the development software from touching the production database.

Get one win, give it a little time, and then go for another pass. Meanwhile set an example in your own contributions. It is very possible to improve things but it takes patience, planning how to deal with setbacks, flexibility, and recognizing what the real priorities of the company are and what quality means in context.

Your standards are reasonable. However, what's missing in a lot of comments is a good process for assessing what the human and business factors that led to where the company is now, and how to approach changing it. This is natural as most people here are techies first, but it could lead to setting you up for a bad experience.

There are very limited conditions, under which making this a blame exercise would be the right answer.

There are also business conditions, under which this situation is the best that the business could have achieved by now. Eg, if other things needed to be higher priority for the viability of the business. Having said that, once you are in such a situation it is difficult to get out of it, and hence such situations tend to linger for much longer than any justification.

What you probably need to do now is find out how much appetite there is to change, and what the blockers are.

Strongly agree - particularly this part:

"what the human and business factors that led to where the company is now, and how to approach changing it"

This is a people problem, not a technology problem (or an opportunity if you look at things that way).

(comment deleted)
Consensus that these processes are really the best way to do things is relatively recent, and I wouldn’t be surprised if there are a lot of shops that haven’t yet retooled to them.

Continuous integration was only proposed as a concept 30 years ago, and was a relatively fringe theory for another decade at least. Automated deployment followed a similar path, but about a decade later. Manual acceptance tests, in particular, remained quite common a decade ago even at the big tech giants.

(comment deleted)
To counter the flood of 'you sound reasonable', I think you are probably being unreasonable.

The hint is "spaghetti code".

What might have happened is you started slagging off everyone's code as soon as you've come in and now you're plucking at straws to justify it as you're getting ostracized.

Also, objectively speaking, how can writing MORE code and spending MORE time talking to people be faster? Your argument makes no sense. Tests and reviews are a massive drag on development, also more code means more bugs. That we know.

It would take years to get full test coverage and somehow you think that makes everyone inherently faster?

Also, ask yourself this, how much money have they lost so far by doing this? Is it perchance $0? Zero downtime? As you've not listed a single actual COST of what they're doing.

While direct to prod/connect to prod db is nuts and not normal, you also haven't given the context of who did that and why they did that. Is there really no staging server? No Dev branch?

I think it is faster in the long term because well tested code is less likely to contain bugs, and reviewed code more maintainable as it adheres to an agreed upon standard. So it may be longer in the short term, but faster overall as you have to revisit the code less due to these reasons.
I take it you've never worked in that type of an environment, with code review and (good, not necessarily perfect) test coverage. I am working in an environment like that and I regularly push 20-40 changes per week. There's no problem with speed. Furthermore, had there not been tests (and not just unit tests; the important stuff is large scale performance tests and output differs) I would never be able to push code out so quickly.
I can regularly push 20-40 changes per week, with or without tests.

What's special about that?

How can writing MORE code be faster? Be honest with yourself, you know it's slower, it's hard to get right, and it's easy for many programmers to end up writing really bad tests that hinder rather than help.

Certain orgs might be able to pull it off, but generally speaking it's cargo culting.

It works because tests provide you with incredibly fast feedback if your change works or not.

Then you can confidently and automatically deploy to prod straight away without much manual checking.

It's faster, because once the code is reviewed and deployed, it most likely works. And test ensures that this functionality stay in place with (almost) no bugs. The opposite is a shitshow that looks fast to inexperience people...
working in a large company with tons of spaghetti code and i can assure you it’s a real thing and that it not only slows you down it can actually strangle your company.

making sure no more of it gets to production has become a top priority company-wide

Yep. Worst application I've ever had to work with was a WinForms monstrosity where ~300 form elements were used to store the application state, and none of them were named (so it was all "TextBox1", "TextBox2", etc.). Most of the application logic was in a single ~8000 line method. An absolute nightmare to debug or modify.
I am much more comfortable refactoring my codebase and gradually raise standards of quality of it because of unit tests. If I change piece of code I will know if I modified key functionality of my software. When someone else is editing the code, he is also confident that the module he did not work on is still working as expected. He does not need check up with me and waste mine and his time. I am not sure why would you test your code manually. Total redundancy.
Your standards seem fine. But for a lot of companies the initial techies set the approach and a lot of people find the thoight of these practices stifling. Not necessarily in practice but it can sound very heavy. I'm self-taught and I have a fairly sizeable mismatch with enterprise OOP-focused engineers when it comes to testing, overhead and process.

I think it's hard for people to appreciate thw other side of these argumenta without having lives through some consequences. I firmly believe in automation and testing. I believe tests must be pragmatic to not be overbearing. I mostly believe in code review for teaching. The research covered in the book Accelerate (subtitle something something devops) made a strong case against code review and change control for most software development.

So yeah, your standards sound reasonable, if maybe a bit much for my taste in some aspects but I know lots of shops that wouldn't be anywhere near. And this is a skillset and know-how you can provide. Hope that's a useful perspective.

This looks like a cultural problem where the top brass either believe in strong-arming developers or aren't aware about the dreadful impact of not following processes (code review etc.)

Your expectations are perfectly reasonable. I think you should consider explaining to everyone (including non-developers) how bad things can go if these practices continue.

Your expectations as described are not high. CI/CD is a bare minimum unless you're working at one of those jobs where tech is just not a main concern. I've worked at some places like that, while the job was utterly chill and relaxed, you don't grow professionally. If the company tanks, you're toast.

That's all I have to say about this: If the company tanks and you forget about good practices, you're toast.