29 ms·
You can replace TDD with object orientation, functional programming, scrum and other buzzwords. I never understood why people try to make everything into a rigi
by maxxxxx 10y ago
You can replace TDD with object orientation, functional programming, scrum and other buzzwords. I never understood why people try to make everything into a rigid religion. Maybe it's a substitute for thinking for themselves?
- sageikosa 10y agoIf we build the coconut airports, the planes and cargo will come.
- oddlyaromatic 10y agoDecisions are costly, and things that reduce the number of decisions you have to make can be useful in moving work forward and making you more productive. Out at least making you feel productive. It's obviously not a great idea to follow one paradigm always, whether it's appropriate or not. But I think it's attractive for the reason you mention. We can't reason about every little thing all day long, so rubrics that come from trusted experts both reduce cognitive overhead and make us feel like we have "borrowed" somebody else's expertise.
- maxxxxx 10y agoI can see the benefits of reducing decision time. But I have seen it many times that you start with some paradigm which at the beginning is useful. But over time you discover more and more conditions where it doesn't work well anymore. Instead of reevaluating the situation a lot of people just stick to the paradigm although it's obviously not useful anymore. I see that a lot with scrum people where the answer is often "you are doing it wrong" but they are not able to answer the question how to do it right.
- mi100hael 10y agoOn the flip side, I find having a system like Scrum is beneficial even when parts of it are being done wrong because it's still an agreed-upon system that the entire team adheres to. Having 5 or 10 people each going at things the way they see best based on their experiential understanding can lead to counterproductive chaos even if each individual's approach in a vacuum is sound.
- oddlyaromatic 10y agoIt's great when everybody can see through stuff like this and work with a coherent but imperfect approach (no matter what field you are in). I guess it takes knowledgeable, experienced folks to really understand the context and make the best tradeoffs, since no way of doing something is perfect for all applications.
- senorjazz 10y agoSaw a perfect example of this on stackoverflow (or stackexchange I forget which). But someone posted some actual code, it had a switch statement, only 3 case options, about 7 lines and if the switch didn't hit, throw exception after "I would be careful with that switch, it looks like a code smell, this is how I would do it: 2+ interfaces, 3+ classes, abstract this, factory that and over 100 lines of code. I just refuse to believe a simple switch that everyone can understand in about 1 second is not the better solution to some complex code, even if it does use a "pattern"
- maxxxxx 10y agoSame with goto. Wasn't there recently an article about if-less" development where if gets replaced with callbacks?
- h_r 10y agoIf you're doing OOP this can mean leveraging polymorphic behavior rather than switching on data or data types. It's good to keep in mind even if it doesn't fit every single case.
- vog 10y agoCan you find the actual link, by any chance? I'd love to see that one in real.
- curun1r 10y agoA switch can increase the cyclomatic complexity of code and make it difficult to visualize how code flows at runtime. It may be the best solution, but often violates the single responsibility principle. What is best is often situational and depends on a developer's code aesthetic. But a single switch statement is useless in isolation, so one can't evaluate whether it's appropriate in isolation without looking at the context in which it's used.
- TeMPOraL 10y ago> A switch can (...) make it difficult to visualize how code flows at runtime You mean visualize with a tool, or in your head? If the former, I'd love to know of a tool for visualizing code flow. If the latter, then I think a switch - with entry and exit points, and all code paths clearly visible together on one screen - is much easier to visualize than an implicit branching hidden behind interfaces, requiring you to jump around definitions of several objects.
- pyrale 10y agoYou can also replace it with vaccines, evolution and climate change. I have the feeling that, while TDD is not an absolute, this article doesn't put forward good case examples for skipping it, or at least doesn't try to discuss these examples and find out why they aren't fit. Instead; it takes a shot at stereotypes and builds a strawman on it.
- Jtsummers 10y agoThe article is calling for moderation, not saying you should skip TDD but that you should understand what the exceptions are in TDD for when to write and when not to write tests. The author is asking the experts in TDD (and, implicitly, other methods that become dogma) to qualify their statements rather than issue commandments to "always write tests first" (a statement you see in material instructing on TDD, but then later gets qualified to show where and when to actually write those tests first and where and when not). But since many people probably don't read past the first few chapters, they miss the nuance.
- pyrale 10y agoThe whole point of TDD is to submit one's code to experimental validation. It seems wrong that, in order to better grasp it, one should be taught all the counter-examples. Moderation comes from practice, in fact. It comes from trying and failing, not from extra-prodding the experts, or from studying the matter. And should one be confronted with a zealot, their experimental rebuttal should be convincing enough that zealotry isn't a problem. On the other hand, OP's assertion that, e.g. a pseudo random generator shouldn't be tested comes without explanations, and frankly is unconvincing : there are acceptance tests (they may not be enough, but passing them is the least you can do) https://en.wikipedia.org/wiki/Randomness_tests https://en.wikipedia.org/wiki/Randomness_tests, and you can also split the seed and the function you implement, and test thoroughly that the function performs what the algorithm describes.
- Jtsummers 10y agoThat's not the whole point, that's a point. It's also got a large emphasis on testing frequently, writing tests frequently, and writing them in close temporal proximity to the code (dogmatic preference is before, but practically the order is less relevant), and writing or executing tests after relatively small code changes (additions, deletions, modifications).
- FLUX-YOU 10y ago>Maybe it's a substitute for thinking for themselves? Re-thinking everything for every project is wasteful. Sometimes you already know a way to do a project that works for you. Sometimes that way is mirrored by a lot of other people. Other times you are selecting these things because it's a common thing to talk about and when you're teaching people the project, you can prime their learning by telling them to expect these models and methodologies in this project. The mistake IMO is making the religion industry-wide when really you'll be lucky to implement it consistently just in your company/project.
- Someone1234 10y agoBuzzwords are buzzwords. The reason people flock to those things is that they feel it offers value to them. From my perspective all three tried to solve maintainability. OOP via encapsulation and standardisation, functional via uncompromising standards, and TDD via validating each small subsection of the solution. They all "work" if you commit to them enough. But none of them work when you half arse them. So instead of people working hard they move on to the next "solution" because the last solution required too much effort (TDD is definitely a victim of this, considering how much work it requires). PS - People being "anti" something are just as religious as the people being "pro" something, except the anti people often have a smug sense of superiority. See the people arguing against GOTO in all and any circumstances in spit of how little sense their arguments make.
- sageikosa 10y agoAnd they show up a lot on job postings...so there is perceived marketability to following any of the one true faiths of perfect software development.
- maxxxxx 10y ago"They all "work" if you commit to them enough. But none of them work when you half arse them." This sounds dangerous. It gives rise to the attitude that if X doesn't work you are just not doing it enough. Instead of accepting that maybe it's not the right approach to this particular problem.
- cabalamat 10y agoIt's the difference between "X is useful" and "X is a magic bullet that will solve all our problems!"
- pmarreck 10y agoFrom an experiential perspective, here are paradigms that have resulted in me spending less time creating and hunting down bugs, which has made me noticeably more productive: 1) Unit testing/TDD, specifically setting things up where I am able to run a unit test in less than a second on any code I'm working on has been a huge productivity boost vs. running a whole suite periodically 2) Immutable variables (or generally avoiding mutation) 3) SRP and cyclomatic complexity reduction 4) Pattern-matching (Elixir/Erlang) which also reduces the amount of branching in code and thus its depth (reducing cyclomatic complexity further) 5) FP (which incorporates (2) and (4) plus generally constraining side effects and I/O to the smallest part of the code possible, and leaving the rest non-side-effecting) I have done scrum, but I haven't seen it as directly effective as these other things, it's more for effective PM IMHO.
- maxxxxx 10y agoAll the items you list are useful things. But you probably have noticed that they work well in some cases but in others they don't. The problem starts when people declare that X is always the right thing even in situations where it clearly doesn't work.
- pmarreck 10y agoAgree, but I'm with John Carmack when Mr. C++ says something like: "My pragmatic summary: A large fraction of the flaws in software development are due to programmers not fully understanding all the possible states their code may execute in. In a multithreaded environment, the lack of understanding and the resulting problems are greatly amplified, almost to the point of panic if you are paying attention. Programming in a functional style makes the state presented to your code explicit, which makes it much easier to reason about, and, in a completely pure system, makes thread race conditions impossible." http://www.gamasutra.com/view/news/169296/Indepth_Functional_programming_in_C.php http://www.gamasutra.com/view/news/169296/Indepth_Functional...
- Bartweiss 10y agoThat's very much the point, and I'd suggest that "not thinking for themselves" is sometimes a totally reasonable goal. Joel Spolsky covered this fairly well in his piece on McDonald's-style software. The best way to write a single program is to master programming, and develop alone or in a small group of masters, and build a beautiful and enduring tool with whatever practices suit you best. But none of that can be packaged up and passed around to new programmers on demand. It takes time to master, and it certainly can't be smoothly overseen by someone who never learned it. The best way to get 100,000 programmers writing a billion lines of code is to develop simple routines that can be followed and overseen by anyone. The results won't be as good as mastery, but in many cases they don't need to be. There's a lot of simple software out there which benefits more from being done now than being done right. Having said all that, I do think rigidity is becoming a problem for the software industry. It's not being employed at the levels needed to make software work, it's being employed at the levels needed to make development legible. Adding procedures that worsen development but make it easier to watch is a serious issue. https://www.joelonsoftware.com/2001/01/18/big-macs-vs-the-naked-chef/ https://www.joelonsoftware.com/2001/01/18/big-macs-vs-the-na...
- hinkley 10y agoExperts often make lousy teachers. They don't have the slightest clue what they know and so they can't explain it to anyone else. Or they can explain it but can't write it down so they're always the bottleneck. The worst of this group often become indispensable, because they've designed something nobody else can understand. It's politically difficult to push back on this sort of problem, which is why I am job hunting now. Of the six or so really smart guys that remain on my current project, I trust maybe three of them, but would only work with two again (the third is so happy to be here that he doesn't resist any of the chaos)
- hinkley 10y agoBut you aren't thinking for yourself. You're thinking for the team. Software is a team sport. All of my decisions affect how long it takes for you to fix a simple bug. All of yours affect how often I have to stay late to fix a production issue. I think these things become a religion because there is a large group of developers who simply won't do something unless management makes a rule about it. So now to get them to participate, dogma has to be involved. In general these are the same folks who attribute all adversity to bad luck instead of lack of forethought. They won't see the consequences of their shortcuts because that's just the way things are.
- Silhouette 10y agoI think these things become a religion because there is a large group of developers who simply won't do something unless management makes a rule about it. So now to get them to participate, dogma has to be involved. At that point, you're basically in permanent damage limitation mode anyway, though. Software development is a skilled and creative activity. Certainly not everyone has to be a "rockstar" or a "ninja" or whatever we're calling those people this week. I've worked with plenty of developers who do a decent, competent job without spending their lives thinking about code 24/7 and staying up to speed on every little development in the industry. However, there is a baseline level of giving a $#!% that is necessary to do a decent, competent job.