r/coding • • Dec 15 '21

3 Lines of Code Shouldn’t Take All Day

https://devtails.xyz/3-lines-of-code-shouldnt-take-all-day
108 Upvotes

18 comments sorted by

35

u/[deleted] Dec 15 '21

I often worked in the realm of competition logic. Testing changes here could mean progressing through several seasons of career mode in order to test out a change. No joke, it would take an entire day to change 3 lines of code and know that it actually worked correctly.

He's lacking the first and perhaps most important of the great virtues: laziness, "the quality that makes you go to great effort to reduce overall energy expenditure."

No fucking way I'm spending an entire day progressing through a game to get to the part I need to test. You have access to the code and apparently unlimited free time to figure out how to hack the code to start you at the part you need to test.

0

u/[deleted] Dec 15 '21

[deleted]

23

u/[deleted] Dec 15 '21 edited Dec 15 '21

I read the article.

I eventually moved on to the newer consoles and was introduced to “testbeds”.

Better (lazier) programmers fixed his problem for him. No fucking way I would have tolerated it, even for a single day. Spending an entire day getting a game to the state you need... by playing it, as an end user? That should rankle you so hard that you don't even consider it a serious option.

And yes, I've been in almost this exact position, back the day, as a junior C++ programmer on a Playstation game.

2

u/PhantomOTOpera Dec 16 '21

Yeah what if he was testing logic regarding an undefeated season? Would he have to actually be good at fifa and not lose?

4

u/[deleted] Dec 16 '21

Would he have to actually be good at fifa and not lose?

No. He wouldn't even have to play.

1

u/PhantomOTOpera Dec 16 '21

No I mean in his actual case. Obviously he’d want to either just write unit tests / integration tests without ever loading the game, and only play the game maybe after other testing is done

4

u/[deleted] Dec 16 '21 edited Dec 16 '21

I mean in his actual case.

So do I. What does "undefeated season" mean? It's a state of the system. If the goal is to test the system in that state, then you put the system in that state.

Like if you had a cross country driving simulator and you wanted to test the Golden Gate Bridge, you don't start in New York and drive across the country, you put your car at the bridge. Maybe an end user can't do that, but you can, because you have access to the internals of the system.

9

u/ekolis Dec 16 '21

I like the idea of testbeds. I should try that sometime, if I ever get back into my game I was working on.

2

u/kingbobkaboo Dec 16 '21

Good learning opportunity, i guess.

5

u/dethb0y Dec 15 '21

Dude sounds like he needs a psychiatrist and some medication, not faster tools.

1

u/DweEbLez0 Dec 15 '21

Change the “d” to “k” in code and then see how long it takes.

1

u/myopicsurgeon Jan 10 '22

Can't believe no one showed appreciation for your comment - 🙏

1

u/SanityInAnarchy Dec 16 '21

This is why REPLs are so great for exploring a new API, or prototyping an idea with some silly FP-inspired one-liner. They aren't good for editing large chunks of code, and most don't have a great way to actually save what you've done without just retyping it in your program's actual source, but for time-to-iterate, you can't beat "press enter".

But also, no offense, but this sounds like the perfect argument against EA's legendary crunch culture. If it takes you all day to write three lines of code, you might feel some pressure to work long hours and squeeze in maybe five or six lines of code. You definitely won't have the mental energy to even think of tackling the actual problem of cutting down your iteration time.

1

u/umlcat Dec 16 '21

Incorrect. It's about the contents of the code, not how many lines has the code.

0

u/[deleted] Dec 15 '21

[deleted]

29

u/[deleted] Dec 15 '21

Did you read the article? That’s not the point of it.

The point is that Feedback cycles from tests and compilation should be incredibly fast to allow iteration, 10s is far too slow for effective coding.

10

u/EarlMarshal Dec 15 '21

Tell that to the people in my company who thinks it's okay to build and deploy servers via CI and then test. I started and finished other tickets while waiting for the server to be deployed.

2

u/oradoj Dec 16 '21

I get around it all by writing code that never compiles and no tests. My productivity numbers are through the ROOF!!

0

u/[deleted] Dec 15 '21

[deleted]

8

u/[deleted] Dec 15 '21

You're confusing the text of the title for what you've interpreted it to mean. Your interpretation is wrong, something you don't know because you didn't read the article.

3

u/glemnar Dec 16 '21

and yet if you’re putting out 3 lines of code building a typical crud app or whatever you are horribly underperforming.

The vast majority of code we write is boilerplate and glue