5

Used to think I was a hot shit programmer. Self taught (mostly) and could make all sorts of shit happen. Then I started reading other people's codebases. I got a huge dose of humility. Learned a lot from other codebases in the process. Eventually after a lot of languages and lot of practice I got a programming only job. Started reading through the codebase. Holy shit there are way worse programmers than me. There is some really good code in there too, but 20 year old wtf code too. I assume my perspective comes from seeing what good code can be. I still have a lot to learn though. That is the fun part. You can spend a week on a minute detail of one language or one concept.

So here are a few fun questions:
1. What is the worst code, codebase, or programmer you ever met?
2. What it the best code, codebase, or programmer you ever met?

I have seen a few codebases on github that just told me to walk away. Some of the best code I have found has been in game engines. Probably because I look at a lot of game engine code (sampling bias).

The coolest library I have used has been Construct (Python lib). It is a reversible protocol library. It can deconstruct or construct a data stream.

Leaving the off by 1 or more error in my post.

Comments
  • 3
    Good questions.

    Answers regarding people in real life:

    1. A polish coworker. While I'm in general quite fond of east europe devs, this one was terrible. His source code looked like the file was written by several devs that always patched stuff. That's what he did, patched until it works and moving on. Fact is, he delivered very fast bad quality. He's pure fired by complains of other devs. The employer actually liked him because he was always the one saying "Of course that's possible, give me one hour!". I told my follow up (stopped being lead) that he was impossible and that guy (knew him well) said that i'm probably doing smth wrong regarding him. A few months later that guy was the cause firing him.

    2. A dev in my own neighborhood. He is amazing and drives a skyline. He ran over his laptop with it once. He was always rapping during coding. He wrote very specific code (nothing generic, one purpose) and just delivered hardcore. Velocity and delivering. That's what counts
  • 3
    Answers regarding stuff i've seen online.

    1. Wordpress, it's the biggest security issue i've ever seen. Templates can do SQL queries and it's very common to base on online templates. Peter Kassenaar. The Dutch book author that learned me to make sql injections.

    2. I've learned much from nginx source code and sqlite3. I've investigated sqlite3 recently and god, what can that guy write code! sqlite3 is a one-dev project and he doesn't want source code contributions. It's open source in the way that you're allowed to know the source, not to contribute for it. I do understand it very well - he has a certain set of skills and has a clear vision. With such clear vision of how to do things, it's not comfortable to work with others. Also Guido van Rossum (Dutch python inventor) and ofcourse Torvalds are amazing imho. They're all successful because they're good AND are all nazi's in someway. Believing in yourself is key is what they show. Be self made. Also huge fan of Bob Nystrom.
  • 2
    @retoor this reminds me of ID software releasing their early games as open source. Also reminds me of the Descent devs releasing their code too. They said they want people to see that production code isn't necessarily the best quality code. Which is a really interesting position to take.
  • 2
    Regarding own skills i'm happy, i'm good in the parts that matter to me. That includes professional soft skills regarding ticket administration and project management.

    I have two major down sides tho:

    - I can't visually design anything. Literally. The visual template of my chatbot is GPT generated. People care too much about design to use my own.

    - I can't write nice consistent documentation for some reason while i'm very consistent in coding. I have no idea how it's possible, i can talk unlimited about my work and do understand everything on a deep level. So why can't i document?

    On job interviews where I apply as backend developer I always joke that i've never made smth beautiful (to emphasize i'm backend) and people think it's funny to say such stuff. But it's really true. I did almost every common language professionally in exception of C, C++ and Rust. First one can't find a job in. C++ has too many ways to rome. Rust syntax just doesn't attract me. I love malloc
  • 1
    @Demolishun since you're a professional C dev, please take a look at my (start) of an ORM in C: https://retoor.molodetz.nl/retoor/.... It's in development. Be aware - it's made to have a beautiful easy API that is both usable in C and in Python using shared object. Look the sorm.py to see how I got variadic args implemented in both C and Python.

    Can you tell me if you see some very obvious mistakes? I wrote a lot C, but do not have many C devs in my environment and no professional experience in it because there are no software jobs in it. It's all embedded and PLC-related. But also in PLC world it becomes more bascom and stuff. Mitsubishi and Siemens both prefer other language afaik. I've did automation with Delphi in a factory regarding HUGE recycling processes. Exited that job because the zero fault tolerance was a bit too much for a ~20? ~22? year old. Imagine also that most my age were still students and enjoying life and I was like - wtf i'm doing taking so much shit?
  • 3
    people always say you'll learn so much from reading others' code but that has never happened to me

    I've never found someone's code to be good

    I don't know what's wrong with me

    I can spot when people have a natural talent for coding though. seems either you can code well or you can't, and it's really obvious early on

    I met a guy in screeps I was TREMEDOUSLY fascinated about. still remember his name. mastodon. I don't know who he was. he was in the same block as me, he was a newbie, and he conquered the whole game just about in a month. I saw his codebase's functionality evolve over time, and he must've been a god. then he left because he won everything and probably got bored. I never talked to the guy and I wish I did. the rare times I meet someone impressive I get like, too nervous. wish I saw his code, too

    ---

    most code I encounter I could rewrite in 1/10th the lines and remove all that convoluted logic, so that's for "worst". everything is the worst.
  • 3
    The more you know the more you understand you know nothing.

    That's one big truth that never fails.

    If you think you know, you're too young and inexperienced to know
  • 3
    @Hazarth stages in development:

    - beginner, i don't understand all those libs because i barely know the language and will do it myself instead of using libs. Libs are intimidating.

    - bit experienced, able to learn and use stuff from others. You're not gonna make shit yourself right? Let's glue everything together! Progress!

    - hmm, I need only certain functionality from a lib. let's find out how it works and write my own. And then making it actually better.

    It starts and ends with doing shit yourself. Many devs keep stuck in the middle. Sadly, the one in the middle is kinda the job mostly. During job you can't write your own libs for sake of quality. You're stuck with TTM
  • 2
    @retoor

    > During job you can't write your own libs for sake of quality. You're stuck with TTM

    During job, you can use lower-lever api instead of bringing another dependency for a thing you could write in 10 minutes.
  • 0
    @antigermanist yeah at some workplaces you have to go through legal to use packages

    sounds like a nightmare

    then also if you upgrade a package you have to go through legal. aka nobody is updating them

    at that point it's more comfortable to have internal libraries. at least you can update them
  • 1
    This one is a toughie.

    The worst, not really programmer, but sysadmin, I've met, would clearly be the sysadmin of a previous company.

    He would systematically refuse to either give us access to the dev VMs or set up cloudwatch so we could have some observability on issues. (Namely because he didn't know how to).

    He'd also keep all ssh keys for every VM in the bastion host of the vpc... Because he didn't know about ssh -J...

    He'd also systematically fail to renew every certificate because he didn't know how to set up certbot. (Claimed that he didn't trust certbot, and that he had his own alarms set for it). Curious that they never worked...
  • 1
    The best, I'd have to say one guy that I completely lost track of, that worked with me on wowd/antrix/ascent before we both went on to actually work for the big B itself.

    He could do fucking magic with networking code, and is still the guy I've learned the most from in that aspect.

    With time, I've found out that I only find such gems more and more rarely, and it's too be expected.

    I watch and learn like a sponge, so it was bound to come the time when I'm the one teaching, and not learning, which by all means I still do, but it's harder to do now unless I get into really specialized fields.
  • 0
    Had to think about this rant again. As some of you know, I invest a lot of time writing programming languages myself. It's not a goal to be fastest / having best syntax (because, both i won't win) but the cleanest source code. That's very opinionated, so it is something i can win. But then I discovered the wren language and decided that it was game over, it was exactly written with the quality I had in mind. But wren is dead. But now, I see this fucker: https://github.com/vtereshkov/.... That guy can code! Wtf. If you can make a programming language look that easy has he does in this repository, you're a true dev. That the source isn't impressive is fucking impressive. So far, two projects are made with my quality in mind. So, Wren and Umka. Sqlite3 doesn't apply here because I have no fantasy or even an idea how a database should be designed or what it takes. Can't have opinion about database.

    But damn, the Umka source is nice. It made me touch myself and stuff
  • 0
    @jestdotty if you've never found someone's code good, review this one for a bit: https://github.com/vtereshkov/...
  • 0
    @antigermanist lower api generally costs more time right. But really, I really don't use dependencies anymore. uuid4? I've learned how to write that fucker. Base64? Same situation. How HTTP BasicAuth works and a big part of HTTP/WEBDav protocol? Same. I can write a complete server without dependencies. I know that those are things you would normally never write yourself since it has no benefit but while creating such stuff, I've learned so much stuff that every library is considerable for a rewrite. I'm even doubting a vector database at the moment - have to do more research if it's doable. Sqlite3 and python barely have dependencies. And you know what? Both compile straight out of the box while being huge in source. That's dem dream. Also, that feeling of knowing literally your whole project is so satisfying. A node (frontend, backend is ok) never feels like my own. Its 99.99% someone else his code. It's like you did a small patch to it.
  • 0
    @CoreFusionX Certbot is outdated. Go caddy or go home is the word on the street.

    What does -J has to do with storing ssh keys on a bastion host? I mean, you can do that, but what does it have to do with storing keys there?
  • 0
    @CoreFusionX much respect for people who are advanced in networking. Sockets is my fetish for a decade and I bought a book about the low level C API eventually and read it whole. By that time, I still have learned stuff about network, but not really about the C socket API anymore. If you understand the socket API from C, you understand them automatically in nearly any language.

    But then, a few weeks ago, I was like, wtf is a correct buffer size? I mean, we can't be using 20 years the same values right? Stuff changed. I used for local development values like 1Mb and stuff, just because it's possible and it went faster than 4096. Sure, but it doesn't get harder than 256 or 512. Depends also on the socket option you can set for that. Weirdly enough, NO tutorial and even the book says ANYTHING about setting socket buffer size using an option. NO ONE does this for some reason.

    Were you familiar with setting sock buffer size using an option? I really researched a lot, I didn't
  • 0
    @retoor

    This was in a time certbot was the only option. So not really a choice.

    -J in ssh is shorthand for proxyJump.

    The only point of a bastion host is to bridge resources in a private subnet to a public subnet so they can be accessed.

    But the way to do that, is that people hold the privkey to the bastion *and* to those resources they need to access, and you use ssh -J <bastion> <actual target>, to access, so that you first connect to the bastion, and from there, ssh connects to the resource only reachable from the private subnet.

    If you store all the private keys to all the private resources on the bastion (moreso, on a publicly accessible directory), what's the point of having a bastion at all, you just made it so anyone with access to a single resource has access to them all.
  • 0
    As to socket buffer size, it's really a relic of old times, but can still bite you in the ass.

    The official documentation says (for both BSD and Winsock) that the implementation can withhold recv calls until the recv buffer is full, and withhold sending until enough send calls fill the buffer.

    That's, of course, still true, but it's a relic of a time where CPU cycles were at a premium, and it was in everyone's best interest to just move a whole ram page of socket data into ram or disk.

    Modern solutions in kernels based on kqueue/epoll don't really need to rely on buffer size and if the CPU has the slightest amount of time available on the scheduler, you'll get your recv/send back in no time, no matter how small the payload is.

    By the way, part of our breakthrough work in having antrix support up to hundreds of simultaneous clients without degradation was intimate knowledge of epoll and kqueue.
Add Comment