Lurker News
I think I've broken my own record with this one ~2500 lines of incoherent JavaScript/C#. Works though.

Comments (578) 119 threads

Show all comments

Showing thread 8 of 119

gnulinux18 replies#
We have absolutely no idea how to write code. I always wonder if it's like this for other branches of engineering too? I wonder if engineers who designed my elevator or airplane had "ok it's very surprising that it's working, let's not touch this" moments. Or chemical engineers synthesize medicines in way nobody but a rockstar guru understands but everyone changes all the time. I wonder if my cellphone is made by machines designed in early 1990s because nobody was able to figure out what that one cog is doing.

Software is a mess. I've seen some freakishly smart people capable of solving very hard problems writing code that literally changes the world at this very moment. But the code itself is, well, a castle of shit. Why? Is it because our tools (programming languages, compilers etc) are still stone age technology? Is it because software is inherently a harder problem than say machines or chemical processes for the human brain? Is it because software engineers are less educated than other engineers? .....?

abledon#
Your 2nd to last one is right I think. Other forms of engineering are constrained by physical world rules. In software we have to recreate reality and redefine and model how the real world system works. Mech eng/ chem eng etc don’t have to recreate reality , physics just works and will always work .
b_t_s#
I think it's because software is inherently easier and less critical...castles of shit actually work. Software is fairly unique in that level of quality and reliability needed to have significant economic benefit is very low, and the consequences of system failure are rarely severe. That's not the case in most branches of engineering. The complexity levels are also off the charts, in large part because economic value is so loosely coupled with quality. In many cases more turds are more profitable.
52-6F-621 reply#
>I wonder if engineers who designed my elevator or airplane had "ok it's very surprising that it's working, let's not touch this" moments.

I honestly sometimes do wonder. Judging by the elevators in my building some things even barely work at times. They go down often and require parts replacements that take weeks to arrive. They're barely 3 years old.

krallja1 reply#
> They go down often

Isn’t that one of the two main features of the product?

gnulinux1 reply#
"to go down" means "to be in a non-functional state" as in "Facebook went down". Compare to "to go up" like "servers are up" i.e. servers are functioning.

Continue this thread — 1 reply

enjoiful2 replies#
The difference is, an elevator is a precisely defined problem and never needs to have its functionality improved and changed.

In fact, you could build the exact elevator almost identically. Software is never like that — it’s dynamic and constantly changing throughout the life cycle of the software.

Invictus01 reply#
> an elevator is a precisely defined problem

Ha! As a mechanical engineer, no, nothing in reality is ever precisely defined. Consider that every single part in the elevator has a tolerance: none of the parts are exactly the same in every elevator. Did you account for thermal expansion? What about wear? Fatigue?
> Software is never like that — it’s dynamic and constantly changing throughout the life cycle of the software.
But elevators need to be shipped right the first time and can't make mistakes; with software, it almost never works perfectly no matter how much time passes.

gnulinux6 replies#
> with software, it almost never works perfectly no matter how much time passes.

There is a person inside me -- whenever this is said -- that wants to shout "No! You can prove correctness of your program!". But this complicates the issue even more, since afaik no elevator's correctness is proven but it just works. Mechanical stuff somehow just magically work without proof whereas it's still debatable if proven software works (did we prove the software that proved it?). I don't know what's the difference. Maybe elevator has a well-defined structure, it goes up and down, opens the door etc, even though implementation can change (as you explained). But maybe software isn't like that. Idk.

Continue this thread — 6 replies

buitreVirtual#
Indeed. Writing software is akin to drawing the design of the elevator, not building an individual copy of the elevator. Each elevator is equivalent to one instance of the software deployed to run in one place. The same design/code is used to build/create multiple instances. So when we write new software to solve a new problem, we are designing something new and unique - not another blueprint for the same elevator.
pier25#
The best code I've written is when rewriting some code from scratch having a clear picture of the solution, or when I solve the same problem a couple of times.

Solving complex stuff takes a lot of effort, and usually most companies do not have the resources or the motivation to go back and rewrite a product.

sonnyblarney1 reply#
Brilliance is not indication of an ability to write clean code.

