this post was submitted on 08 Dec 2024
274 points (99.3% liked)

Programmer Humor

32716 readers
591 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
all 15 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 15 points 2 weeks ago (1 children)

One time, we were drawing a state diagram of how the core loop in our application should behave. So, you know, first you have the preparation state, then when that succeeds, you go to the getting-things-ready state, then into the actual doing-things state, then the result-reporting state and so on. So, there was exactly one happy path.

Then we figured, we should also diagram all the error scenarios. If an error occurs in the preparation state, we should transition to the result-reporting state. But if an error occurs in the getting-things-ready state, we'll need to go to an intermediate cleanup state before we go to the result-reporting state, and so on.
As we added more and more error paths, the arrows had to curve more and more, until the whole diagram eventually looked like an onion. That's when I knew, we were doing real software engineering. ๐Ÿ™ƒ

[โ€“] [email protected] 4 points 2 weeks ago (1 children)

I find making a state machine diagram before actually implementing an app is a really good approach because it forces you to think through the failure cases up front. What often happens toherwise is that you end up focusing on the happy case, and then error handling ends up being bolted on as you discover failure cases in production. This article is a great read on the subject https://shopify.engineering/17488160-why-developers-should-be-force-fed-state-machines

[โ€“] [email protected] 6 points 2 weeks ago (1 children)

I mean, yeah, I wrote it kind of humorously up there, but I do actually think state diagrams are a good idea and modelling the known error paths is part of real software engineering.

However, I've never been in a project where anyone knew nearly enough about what we're supposed to build, to be able to draw a state diagram before we got started. We would rather do a refactoring halfway through and then we would design a state machine to fit the requirements...

[โ€“] [email protected] 3 points 1 week ago

It is important to keep in mind that any software ends up being a living thing. Even if you know all the requirements up front, which you almost never do, they're inevitably going to change down the road. Customers will want new features, business might pivot what they're doing, and so on. It's pretty much inevitable that the software will keep evolving. It's key to recognize this and design things in modular fashion so you can evolve things in a sane way as the need for changes comes up. That said, I find you can start small and figure out what the MVP looks like, then go from there. You can draw out the bare minimum and then use that to interrogate the project manager to make sure it matches what they're expecting.

[โ€“] [email protected] 6 points 2 weeks ago (2 children)

Pro tip, cut your onion in a well ventilated space. Like for example crack a window over the counter that you are cutting on, it will greatly reduce the effect, and it doesn't even need to be wide open

[โ€“] [email protected] 15 points 2 weeks ago (3 children)

Iโ€™m not very acquainted with analogies so can you help me with understanding the software part of this?

[โ€“] hollyberries 10 points 2 weeks ago

No matter what you do, crying is inevitable.

[โ€“] [email protected] 3 points 1 week ago

......use Windows on an air-gapped PC to do all your software development? At least then hackers won't steal your source and post your shameful code on the internet.

[โ€“] [email protected] 1 points 1 week ago

I have the kitchen vent running and oh my god it does not help one bit. I think I'm especially sensitive though. I remember as a kid, my eyes would water sitting in the living room as my dad cooked in the kitchen.

Not that the fumes can't go around but there was a wall between.

[โ€“] [email protected] 3 points 1 week ago

I usually wear contact lenses and they help with not crying from onions, but they don't help with Software.

[โ€“] [email protected] 2 points 1 week ago

Just one more abstraction bro.

[โ€“] [email protected] 1 points 2 weeks ago (2 children)

You know, not everybody likes onions.

Cakes! Everybody likes cakes! Cakes have layers.

Why can't software be like cakes?

[โ€“] [email protected] 4 points 1 week ago

Software is like cake. The more you consume it the shorter your lifespan.

[โ€“] [email protected] 3 points 1 week ago

I find most people start out with the aim of baking a cake, but end up making an onion in the end.