Agree with this so much. One of the main things that I try to do is ensure that the turn around time between testing and writing code is as short as possible. As an example I inherited a codebase about 2 years ago that would take 15 minutes to run the test suite. It was painful. It was just long enough that it would waste an entire day just trying to implement a simple feature. The project was behind schedule and no…
Another much under-utilized way to speed up test suites: delete tests
3 lines of code shouldn't take all day
31–40 of 213 posts
Re: 3 lines of code shouldn't take all day
#32Re: 3 lines of code shouldn't take all day
#33Whilst I very much agree with the premise I do think this exposes a fallacy many programmers fall for. That passing unit tests means your code actually does what you think it does. Using unit tests this way is a crutch to avoid improving startup times, implementing hot reloading and other schemes to skip gameplay. You lose an awful lot by not testing your code for the job it’s actually expected to do in situ. In game…
You need both. If you don't have unit tests your feed back loop becomes way too slow, but then you of course have to test the "real" running of the program properly before shipping. And you need at least one person who didn't write the code to test it.
Re: 3 lines of code shouldn't take all day
#34Agree with this so much. One of the main things that I try to do is ensure that the turn around time between testing and writing code is as short as possible. As an example I inherited a codebase about 2 years ago that would take 15 minutes to run the test suite. It was painful. It was just long enough that it would waste an entire day just trying to implement a simple feature. The project was behind schedule and no…
Another much under-utilized way to speed up test suites: delete tests
It moves the deletion as a means towards the coherence rather than as an end in and of itself, and also includes refactoring as an option.
I hope it helps the less experienced developers grab the intention more explicitly.
Re: 3 lines of code shouldn't take all day
#35Agree with this so much. One of the main things that I try to do is ensure that the turn around time between testing and writing code is as short as possible. As an example I inherited a codebase about 2 years ago that would take 15 minutes to run the test suite. It was painful. It was just long enough that it would waste an entire day just trying to implement a simple feature. The project was behind schedule and no…
For some reason not many people like the "maintenance" type of work.
Even more so in a lot of orgs maintenance work gets hit by the "cost center" mentality and management only rewards not hearing about it.
Re: 3 lines of code shouldn't take all day
#36Earlier quoted context omitted.
For some reason not many people like the "maintenance" type of work.
The reason is simple. Maintenance work doesn't progress your career. Why bother?
Even if the whole project has no career purpose, it's more fun to write new code.
Re: 3 lines of code shouldn't take all day
#37In other words, reducing the iteration time reduces the motivation to get it right the first time, and the associated deep reasoning/"mental execution" skills which are required to do so. In order to develop those skills, one should strive to write as much code as possible before running it, and a high iteration time assists with that.
Also, I'm tempted to continue the title with "...unless it's APL".
Re: 3 lines of code shouldn't take all day
#38However, the experience itself feels like a positive one - even if the code takes longer to craft, it's much easier to work with, since now i don't need to worry about sloppily written if/else chains that depend on enums or runtime type checks, but can utilize different implementations as needed. Also, writing the actual tests allowed me to be sure about how everything would actually work, all the way up to discovering that Paths.get (Java) on Linux accepts almost anything as a valid path string, whereas Windows has actual validation rules, leading to many headaches in regards to the code coverage quality gates that i set up, since the coverage differs based on which platform you run on.
But i guess that my point still stands: in certain circumstances slowing down might actually be a good thing, when you really want to know how your code will work under most circumstances and make it maintainable.
Of course, on the other hand, compilation speeds and other factors in regards to the speed of iteration definitely shouldn't be overlooked either, and having everything else apart from writing tests and actually thinking about how everything will fit together be faster is a good thing! I'm not sure what i'd do if my test suite took 10 minutes to run instead of 10 seconds as it currently does. Probably drink lots of coffee.
I guess it depends on slowing down for good reasons, vs just wasting time because of tooling or other sub optimal circumstances (e.g. what was described in the article, personally i've also seen a local API service be pretty chatty with a remote DB which was slow over a VPN, yet no one had a local DB with all of the migrations in place, and a bunch of other things like that).
Offtopic: Anyone remember how fast Pascal compiled? Now that was a really nice stack to do some stuff in, it's a shame that it never got as popular as Java, or didn't have tooling like JetBrains has, it felt like a more ancient Go (which is also pretty good as far as ergonomics go).
Re: 3 lines of code shouldn't take all day
#39And while this strategy might work for the folks who actually wrote the code (and thus have tacit knowledge about it), the moment they leave and/or someone new joins the team, all that "speed advantage" is lost and it turns from minutes to hours to days instantly.
Automated tests really are the only way to capture the business logic of any code for it to not to become "legacy code" before its time.
Re: 3 lines of code shouldn't take all day
#40For all the issues I have with Elon Musk, I really like his design philosophy. Step 1 Make it less dumb Step 2 Delete a part of the process If you're not adding step in 10% of the time, you're not deleting enough Step 3 Simplify or Optimize Step 4 Go Faster Step 5 Automate