Ravi Mohan

ravimohan.blogspot.com · Personal blog · on HN since 2007

Ravi Mohan writes about software engineering practice, including test-driven development, design, and enterprise software.

What HN saysHN links it for his summary of the TDD Sudoku case comparing Ron Jeffries' and Peter Norvig's solvers, used in arguments about upfront design.
53HN people shared it
42linked it in comments
14stories submitted
134story points
10 months agolast shared
2007people per year2026

Most-shared posts

  1. 1
  2. 2
    Learning From Sudoku Solvers
    4 people · 28 points · first shared 2012 · 9 comments on HN
  3. 3
    Learning from sudoku solvers
    4 people · first shared 2012
  4. 4
    But Martin, Enterprise Software IS Boring
    3 people · 5 points · first shared 2009 · discussion on HN
  5. 5
    Ratcatchers and Engineers
    2 people · 5 points · first shared 2008 · discussion on HN
  6. 6
    Learning from sudoku solvers
    2 people · first shared 2016
  7. 7
    Learning from sudoku solvers
    2 people · first shared 2016
  8. 8
    Ruby, Lisp, Why a Lexus is Not An Acceptable Ferrari
    1 people · 2 points · first shared 2008 · discussion on HN
  9. 9
    Tech Company Caste Systems
    1 people · 2 points · first shared 2023 · discussion on HN
  10. 10
    The Implicit Assembly Line (2008)
    1 people · 2 points · first shared 2016 · discussion on HN
  11. 11
    A Rogue Researcher's Route Map
    1 people · 1 points · first shared 2012 · discussion on HN
  12. 12
    Scribes and Programmers [2007]
    1 people · 1 points · first shared 2012 · discussion on HN
  13. 13
    Learning from sudoku solvers
    1 people · first shared 2014
  14. 14
    Learning from sudoku solvers
    1 people · first shared 2014
  15. 15
    Learning from sudoku solvers
    1 people · first shared 2014

What HN people wrote when they linked it

