You can write great code. Now what?

The Ethos of Great Code

I’ve noticed many people build an intuition & cognition as their knowledge-base improves, about what makes code really fast, and what makes code really clean. There are a lot of ways to optimize code - learning about things like Data Locality, or Spatial Partitions. Even writing code in a way that is boring, obvious, or recommended by language designers can be a way to optimize, because this is what the language (and especially NCG) is going to be best at optimizing around.

The Trap

Fast & clean is the ethos of great code, and people are quite pleased when they learn how. It’s a little bit exhilarating! But this is a trap. Beginners will often look at what they know, and make the assumption naturally that they should make all of their code as fast and/or as clean as possible.

The Truth

In reality, we all have a limited amount of time to do these things. There are places where it is especially important that code be fast, clean, obvious, boring, or a million other attributions. The truth is, imparting one of these attributes onto a codebase mandates consistent effort. You cannot one-shot the best way to write every piece of code, and if you could, your time would be better spent when focused.

How do You Get Out?

A lot of people can be stuck in the trap for months, or even years. The best way to get out, in my opinion, is to build another intuition & cognition. This time, for “when”, as opposed to “what” - optimizing for any one of the aforementioned attributes of code is just as much about “when” as it is “how”. Remember that work on a codebase is often amorphous, and that you can usually dedicate your optimization time to whatever you want.

There are a few basic heuristics I’ve assembled here for when to optimize or clean up your code.

  • Is the code done - does it work? Focusing first and foremost on making code work is the first step to disarm the trap.
  • Is it hard to understand? Do things in your codebase interact with it often? I.e., is it creating common behavior which is surprising, or unpredictable? This might signal that you need to abstract your code differently, or clean it up.
  • Inversely, is it isolated, or abstracted in a way that would let you easily focus on performance later if necessary? This may be a sign that you don’t need to optimize or clean up right now, but that you might later! Leave a comment. I go with -- TODO: <note>
  • Do you know the characteristics and how to optimize your code right now? Again, leave a small comment. If that code ever does become problematic, you will love yourself for putting that -- Investigate: Is X faster than Y? there. Similarly, you will love yourself for putting it there if it doesn’t become problematic, because you didn’t waste hours swizzling vectors in different directions, or implementing a quadtree for a frustum culling system which didn’t need it.

There are of course many more. To me, it is important that a programmer can answer a lot of these subconsciously, and that they have the capacity to think about them. It will save them time, and that time will go towards making the important parts of their codebases better.

Conclusion

In conclusion, writing good code is easy, but keeping a codebase clean over the course of months or years requires consistent effort. Obsessing over small details, or optimizing before code works or is causing performance issues can waste a lot of time which would be better spent elsewhere.

If you’d like to get started disarming the trap, repeat after me:

  1. code I write will be slower than it could be.
  2. code I write will not be as nice as it could be.
  3. I am building a product, not a codebase.
  4. I will stay hydrated, get plenty of sunlight, and sleep regularly.

This isn’t to say you should half-ass your code or leave something broken / incomplete, fix those by all means! This post is about time management, not perfectionism - that’s its own beast. Writing code which is below average lets you dedicate time where it matters the most, which is generally a moving target.

Where to Next?

If you liked this writeup, you may like:

15 Likes

No. 10 NVIDIA H200s working in parallel solves this entirely. the only barrier is understanding now. It is 2026. you can write great code. you do not have to force yourself to mediocrity

3 Likes

Real ones will know that they actually make it dramatically worse

3 Likes

I’m trying to be polite here, but I think this should be in the lounge instead. I was expecting a Roblox asset, not a whole essay on why I shouldn’t be a perfectionist (which I still will be by the way, gg)

4 Likes

Same
I hate this “use other people’s slop” noise
I have my own vision that I see and tested to be much more effective than 99% of Roblox developers try to convince me.
I’d better have something take time to make but last for years than duct tape things and end up in a total disaster in a year or so.
After all, when you try to make it yourself, you gain something that can’t be bought: knowledge and awareness.

3 Likes

This article (mostly) isn’t about being a perfectionist vs. not. Infact, I think perfectionists would be served the most by this! You will get a more perfect codebase by picking the worst parts of it to improve rather than overthinking the things you’re actively writing.

As for miscategorization, sorry. That’s probably my bad, I’m never quite sure where to post things. If a forum admin is able to move this post to somewhere more appropriate, that’d be cool.

Thanks for your reply!! :waving_hand:

I’d better have something take time to make but last for years than duct tape things and end up in a total disaster in a year or so.

I think taking your time is really important, and I appreciate this feedback a lot. The point isn’t to say you shouldn’t take your time, but moreso that you should manage your time carefully and choose good places to apply effort. I might re-word some of the text in this writeup, thanks!! : D

Always great to hear from people like you! :waving_hand:

1 Like

Your 10x NVIDIA H200s working in parallel should learn time management and focus too. No matter what your workflow is, it’s useful to know!! :grin:

Thanks a bunch for your reply though. I’ve seen you a lot on these forums and I think it’s cool that you’re interacting with my post. Hope to see you again soon mate!! :waving_hand:

1 Like

“I don’t care how fast your code doesn’t run”
Cult of done keeps on winning.

Peak post, thank you.

Move the topic urself cuh

2 Likes

idk how to move the topic man what the heck

by editing it

1 Like

it only lets me change the tag