June 29th, 2024

A Bunch of Programming Advice I'd Give to Myself 15 Years Ago

Marcus offers programming advice emphasizing prompt issue resolution, balancing speed and quality, improving tool proficiency, deep bug investigations, leveraging version control, seeking feedback, and enhancing team collaboration for optimal problem-solving.

Read original articleLink Icon
A Bunch of Programming Advice I'd Give to Myself 15 Years Ago

Marcus shares valuable programming advice based on his experience, aimed at helping programmers improve their skills and efficiency. He emphasizes the importance of addressing recurring issues promptly to prevent future problems. Marcus discusses the balance between speed and quality in development, suggesting adapting the approach based on the project's context. He highlights the significance of investing time in improving tools proficiency and addressing incidental complexities to enhance productivity. Additionally, Marcus advises on delving deeper into bug investigations, leveraging version control history, and seeking feedback from imperfect code to facilitate learning. He stresses the importance of making debugging easier through various strategies and encourages effective communication and collaboration within a team to optimize problem-solving. Marcus' insights provide practical guidance for programmers looking to enhance their coding practices and problem-solving abilities.

Link Icon 56 comments
By @999900000999 - 5 months
I'll add one point. You are not your job. Don't take things personally at work. And never be afraid to leave if you're not fitting in with your company .

I've left jobs over a few reasons, primarily bad managers, increased compensation, and bad code .

If people are writing bad code at your company, to the point where you know it's going to come back to haunt you later, it's okay to just walk away .

Don't embarrass anybody, don't escalate to a manager and explain how horrible the code is. I was in a situation where someone our team was effectively writing code that pretended to do things it really didn't. I got into a really nasty argument with half my team about this. I ended up putting in my two weeks, and then my manager was like oh you were right the entire time .

Life is too short to deal with incompetent people.

By @avanai - 5 months
> Try to solve bugs one layer deeper

This is one of the main things I try to impart to junior folks when I’m mentoring them or reviewing code.

It’s also one of the biggest red flags to me of someone who’s working above their level when I have to repeatedly press a more senior person to dig deeper and fix things at a deeper level.

You need to take the time to understand why the bug happened, or you’re just going to be patching wallpaper instead of fixing the plumbing leak.

By @hamasho - 5 months
Most of this advice has already clicked with me, but this part:

> If you can't easily explain why something is difficult, then it's incidental complexity, which is probably worth addressing

That's a real eye-opener. Hope I remember this next time I implement something complex. The thing is, I don't think this stuff would've helped me much when I was a junior dev. A lot of them are just too nuanced.

By @wruza - 5 months
Not sure what 15 years means, but if that’s where I started:

(Blasphemies warning)

- Skip low level and go as high as you can. Ditch C, assembly, hardware. Take python, ruby, js. Never touched C++ cause it’s awful? Good.

- All the money is in the hands of a client. If you’re taking it from someone else, best case you’re taking less than a quarter for essentially the same job. Useless leeches everywhere who perceive you as a magic money generator. Go around them once you’re confident.

- Read sicp, htdp, taoup, but don’t take them to heart. Seriously, extensively test any idea you learn against reality, cause ideas may sound excellent out of context.

- Pragmatic is the only way. Don’t listen to industry peasants jumping through imaginary hoops, they are crazy. Religion in programming is worse than religion irl. There’s insane amount of it in programming. Don’t argue, let them be. It’s actually easy to test approaches by yourself and learn your own ways. Most of these are just habits making no difference once learned.

- Doing something together only turns out faster if you’re very good communicators. Good communicators are rare and you are not the one.

By @mannykannot - 5 months
I like this a lot. While those commenters who say it is too advanced for novices have a point, I feel these are still issues worth thinking about - and coming back to - as they learn.

The one exception is “Bad code gives you feedback, perfect code doesn’t. Err on the side of writing bad code.” My experience with bad code is that it does not tell me much; instead, it presents inscrutable and baffling mysteries. From the caveats and examples, I think the author is trying to say something rather different; something like “don’t obsess over completeness” or other concepts of ideal software - especially, I might add, dogmatic concepts of this nature.

By @trustno2 - 5 months
The one thing I disagree is the thing about editors.

