Live data from Hacker News

TerrariaClone – An incomprehensible hellscape of spaghetti code

github.com

281–289 of 289 posts

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#281

Earlier quoted context omitted.

There's a tension between "everyone writes some of it" and individuals having autonomy to focus and make decisions. If everybody has autonomy in a shared codebase, you end up with a heterogeneous spaghetti of unrelated design decisions and styles overlapping everywhere. To solve this, you normally end up with a hierarchy of authority, where most people have to have their work vetted by seniors. In this process, peopl…

> If everybody has autonomy in a shared codebase, you end up with a heterogeneous spaghetti of unrelated design decisions and styles overlapping everywhere. "everyone writes it" in the long term can still allow specific people to write/fix/augment/refactor/etc specific parts in the short to medium term. i think it's a good goal to never have a part of the code that less than two or three people can maintain, but pref…

Great points. By "act on their own vision" I mean technical vision, the how to solve a problem, not which problem to solve. In my experience this is where many engineers become depressed and want to quit. They're interested in the problems the company is solving, but when implementing solutions they become bogged down in myriad rules with which they do not agree. Coding style is simple enough to adapt to. Having to follow a technology stack, core architecture, and core APIs that you find unintuitive is harder. In fact I'd venture to say (as a corollary of Conway's law) that companies that follow the "everybody writes some of it" style breed narrow monocultures, where everybody sees things roughly the same way.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#282

Earlier quoted context omitted.

There's a tension between "everyone writes some of it" and individuals having autonomy to focus and make decisions. If everybody has autonomy in a shared codebase, you end up with a heterogeneous spaghetti of unrelated design decisions and styles overlapping everywhere. To solve this, you normally end up with a hierarchy of authority, where most people have to have their work vetted by seniors. In this process, peopl…

If everybody has autonomy in a shared codebase, you end up with a heterogeneous spaghetti of unrelated design decisions and styles overlapping everywhere. Being free to do things your own way often means choosing not to do something if it's going to negatively impact other people. Once you realise that you need to think about the way your decisions impact other people you quickly realise that compromising on your cho…

Good point. I think what you're hinting at is good if all or the vast majority of people are on board. In my experience this is not generally the case. People usually climb up the authority ladder not because they are emphatic toward others, or because they compromise on their choices to help the team, but because they solve technical problems and deliver product to customers, often while cutting corners and making executive decisions in the code base. More junior and newer people are at the whim of these more senior people, regardless of whatever egregious technical decisions they like to make.

The microservice approach has its own problems but hints toward a direction where teams are small and autonomous, with ground-up freedom on the architecture of their little service and free from draconian oversight. I'm not an advocate of microservices, but it's an approach that hints at something different.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#283

Earlier quoted context omitted.

There's a tension between "everyone writes some of it" and individuals having autonomy to focus and make decisions. If everybody has autonomy in a shared codebase, you end up with a heterogeneous spaghetti of unrelated design decisions and styles overlapping everywhere. To solve this, you normally end up with a hierarchy of authority, where most people have to have their work vetted by seniors. In this process, peopl…

Strict hierarchies suck because if you're a leaf in the hierarchy, it's very difficult to collaborate or work with other leafs that are not in your same sub-branch. A flat fully connected hierarchy is better for small groups, but it doesn't scale well as the number of lines of communications is proportional to the square of the number of people.

A large set of small loosely-connected groups is an alternative. Groups can communicate with other groups on a need basis. This might be a pipe dream. Some would argue that the emergence of an uber-group that every other group must subordinate to is imminent.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#284

Earlier quoted context omitted.

Holy shit. Be sure to read the issue. It turns out it's not really a joke - someone in the know points out that Terraria's code is basically the same quality, if not worse...

You used to be able to decompile Terraria into perfectly readable code, since its c# and they didnt use an obfuscator. The code base was atrocious, but it is impressive that they got something working, and pretty fun, together as quickly as they did. These days there are a fair amount of production Unity games out that you can extract full sources for.. Can make for a fun read sometimes.

I think Unity forces you into a pattern that you are not used to, this can easily get you out of your comfort zone resulting in very funny architecture before you get used to it.

The concept of GameObjects, Components and MonoBehaviours and best practices for how they should be composed isn't exactly obvious. Eg when adding two components of the same type to a GameObject it's hard to know which one of them is which (eg two colliders: one for triggers and one for physics) so instead you add two sub-Gameobjects each with that component attached and use gameobject.GetParent() to modify the parent. Is that best practice or not, i don't know, i just did it and it works but it certainly feels strange.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#285

Earlier quoted context omitted.

> On their own, % and / are way slower than +, -, *, >. And the branch instruction is free??

More or less, assuming you can predict it. But there's a penalty for misprediction. So it boils down to whether using % frequently (either as a native instruction or as a sequence of instructions) is more or less expensive than predicting a branch frequently, given a certain misprediction rate.

> More or less, assuming you can predict it. But there's a penalty for misprediction.

Yeah, no, that's not free.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#286

Earlier quoted context omitted.

More or less, assuming you can predict it. But there's a penalty for misprediction. So it boils down to whether using % frequently (either as a native instruction or as a sequence of instructions) is more or less expensive than predicting a branch frequently, given a certain misprediction rate.

> More or less, assuming you can predict it. But there's a penalty for misprediction. Yeah, no, that's not free.

Ok, so what changes would you make to my explanations?

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#287

Earlier quoted context omitted.

Strict hierarchies suck because if you're a leaf in the hierarchy, it's very difficult to collaborate or work with other leafs that are not in your same sub-branch. A flat fully connected hierarchy is better for small groups, but it doesn't scale well as the number of lines of communications is proportional to the square of the number of people.

no it's not, broadcasting is linear, alas its not strictly parallel.

Each person can broadcast at any time. So at any time, it's possible to have N^2 messages being sent around the company.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#288

Earlier quoted context omitted.

Comments like this kill me a little on the inside, I can't stand having real work devalued for the sake of contrived assessment criteria.

well the AP comp sci test stuff is not all contrived. it is also useful to know (mostly)

[deleted]

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#289

Earlier quoted context omitted.

no it's not, broadcasting is linear, alas its not strictly parallel.

Each person can broadcast at any time. So at any time, it's possible to have N^2 messages being sent around the company.

That's a non-sequitur, I guess you mean if every sender sends one message per listener. I don't think it's a broad cast if it targets sole recipients per message.

Quite literally, I think, it could be modeled as a vector space in linear algebra. Each signal is in frequency space, which can be found from the fourier transform integrating the temporal space over different bandwidth channels per sender. You get N² only if the message size is proportional to N, if you will.

a Fourier transform of channel

Post reply on HN