Live data from Hacker News

TerrariaClone – An incomprehensible hellscape of spaghetti code

github.com

151–160 of 289 posts

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#151

This makes me miss my early days of programming, where no code was too verbose or horrible to stop me from progressing towards my goal, no matter how misguided I was. Nowadays I'm distracted by the first hint that there might be some better way, and all progress stops. I think I'm just beginning to recognize this, and maybe one of these years I'll learn to recognize when the right abstraction is really important and…

"first you learn the value of abstraction, then you learn the cost of abstraction, then you're ready to engineer" https://mobile.twitter.com/KentBeck/status/25831623306839654...

"Any problem in computer science can be solved with another layer of indirection"

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#152
Normally when I hear people disparage their early attempts at code, I think to myself, "Oh, come on... how bad can it be?" Well, this is bad. Really, really bad.

On the other hand, there was nowhere to go from here but up. Gotta start somewhere, right?

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#153
post #82

When I first started programming (this was in C++), I decided that the obvious optimisation was to declare all these redundant local indices i,j,k as globals. Then the program won't need to make all this redundant crap! Of course that led to absurdly subtle bugs that only occasionally showed up since whenever I called a function which had a loop in it from inside of another loop, I would use i as the index for both l…

Original author here.

The fact that all the methods were so ridiculously large made declaring loop indices globally less of a problem. But trust me, it caused plenty of bugs... :P

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#154
post #92

I would love if we could get together as a community, take a project like this, and use it as an example for what a little refactoring can do. As a cooperative endeavor it should be doable, but a competition would be more fun, though I can't imagine how you'd judge such a thing.

See https://github.com/BusyByte/TerraFrame/pull/1.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#155
post #69

Earlier quoted context omitted.

My inherited spaghetti codebase took only 24 months for my predecessor to build. I was told: "don't worry, it's in SVN and all of the important switches are clearly laid out at the top." Well, it was in an SVN repo... with a single commit. It did have all the important switches at the top, none of them but the ones that were set actually worked. Man, I "miss" that job.

Was the comment of that commit 'initial commit'? :)

Yes. It actually was LOL

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#156
post #108

This makes me miss my early days of programming, where no code was too verbose or horrible to stop me from progressing towards my goal, no matter how misguided I was. Nowadays I'm distracted by the first hint that there might be some better way, and all progress stops. I think I'm just beginning to recognize this, and maybe one of these years I'll learn to recognize when the right abstraction is really important and…

As I had to work more with teams and then supervising teams I changed the abstractions I value from when I was programming solo: Now I care less about my project's function than the structure of the team. There is a saying that any complex project will end up mimicking the communication structure of your organization. I must confess I thought it was silly until I realized it happened to us. I now favor code that has…

> allows programmers, these very territorial beasts, to have their own little realms they control

My 25 years of programming experience says otherwise. The only place where this works is with good(ish) programmers who are assholes and must have their huge, fragile egos stroked or they'll throw a diva fit. I don't hire or work with those people anymore. Neither should you.

Joint code ownership produces better code because everyone wrote some of it and nothing is mysterious.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#158
post #108

Earlier quoted context omitted.

As I had to work more with teams and then supervising teams I changed the abstractions I value from when I was programming solo: Now I care less about my project's function than the structure of the team. There is a saying that any complex project will end up mimicking the communication structure of your organization. I must confess I thought it was silly until I realized it happened to us. I now favor code that has…

Absolutely this. Some people think silos are bad, but it absolutely works brilliantly in terms of team cohesion. No stepping on toes. Few arguments because everyone is responsible for their own stuff. No nitpicking over irrelevant style preferences. Pride in ownership, self accountability, thoughtful decision making (mostly). All this leads to good working relationships that come in handy when cross-realm issues aris…

Until someone goes on vacation, their area blows up and everyone else has to panic fix some code that they've never seen before.

As a manager, one of my main jobs is ensuring that the team's bus number is always above 1 and scheduling vacation time so that we always have full coverage should stuff go down. There's a huge difference between a silo and giving someone responsibility for driving the design of a component/module. The latter is great, the former is a failure of the team's leadership. You can still get pride of having built something even if you're building it for the team and, through code review, the team is accepting ownership. But individual ownership of key pieces of code has been responsible for most of the top-10 shit storms I've seen in my career and I'm never letting it happen on a team I manage ever again.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#159

This makes me miss my early days of programming, where no code was too verbose or horrible to stop me from progressing towards my goal, no matter how misguided I was. Nowadays I'm distracted by the first hint that there might be some better way, and all progress stops. I think I'm just beginning to recognize this, and maybe one of these years I'll learn to recognize when the right abstraction is really important and…

It is often impossible to write code the first time anyways, just do it, realize your technical debt, and come back and refactor it when the better abstraction is more obvious (if any).

Compression oriented programming - https://mollyrocket.com/casey/stream_0019.html

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#160
post #108

Earlier quoted context omitted.

As I had to work more with teams and then supervising teams I changed the abstractions I value from when I was programming solo: Now I care less about my project's function than the structure of the team. There is a saying that any complex project will end up mimicking the communication structure of your organization. I must confess I thought it was silly until I realized it happened to us. I now favor code that has…

> allows programmers, these very territorial beasts, to have their own little realms they control My 25 years of programming experience says otherwise. The only place where this works is with good(ish) programmers who are assholes and must have their huge, fragile egos stroked or they'll throw a diva fit. I don't hire or work with those people anymore. Neither should you. Joint code ownership produces better code bec…

> Joint code ownership produces better code because everyone wrote some of it and nothing is mysterious.

I don't think it's one or the other. You need people to be able to jump in and contribute and improve things.

But you also need responsibility for the code as a body of work. If everyone with commit access owns the code, nobody does. As time goes on and it's a snarl of spaghetti code and slapdash design, it turns out it was nobody's job to make sure that didn't happen.

Post reply on HN