When I began coding I spent hours tweaking my vimrc file and learning all the essentially random shortcuts, and dealing with the absurdities of vimscript. (and debugging vim plugins that broke each other.) It felt like actual work while I was producing nothing.

Now I just open vscode with default settings and I am productive right away. Who cares about editors, vscode is good enough.

But maybe just vim sucks and I should have been playing with emacs all along, I don't know.

By @austin-cheney - 5 months
The one piece of advice I would give myself 15 years ago:

In the corporate world be very good at administration. You only need to just be good enough at programming to not get fired. Everybody has opinions on software techniques and nobody measures anything, so it’s really just a popularity/tool game. The only goals are retain employment or promote out of software, being good at software is just a distraction from the goals.

If you want to be excellent at programming do it as a hobby and set your expectations right that it’s only a hobby.

By @BiteCode_dev - 5 months
Those are way too abstract advice when you start programming.

You can only understand them because you lived those situations, which implies experience you don't have.

I would say (specifically to my young self):

- There is no substitute for doing. Less tutorials, more coding.

- Stop being obsessed with quality: you are not at the level where you can provide it yet. Do dirty. Do badly. But ship. Some people will be mad at you, and they are right. But do it anyway. Yes, reboot the servers with users on it. Yes, commit the spaghetti. You'll reach the level you want to avoid doing all this.

- The users don't care about the tech. They care about the result.

- Doing something for the hell of it is worth it. Just make it separate from the point above so they don't conflict.

- Programming is a battle against complexity. Again and again. Put that on a post-it. Make your decisions based on it. You will suck at it, but try.

- You have imposter syndrome because you are an imposter. You are really bad. It's ok, doctors hurt people for years while learning to save them. Don't sweat it. It will come.

- You need faith it will work out. On the long run, you'll get better at this. But in the short term also. You'll find the bug. You'll figure out the solution. It will happen if you keep at it even if it can be frustratingly long and unfair. Even if it doesn't feel like that right now.

- The right team is way more important than the right tech. If you are alone, get in touch with people who will lift you up from time to time.

By @simonw - 5 months
This was great. I particularly enjoyed the "Bad code gives you feedback, perfect code doesn’t. Err on the side of writing bad code" section, I'd never thought about how spending time writing "perfect" code means you don't get to figure out which aspects of that code actually matter.
By @myaccountonhn - 5 months
This is interesting. If I were to complement the list, these are some items I’d add that helped me:

- learn functional programming. Doing that was how I finally “grokked” programming and could solve problems more easily. Before I was ready to give up.

- learn CS history. I studied UX and what I learnt was mostly one side of how to think about computing where you spoon feed users and remove things. There are other ways to conceptualize software and design, which would have left me less disillusioned.

- learn fundamentals: data structures, networking, performance, operating systems, security, unix, math. These are so neglected in the industry, and we’re left with super complex systems we don’t actually understand as a result.

By @supriyo-biswas - 5 months
I wish more articles talked about the usefulness of integration tests over unit tests. Personally, I feel that unit tests are overrated and rarely give the required confidence to inform the team whether something is ship ready, whereas integration tests on the common workflows means that even when a bug is introduced, very few users are affected.
By @piterrro - 5 months
> If you can’t easily explain why something is difficult, then it’s incidental complexity, which is probably worth addressing.

This one is good and has been following me since I've became a manager. Thanks to you, I know how to apply that objection to "press" people when I feel we're dealing with this kind of complexity.

By @yowlingcat - 5 months
Agree with sibling comment saying these are too abstract. Here are mine:

Fundamentals:

- Ecosystem beats language and syntax

- Use boring, battle tested technologies

- Use the relational database to do the heavy lifting

- Avoid caching unless you have a great reason

- Code cleanliness comes from simplicity, not elegance

- There's higher leverage from improved code reading ability over writing ability

Professional:

- You grow faster building in good industries over interesting codebases

- There's higher leverage from improving the business over improving the code

- There's higher leverage in finding mentorship over being an autodidact

- Make T-shaped buy vs build calls: build the secret sauce, try to buy the rest

Probably leaving a bunch out.