dwohnitmok · 2021-11-29
The usual counterexample to this is the famous Sudoku implementation comparison between Norvig and Jeffries, where Norvig's upfront design seemed to quickly and nicely solve the problem at hand and Jeffries eschewing of design led to blindly iterating into nowhere. http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm… (with a previous HN comment outlining it here: https://news.ycombinator.com/item?id=3033446) At this point the class of problems to be solved with software is too diverse and messy to ever be cleanly encapsulated by a single batch of "best practices." It would much more useful to me if every neat, clean set of best practices came with case studies of when it succeeded spectacularly and when it absolutely crashed and burned to gain an intuition of when to apply them and when to ignore them.
quanticle · 2018-12-23
If you don't understand the problem you're trying to solve well enough to write tests, you shouldn't start coding. Sometimes there are problems that are only really possible to appreciate after one starts coding. In many instances, I've found that attempting to build a prototype is the best way to understand the problem. In those instances, TDD is a huge mistake. It ties you to architectural decisions that you know you're going to change when you better understand the problem. Contrast Ron Jeffries' attempt to build a sudoku solver using TDD with Peter Norvig's attempt [1]. [1]: http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
rpeden · 2017-10-10
Just to clarify, it was Ron Jeffries who tried the TDD Sudoku solver, not Bob Martin. You can find links to all the the blog posts, plus some commentary here: http://ravimohan.blogspot.ca/2007/04/learning-from-sudoku-solvers.html I try not to be too hard on Jeffries in this case. Although he failed to write a Sudoku solver, expressing the requirements in the form of tests can be a decent way to start in cases where you know some valid outputs for a series of given inputs. I tend to solve Leetcode/Hacker Rank problems this way, and it works pretty well. The catch is that the tests won't tell you what algorithm will best solve the problem. And there's of course no guarantee the tests you've thought up will cover all edge cases.
willvarfar · 2017-06-29
No article about TDD, particularly one that shouts out to the respected Ron Jeffries http://ronjeffries.com/, is complete without mentioning the TDD Sudoku Fiasco :) Ravi has a nice summary: http://ravimohan.blogspot.se/2007/04/learning-from-sudoku-solvers.html Peter Norvig's old-fashioned approach is excellent counterbalance: http://norvig.com/sudoku.html
jasim · 2017-01-09
TDD is probably not the best way to do deep work. http://ravimohan.blogspot.in/2007/04/learning-from-sudoku-solvers.html About context, this is from Programmers at Work by Susan Lammers, interviewing John Page, author of the PFS productivity suite, famous in the late 80s. Lammers: Why are programmers so obsessive? Page: You constantly try to hold the state of the entire system you're working on in your head. If you lose the mental image, it takes a long time to get back into that state. It's like being an air-traffic controller who has nine planes in his mind and knows exactly where they're all going. Distract him by asking him when his shift is over and he loses those planes--the model he had in his head. In programming, a big complicated model is very efficient once you're in the groove. If you get out of it, you've got to work on it quite a while to get back in.
taeric · 2015-03-16
If you haven't, you really need to see this post.[1] Starting simple and writing a test driven algorithm is not necessarily bad. However, realize that you are really just turning the act of finding the optimum solution into a search space where you have to assume mostly forward progress at all times. Not a safe assumption. At all. And, because I love the solution, here is a link to my sudoku solver.[2] I will confess some more tests along the way would have been wise, though I was blessed by a problem I could just try out quickly. (That is, running the entire program is already fast. Not sure of the value on running the tiny parts faster.) [1] http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm… [2] http://taeric.github.io/Sudoku.html
apu · 2010-08-17
Not to get sucked into a debate about TDD stuff, but to me the following blog post said all that needs to be about at least the TDD business and "gurus" (if not the whole methodology): http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
svat · 2020-05-15
“OOP” is one of those terms (like most terms) that have a narrow meaning and a broad meaning, and either proponents or detractors can use one of them in arguments: • OOP, narrow sense (emphasis on “object”): data-with-associated-functions, encapsulation, etc. • OOP, broad sense (emphasis on “oriented”): organizing your program around objects that model the nouns in the problem domain, “everything is an object”. A (satirical) illustration of the latter is in the first few paragraphs of https://caseymuratori.com/blog_0015 (from 2014), which gives an example where, to write a payroll system, you first start by designing classes for “Employee”, “Manager”, etc. A (non-satirical) illustration is in the infamous “TDD Sudoku” series of blog posts (follow the links from http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm… or https://news.ycombinator.com/item?id=3033446) where (in contrast to Norvig's program which just solves the problem) the TDD/OOP proponent ends up with a “class Game”, “class Grid”, “class Cell”, “class CellGroup” (with derived classes “Row”, “Column”, and “Square”), but ends up nowhere. (From Seibel's post: “…got fixated on the problem of how to represent a Sudoku board. […] basically wandered around for the rest of his five blog postings fiddling with the representation, making it more “object oriented” and then fixing up the tests to work with the new representation and so on until eventually, it seems, he just got bored and gave up,…
nostrademons · 2018-05-31
Is this actually a new phenomena? I remember when I started programming c. 2000, the big-name programming gurus were folks like Kent Beck, Ward Cunningham, Uncle Bob, Ron Jeffries, Dave Thomas, Joel Spolsky, Jeff Atwood, Martin Fowler, et al. While some of them mostly knew their stuff, some were outright hacks (Peter Norvig's vs. Ron Jeffries' attempts to create a sudoku solver is one of my favorite examples [1]). Most of their names wouldn't be recognized by someone just getting into programming now. As I've gotten older, I've learned that there's often an inverse correlation between how good a programmer is and how likely you are to have heard of them, because the folks who get good at programming are actually programming and not writing blog articles about programming. Most of the latter are really content marketing, trying to drum up business for consultancies, and so you should treat them as advertisement rather than advice. [1] http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
jeremiep · 2016-07-19
Bad programmers are going to make a mess of things no matter how many tests you have. More often than not I see tests as needlessly solidifying the architecture prematurely. More often than not I see TDD yielding horrible, terrible software architectures and at that point you do need tests to maintain the resulting mess. TDD somehow assumes emergent architectures and I know from experience this is the worst way to architect something. NPM for example is full of well-tested libraries with poor architecture and bad usability (could be why everything is reinvented every 6 months) but I wouldn't call that a success story. I'm willing to bet the bug reduction from the extra time upfront doesn't come from doing TDD but actually thinking about the requirements and how they fit the larger picture. I really like the following story to illustrate this point: http://ravimohan.blogspot.ca/2007/04/learning-from-sudoku-solvers.html
sirclueless · 2012-09-04
Are you surprised by that? The 10x longer statement doesn't surprise me at all. If you ask someone, "Please implement a Java class that has the following methods and behaves like this" you might expect any competent programmer to finish within ~3x of each other. But given some more nebulous task, where architectural decisions must be made and serious research and testing needs to be done, it's not surprising at all. For example, if you asked someone, "Please write me a library so that I can send and receive XMPP messages," I would expect a large number of otherwise competent programmers to make a significant number of false starts and poor decisions, and generally take much more time than the guy who has experience writing libraries and interpreting text protocols. For example, consider the case of Ron Jeffries and Peter Norvig writing a sudoku solver[1] (this example is a perennial favorite of mine in all sorts of discussions). And I don't think anything is "very seriously wrong" with this situation. Different skillsets and competence levels result in drastically different results. I think this is true of any profession that is largely about creative problem-solving: some can do it efficiently, some cannot. Programming is just a unique case because there are so many people trying it and not being deterred due to poor performance because there is such a demand. [1] http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
partition · 2010-11-25
I have mixed feelings about this. On the one hand, the peer review system was designed specifically to keep out the low-quality material that blogs let through for free because of their more inherently democractic nature; I can't be the only one who thinks many people who blog (and even some who appear on HN) are not presenting useful enough or clear enough material to be worth reading by any audience. People's lives are finite and time spent reading published work that is useless detracts from time spent reading useful work that helps in one's own line of inquiry. Smooth talking bullshitters like Ron Jeffries who promote objectively useless or even counterproductive methods abound, taking bandwidth away from more useful ideas. You need only remind yourself of this exchange: http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm… http://pindancing.blogspot.com/2009/09/sudoku-in-coders-at-work.html It will be sad the day a Ron Jeffries of the academic world wastes as much of other people's time reading his posts. But has that day come already? On the other hand, it's not like the peer review system is immune to gaming and corruption either. We've got people chopping whatever work they've done into least-publishable-units and objectively good work being ignored because it is not like the other peer-reviewed work out there. And since most people working in a scientific field have not also gone through educating themselves against bullshit techniques (i.e.,…
lscharen · 2024-04-25
This is giving strong "Using TDD to build a Sudoku solver" vibes[1]. Let's use some hot tools to solve a problem. Sorta solve a problem. Well, AI doesn't actually know abstract strategy, so maybe it'll work later with a different AI. But it autogenerated some basic logic that only had a few bugs! [1] https://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.ht…
btilly · 2022-06-22
I learned testing on the job. That said, I would never trust a learning channel like the one you describe. I've learned the hard way that people who consider themselves experts on unit testing tend to believe that more tests are always better, and have no idea of the impact of excessive unit tests on a codebase. So a channel like the one you describe is going to attract people whose opinions I'm suspicious of. Instead aim to be expert at developing software. Unit testing will prove to be an important component. But nothing about unit testing makes sense when separated from the development that you are attempting to accomplish. For a very enlightening example, consider http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm… to compare someone who is an expert on unit testing (Ron Jeffries) with someone who is an expert on software development (Peter Norvig).
mannykannot · 2022-03-07
This process would be satisfied with a linear search. To even just see that there is a log n algorithm in the case where the input is sorted, you need to think analytically about the problem and its solution. Suppose the problem is presented with runtime constraints for some sufficiently large test cases, such that this difference in performance matters. Even in that case, what are the chances that a TDDer who is unaware of the binary search algorithm will stumble on the correct solution, while never looking beyond the next test to be satisfied? In the small cases, the difference is not discernible. I suggest that to be successful, one must think analytically about the problem, and code to the insights revealed by that analysis, in addition to the specifications themselves. A lot of problems are like that - e.g.: http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
ajuc · 2021-12-01
It's the same problem test driven development faces. Some things can be inferred from a list of test cases (exam answers). But some things require deeper insight that no amount of test cases can provide without spending time actually thinking about the big picture. http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
tincholio · 2021-10-15
This is the same guy from the failed sudoku solver... http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm… Maybe he had also tried TDD "wrong"? Or maybe he's just another snake oil salesman, like "uncle" Bob?
pkolaczk · 2016-10-19
" It should also solve the "don't know how to start" problem, because it de-emphasizes planning and design in favor of just jumping in; you write the tests, and then you do the bare minimum to make them pass" It doesn't SOLVE this problem. It only pushes it in time, making it actually worse, because you're wasting time on stupid tests instead of actively researching a solution. No amount of tests is going to help you find the right solution if you don't know what you are doing. See http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
pzh · 2016-09-12
Yet real system design is usually so complex that no single technique can cover it. I shudder when I hear TDD proponents claiming that this technique can even be used for emergent design. An amusing example is Ron Jeffries's Sudoku solver attempt: http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
amouat · 2015-07-17
A lot was discussed about Norvig's elegant solution compared to Ron Jeffries effort and what it said about TDD: http://ravimohan.blogspot.co.uk/2007/04/learning-from-sudoku-solvers.h… To be fair, the reason Norvig was so successful was he knew exactly the sort of problem soduku was and how to solve it, whereas Ron lacked this background knowledge.
bad_user · 2014-07-02
> Tests are basically same as free climbers safety lines. I never claimed that they aren't useful. > once they save your tush, you'll be glad they were there Of course, I'm glad when I work on well tested codebases. But I was speaking about the advertisement that it received. And people really do think that because that's what TDD enthusiasts claimed - and note that I'm making a difference between testing and TDD. Particularly funny is this story on Sudoku solvers: http://ravimohan.blogspot.ro/2007/04/learning-from-sudoku-solvers.html The introduction is genius and I quote: "Ron Jeffries attempts to create a sudoku solver - here, here, here, here and here. (You really ought to read these articles. They are ummm...{cough} ...err.... enlightening.) ... Peter Norvig creates a Sudoku Solver."
stuhacking · 2011-03-02
I agree. There's plenty of literature supporting almost the opposite of what Dijkstra preaches. While it's good to aim for formal specification, in practice you're likely to overdesign, deliver late and potentially find yourself unable to react quickly to changing requirements. The key is to deliver a working piece of software because handing your customer a page of beautiful mathematical notation is not going to solve their problem. (I'm aware of the danger of referencing Worse is Better... but I'll do it anyway :-) ) http://www.dreamsongs.com/WorseIsBetter.html http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm… In addition, the books 'Hackers' by Steven Levy and 'Coders at Work' by Peter Siebel demonstrate various scenarios where a groups of Hackers had to get something done in a short space of time. Almost invariably, they aim for the final product.
mifrai · 2010-11-23
I think it's referring to the sudoku TDD blog series that happened a few years back. Essentially, someone tried to implement a sudoku solver using TDD - and after several posts, never managed to finish. Peter Norvig then came along and wrote a short elegant implementation. Some use this to say TDD - which has ties to agile - doesn't work. But most people conclude that TDD isn't a silver bullet and you have to know about your problem domain before diving in. Here's someone elses' blog post which includes links to both sets of posts: http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
pvg · 2010-10-04
A far more entertaining (it's funny because it's true!) variant is http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm…
ekidd · 2010-10-04
I'm a raving TDD/BDD fanatic, and this kata still makes me cringe a little. At least they finally converge on a plausible-looking solution. Sadly, some TDD katas on the web turn into train wrecks. See Ron Jeffries' Sudoku solver, for example: http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm… If I were implementing this algorithm using TDD, I'd first write down a bunch of test cases, and then try the obvious algorithm. If that worked, I'd test a few more corner cases. There's really no reason why you have to blindly stagger through the design space when the algorithm is obvious.

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close