4 ms·
Slightly offtopic but I have summarized my own 20 years of clean coding experience into a system: https://www.fabianzeindl.com/posts/the-codequality-pyramid ht
by fzeindl 4y ago
Slightly offtopic but I have summarized my own 20 years of clean coding experience into a system:
https://www.fabianzeindl.com/posts/the-codequality-pyramid https://www.fabianzeindl.com/posts/the-codequality-pyramid
- gavinhoward 4y agoI like that post of yours. If there's one thing I slightly disagree with, it's that I would put Code Performance below Test Performance, but that's because my personal experience ([1]) has been that code performance affects test performance more than anything else. But still, this is an excellent model, and I'm bookmarking it. Thanks! [1]: https://gavinhoward.com/2019/08/why-perfect-software-is-nearly-impossible/#feedback-must-be-fast https://gavinhoward.com/2019/08/why-perfect-software-is-near...
- tgv 4y agoI think that in terms of "what to strive for", the pyramid makes sense in a generalist way. And, code performance is, as you say, part of test performance. If the tests take too long, perhaps the code needs to be improved. OTOH, I have got a few test suites that run for 30 minutes or more, just because the search space is so big. But that's code that only needs to be tested once.
- fzeindl 4y ago> And, code performance is, as you say, part of test performance. If the tests take too long, perhaps the code needs to be improved. Yes. I mentioned this is in the last section. When test-performance is alright, typically you don't need to optimize code anymore. For me, optimizations in the "code performance" category are for example trading off a generalist API for a more complicated tweaked version that reaches into details and enables caching. The kinds of optimizations game developers do where they make the code less general and pretty, but more performant. > OTOH, I have got a few test suites that run for 30 minutes or more, just because the search space is so big. But that's code that only needs to be tested once. What are these suites testing?
- tgv 4y ago> What are these suites testing? One is testing all permutations of actions on some observability thingy: does everyone get the updates they requested in the correct order, basically, but suppose you have 3 "clients" that can connect and disconnect at arbitrary moments, and we're testing a single insert-like operation on the initial empty data, there are already dozens of combinations. Another one is some operation on two arbitrary JSON objects and an inverse, and I wanted to make sure that it works for things that look like normal looking objects, small and large, and for "random" objects. Fuzzing with hierarchical data. This code is in JS because it has to run in the browser, so it is not super fast.
- fzeindl 4y agoInteresting, thank you. > This code is in JS because it has to run in the browser, so it is not super fast. Try profiling heap allocations in Chrome Debugger. In my experience especially array-allocation can slow down JS-code a lot.
- fzeindl 4y agoThank you, let me know if you have suggestion and how whether you can apply it to your work.