By @koliber - 5 months
I rarely see advice with which I wholly agree. This is one of those rare times that I fully agree with everything g. Good seasoned advice from someone that has been doing this fo r a while.
By @megamalloc - 5 months
Mostly pretty sound advice here, but oh, this rankles! --

"In situations where bugs aren’t mission critical (ex. 99% of web apps), you’re going to get further with shipping fast and fixing bugs fast, than taking the time to make sure you’re shipping pristine features on your first try."

In 99% of web apps, your end users have no possible way of telling you that you shipped a bug, and your bug will remain there forever, frustrating users and losing your client money as they abandon your site. Telemetry won't help you either becuase you'll misunderstand the observations it provides.

By @bazoom42 - 5 months
> Assess the trade-off you’re making between quality and pace

Very important! But also important to distinguish between kinds of quality. Using a sub-optimal algorithm or bad identifiers or copy-pasted code can always be fixed later. But some problems like a bad database schema is much harder to fix later.

By @Scubabear68 - 5 months
The author’s comments about knowing your business context and the potential impact of bugs really hit home with me.

I have seen far too many teams using Facebook sized solutions for a few thousand users.

I’ve seen developers slowed to an absolute crawl, terrified of shipping code, for a completely secondary operational platform with low volumes and non-critical data. All because the product people were misguided in their mission.

And sadly, I’ve seen teams with almost non-existent security practices and knowledge happily banging out crap in financial services environments.

And I’ve been blessed with teams understanding their position and fully embracing it. Financial services products with quarterly releases that were rock solid and well architected. Batch document processing systems with just a few dozen end users who worked closely with us developers to tune algorithms where sometimes we would ship multiple times in a day and re run batches in production.

To be successful, teams gotta know if you’re at NASA level, or life threatening, or business critical, or somewhat critical, or just nice tooling, plus understand the cash flow / budget situation. As a dev you may not be privy to all that, but strive to know as much of this as you can.

And of course, understand who you users are, and who your customers are, and prioritize accordingly.

By @valyala - 5 months
My advices to new software engineers:

- Always think how to simplify the code you write, since simple code is easier to maintain and debug.

- Prefer writing dumb code than smart code. Smart code is good for programming contests. Smart code is very bad in production when it needs to be debugged or refactored.

- Always think about improving the usability of the software product you work on. Users don't care about code. They care about UX of your product.

- Fix small usability issues as soon as you notice them, since these issues are usually the most annoying for end users.

- Do not start writing code with some popular design patterns. Just write the most simple code, which resolves the given task. Later, the best design patterns will evolve organically from the code solving the particular task.

VictoriaMetrics development goals are based on these rules - https://docs.victoriametrics.com/goals/

By @DanielVZ - 5 months
I have one:

Learn to become comfortable implementing and working on state machines.

It might be one of the most useful abstractions out there that if implemented well leads to a great extensible design without compromising performance.

By @vitus - 5 months
The point that resonated most with me, and that I repeat every time someone early in their career asks for advice (or one thing I wish I had been told when I first started out) is "When working on a team, you should usually ask the question".

Early in my career, I spent a lot of time reading unclear or obsolete documentation, poring over code, etc, when I could have asked the person sitting next to me and gotten an answer in 5 minutes. Sometimes, I didn't even know who the right person to ask was, but if I had just asked my tech lead, he would have been able to point me in the right direction.

Claiming that it reduces your overall time from several hours to < 5 minutes is maybe a bit exaggerated, since it also takes time to figure out what question you want to ask in the first place. But it's still worthwhile even if you end up investigating for 30 minutes instead of 3 hours.

By @simpaticoder - 5 months
"Don’t underestimate the value of digging into history to investigate some bugs." Valuable advice, and it particularly highlights the risk of global state and the benefit of understanding your runtime. Browsers have popularized flamegraphs, stack traces show you the frames down to the moment of error, but global state survives multiple stack traces and the one you're looking at may not be (probably isn't) the cause of the problem. There is global state, the heap, external systems, etc that change over time and with successive calls. This is true even in single-threaded environments, and is far more complex in general multi-threaded environments. I often feel this isn't clear to beginners nor is it clear to them how you go about investigating bugs within this context.
By @hinkley - 5 months
The trick is not in having advice to offer. It’s in having advice they will hear.