In my experience, code needs to be re-factored 3 times before it starts to look coherent and clean.
But 99% of projects can't justify that kind of expense.
But good code is very feasible, just takes time.

james_s_tayler1 reply#
I'll expand this further by saying yes to all of the above with the addition that to get it perfect in my experience requires about 7 iterations.
sonnyblarney#
Yup. Diminishing returns on that though. I'm happy with 3. Unless it's API or public code used by a wide audience then it needs a lot of eyes and has to be very clean.
twblalock1 reply#
It's because software that solves the problem the business intends to solve, and can be maintained without unreasonable time and effort, is good enough. Code readability and maintainability problems are not business problems unless they impact developer productivity to the extent that feature development becomes too slow to tolerate.

After all, if work inside the codebase does not make a difference to the people who use the software, in terms of reliability or features, is it really worth doing?
The trick is to find a balance where efforts to improve code quality actually improve outcomes for the business and the users -- otherwise it's not justifiable to take time away from feature development, which is what the users actually care about.

rabidrat#
not all software is solving a "business problem". sometimes it's academic, or hobby, or government. but always the code is shit.
booleandilemma#
We gotta finish these bridge foundations by this Friday, guys. The sprint ends next week and it’s a short week with Thanksgiving coming up.
pavlov4 replies#
It's like that in other fields of engineering too, when they are making something they haven't built before. That's the essential part: for example, a lot of construction is really just rebuilding the same thing that's already been built 100,000 times in the past 100 years.

When they attempt to build something new, it often ends up like software – tremendous overruns in both cost and schedule.
C.f. the only new nuclear power plant being built in the West, which is $4 billion over budget and ten years late: https://en.wikipedia.org/wiki/Olkiluoto_Nuclear_Power_Plant#...
The reason why this feels more commonplace in software is that we're usually designing something new. Software has essentially no reproduction costs, so there's no reason for anybody to design software that's a carbon copy of something you can already download or buy off-the-shelf. That's not the case in engineering of physical products or works. New buildings are needed all the time, even if they're performing exactly the same function as the building in the adjacent lot.

augustl2 replies#
> It's like that in other fields of engineering too, when they are making something they haven't built before.

Exactly this. I like to use an analogy of building bridges :)

  - OK, we have this valley and we want to drive cars over it. What do we
    do?

  - Hmm, we could just make the road along the bottom of the valley

  - Wouldn't that cause the cars to fall because of the steep angle?

  - Good point. Maybe if we built the road with a lot of twist and turns

  - Then it's a slow and long drive.

  - Maybe we could build some sort of catapult setup to throw the cars
    across the valley

  - That would make safety a concern though. Is there a way we could use
    helicopter rotors to suspend a road in mid air over the valley?

  - Or what if we attach the road to each side of the valley and make a
    road that's strong enough to not crack in the middle under its own weight?

  - Yeah, that sounds like a good idea. How do we make sure it can hold its
    own weight, though?

  - .....etc
exikyut#
Very interesting point.

I must admit that when I saw valley in
> OK, we have this valley
I immediately thought about SV, and then as I read
> - Maybe we could build some sort of catapult setup to throw the cars > * across the valley*
I imagined some kind of scenario happening in an alternate reality where a startup was trying to dream up a viable way to actually achieve this in SV.
It was funny because of the fact that a lot of the ideas people do come up with are probably ideologically very similar in magnitude and ridiculous impossibility.

majewsky#
> Maybe we could build some sort of catapult setup to throw the cars across the valley

This was played for laughs by German satire news website "Der Postillon" (like The Onion, but in German): "Department of Traffic to replace ramshackle bridges by jumping hills"
Nicely photoshopped picture at: https://www.der-postillon.com/2014/11/lander-ersetzen-marode...

C1sc0cat#
Or you find that the ground can't support the bridge and it collapses - If your lucky you find out before that happens and redesign the bridge.
lozenge#
Most software, including on this thread, is not truly new, or at least can be built from known, reliable tools and patterns.
z3t4#
The larger a code base grows, the worse it will get. Once in a while you get a problem that can only be solved by a "hack". And once in a while you need to make performance optimizations. Then time goes by, things are forgotten, the language changes, the OS get replaced, the machine gets replaced, etc.

Continue this thread — 8 more replies