Hacker News new | ask | show | jobs
by harpb 4934 days ago
You may have misunderstood his point or maybe I am. The way I understood, it is not about assertions such as i = min < max ? min : max but rather about the architecture of the software. The software should come built-in with the features that by default prevent bad software designs.

His argument is not to abolish tests and use asserts, but rather to define a set of cases for which you would not need to test because the framework, by its nature, makes it unnecessary.

His example was SQL injection. (a) If I were to write my own MySql queries which directly talk with the DB, then I would need to write tests around those query to make sure it is not possible to execute SQL injection. (b) If I am using an ORM that comes with feature so I don't write the sql queries, it creates it on its own and also comes with the feature to handles possible use-cases which would normally lead to SQl injection, in such case, there is no need to write the test.