Next month I’ll have been working in software for 30 years. Which means I would have a lot more common ground with me 15 years ago than most people will. that me with five years’ experience might not have understood at all.

Me with five years’ experience suspected many things that were true but missed some important one. I’d probably have to feed his ego by confirming some of those things before moving on to the difficult bits.

But who is to say that me with less Impostor Syndrome would be a better person? No, the main value in learning from the past is improving the future, not nostalgia or regrets or what ifs.

By @liampulles - 5 months
"Bad code gives you feedback, perfect code doesn’t. Err on the side of writing bad code".

This is probably quite a cynical way of putting it (and it speaks to me, probably because I am quite cynical) though I don't know if a junior dev will really appreciate this.

The way I would put it is: don't seek satisfaction from trying to make perfect abstractions for business rules no one quite understands, rather seek satisfaction from making your user's lives easier as efficiently as possible.

By @osigurdson - 5 months
One bit of programming advice I would give myself is, on large projects, ensuring that appropriate constraints are in place is more important than functionality. You want to be able to come back to an area of code after a few years (without looking at it) and everything that has been added should still make sense. Patterns that you don't want to see should be hard to do - the natural inertia will stop it from happening. Designing things that "allow people to do anything", while seemingly a benefit, end up causing a lot of problems in the long run.

A reasonable argument might be that it should be watched / policed but this is harder in practice than in might seem. A lot of orgs are fairly decentralized, meaning that no central entity can make the call (probably a good thing imo). If appropriate constraints are designed into the system this kind of energy sapping discussion will not even need to happen in the first place.

Essentially, adding constraints at t0 adds degrees of freedom in the future. Coding is a bit like a garden - you need to ensure that the garden makes sense as it grows.

By @whatsakandr - 5 months
A variant on that I say on one of these is "Do the dumb thing" thing to find the right abstraction. I've seen so mucb code that didn't need to be written if someone had just done the dumb thing. On the flip side, I've also seen so much code that could be so much simpler if after writing the dumb solution, they went back and figured out a better one. I guess the takeaway is: Prototype.
By @tossandthrow - 5 months
> Spending time sharpening the axe is almost always worth it

I hear this advice constantly. But I feel like it really need to be qualified. I have been in projects that never saw any real value produced because people constantly focused on DX, projects management, and other tools.

Sometimes one just needs to do with tools at hand, and not worry if there are better tools.

By @photochemsyn - 5 months
> "It’s really easy to write terrible code. But it’s also really easy to write code that follows absolutely every best practice, with 100% test coverage, and has been fuzz-tested and mutation-tested for good measure – your startup will just run out of money before you finish. So a lot of programming is figuring out the balance."

The situation appears to be changing rapidly. 15 years ago there were no advanced code-generating LLMs, and while relying on them for the core logic without having a good understanding of the language and system is still a bit iffy, it does seem that they're pretty good for generating tests and spotting deviations from whatever your group has decided are best practices.

By @cratermoon - 5 months
> Our server models are exactly the same as the DTOs we would write, so I just serialized those, instead of writing all the boilerplate, we can write DTOs as needed later if needed

I worked on a system that used the protobuf types generated for communicating between services everywhere. There was absolutely nothing in any of the components of the system that didn't depend directly on the generated protobuf code. What made it even worse is that a backend system we called had multiple endpoints that used the same name for similar but slightly different things, so there wasn't, e.g. just a single Passenger type, but a bunch of different Passenger types across various packages.

By @ChrisMarshallNY - 5 months
> update our subscription layer to call subscribers on the main thread instead

I often do this, but have been doing it less frequently, lately, because I don't want to force a thread switch, unless I know that I'll be calling UIKit functions (not always things that affect UI. Many "background" UIKit functions also require main thread). Instead, I clearly mention the thread state, in the API headerdoc description ("- parameter handler: A simple, no-parameter, tail completion. May be called in any thread.").

By @mrits - 5 months
I spent a ridiculous amount of hours tweaking my vim config over the last two decades. I've used vscode the last few years and rarely jump to vim to do some text manipulation (that I usually could do with a raw install)
By @moonshinefe - 5 months
Good post, I agree with most of it. One that goes hand-in-hand with "just ask the question" is learning to know when to pivot. If you've hit a blocker, whether it's something to do with waiting on a teammate, client, or answer to a hard question, consider pivoting to another task to knock out some easy wins.

Ideally the task you pivot to should require minimal context switching to get going. This way you won't lose productivity. Often if the blocker is a hard problem and you go back to it later, you might have a good idea after stepping away for a bit as a bonus.

By @vindin - 5 months
I would have told myself that there's going to be a new frontend architecture called "SPA," and a new framework related to it called React.js. And that I should stay far away from both of them.
By @stevenking86l - 5 months
This is one of the better advice posts I’ve seen. Especially the parts about finding the balance between shipping fast and shipping bug-free code.

Too many engineers think their job is “great code writer” and not “value adder”

By @BhavdeepSethi - 5 months
Really great advice! Few that I would add based on my experience:

- Engineers spend way more time reading code than writing it. So writing easy to read code is more important than writing fancy/complicated code just because it saves few lines of code.

- Extension to above point. Having coding standards in the company is important so that it's for anyone to make changes to different parts of the code. If one engineer ends up writing code using their own standards, it makes life harder for everyone else on the team every time anyone else has to debug that code.

By @CM30 - 5 months
Seems like some good advice here! The points about digging deeper into the cause of a bug and looking at the history of the codebase for more info are really good points to keep in mind for sure.

And remembering to ask questions hits home pretty well too. There's always the worry that you're bothering people too much, and the balancing act between thinking whether you need to be asking for help early enough to make sure you're not going down the wrong path and not asking about every little thing without attempting to fix it yourself...

By @rudnevr - 5 months
not a good advice at all. it's hard to interpret right and will probably change in 5 years anyway when the author reaches another stage.

my advice would be much simpler: 1. Most of the time you'll be manipulating test. Learn options how to manipulate text professionally. That includes vim, bash, sed, awk, perl, and regexes in general, including lookbehinds etc. It's worth it. It takes a few years to learn but even the basic options give you the culture and approach how to do things faster. Most coders have trouble swapping two columns in a text file or finding unprintable character.

2. Learn hotkeys seriously. They're more consistent and uniform than UI, learn how change them, which tools are better designed for them, and organize some memorization scheme. It pays off a lot and gets into body memory, freeing up mental space.

3. Learn how to version your own code instead of creating multiple files and folders. Read git manual at least once. Learn how patches work, what is interactive rebase, and how to go back and forth, combining different changes from different branches. That gives you freedom to experiment with code on a larger scale.

4. Learn how to quickly test any framework/code. There will be countless situations where you have some piece of crap not producing the needed result, and you should be able to quickly prove it. For this p.1 is invaluable. I have my own json,xml,rest,kafka and text log parser and diff, and a few cloud, database and search clients which I tweak when switching jobs. It's all mostly written in standard unix tools, and can be literally retyped if needed (I worked on high security envs often). It's also isolates me from poor (non-)standard tooling different in every enterprise to which I only fallback when I already know the answer and need to prove it to a peer.

The rest is subjective and optional. You can love or hate your job, you can love tabs or spaces, weak or strong typing, but the above will definitely makes it faster. What to do with the rest of that time is your decision.

By @alberth - 5 months
> If you can’t easily explain why something is difficult, then it’s incidental complexity, which is probably worth addressing

That’s how I feel about git.

By @theideaofcoffee - 5 months
> If you (or your team) are shooting yourselves in the foot constantly, fix the gun

This is a reasonable step to take if you're working in a reasonable company with reasonable "management". If you're unlucky enough to be working under a manager that refuses to recognize there is a problem, even with compelling data, prepare for pain. In that case nothing is allowed to be done because "well, that's how we've always done it and doing something about it might upset someone". It's really time to quit and find something new at that point because there is generally no hope of turning that around.

> If you can’t easily explain why something is difficult, then it’s incidental complexity, which is probably worth addressing

See above. "That's how we've always done it, and someone is used to that work flow, so we can't change it." Sometimes this will lead to a legitimate Chesterton's Fence situation, in which case you'd want to regroup and rethink it. Otherwise, the batshit insane is the default. Target the latter.

> Try to solve bugs one layer deeper

"There is no time to do that! We have so many other projects!" While being blind to the fact (or better yet, burying their head in the sand and trying to ignore) that it's all self-induced.

> Don’t underestimate the value of digging into history to investigate some bugs

"We can't change that because one of our people close to management made that decision and it might drive them away." Good, get them out, that's the only way to really fix it. Ideally if the management that hired them is pushed out too.

> When working on a team, you should usually ask the question

"Who are you to question our wisdom? Who are you to suggest something else, it's working in production."

These are great things to start conversations, but you have to start them in an organization that is willing to change and be willing to take your advice to heart. Don't waste your precious life trying to change what can't be change, no matter how much you want to see it change.

By @inatreecrown2 - 5 months
this is not on the content but on the website color choices for text and background: wonderfully well done, easy to read in dark mode. with this kind of sensible coloring i feel i don’t need eink devices for reading.
By @anilakar - 5 months
One more: Make developer velocity one of your top priorities.

You should be able to give anyone in your team the repo URL and have them running unit and local integration tests in five minutes without prior knowledge.

By @Anduia - 5 months
Funny how he casually mentions JIRA as a process that slows you down. I get that his team does the issue tracking somewhere else?

What does people use that is faster to process both for devs and the PM?

By @l2dy - 5 months
> Keep doing the first sort of bug fix, and you end up with a mess.

To avoid the mess, design with the fail-fast principle in mind, which brings you closer to the spot where an error occurred.

By @roughly - 5 months
I think this is great for the craft of coding and solving problems. I’d add one more, along the vein of career advice: you’re hired to solve problems for the business, not to solve technical problems. If you can’t explain how the thing you’re doing makes an actual difference for the business, you need to reflect on what you’re spending your time on. I’ve seen too many technical teams be far too fixated on technical problems and unable to understand why they can’t get more headcount, funding, or recognition. Nobody writing checks cares about code.
By @hardlianotion - 5 months
Advice I'd give myself:

Finish what you're doing.

By @metalrain - 5 months
Very reasonable, solving bugs one layer deeper can be very valuable, if you don't go too deep into the rabbit hole.
By @hugodan - 5 months
15 years ago? Just buy bitcoin
By @pharmacy7766 - 5 months
What about: buy Bitcoin?
By @atribecalledqst - 5 months
> Don’t underestimate the value of digging into history to investigate some bugs

I'm one of about 2 people at my company who goes on archaeological expeditions to understand when and why a bug was introduced. A nonzero number of times, I have found that the behavior was introduced on purpose over a decade ago, and sometimes it's addressing an edge case I didn't think about. History is valuable!

(unfortunately the most common usage for me though is as a 'smell test' where I learn who wrote the code from the history and then decide based on my existing assessment of their skills, how suspicious I should be of that code)

e; oh yeah one more story that's kinda funny. Just this week I saw some behavior that I didn't like and went to look at the code's history. I was the one who wrote the code I didn't like. But I had left a good enough comment on it that I realized there actually was no issue at all and my expectations were incorrect.

By @brainzap - 5 months
programming is such a young field wirh many iterations that good advice is hard. I should have probaly made my own programming language!
By @efitz - 5 months
I loved the author's point on "incidental complexity". I would point out though, that even if you CAN explain why something is complex doesn't mean it SHOULD be complex.

When the subject of "tech debt" comes up, I always tell the teams I work on to focus on tasks that improve our speed or agility in the future. I believe that many coding tasks actually have a negative dev cost over time, as they reduce the dev costs of future work more than they cost at the current moment to implement. (Of course the problem is that they have a positive dev cost in the current sprint, so good luck convincing decision makers...)

By @jakobov - 5 months
Codeisforhumans.com
By @standardUser - 5 months
> You’re going to be renaming things, going to type definitions, finding references, etc a lot; you should be fast at this. You should know all the major shortcuts in your editor.

Programmers love to think this matters. If you're doing anything more than the most rudimentary work, the time 'saved' by maximizing keyboard shortcuts is completely irrelevant. You're spending most of your time reading code, thinking about that code and thinking of what code you're going to write.

When any programmer emphasizes how fast they are at completing these rudimentary tasks, my assumption is they are less adapt at the actual work of programming and instead try to 'git gud' at the keyboard wizard bullshit.