Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Okay, I agree with the basic principle.

But why is it every time somebody writes a piece about focusing on the "stuff that really matters", whether it's the user experience, or actually shipping stuff, it always sounds to me like an excuse for taking unnecessary shortcuts? Since when is dependency injection a "fad"? What the f* is wrong with writing unit tests?

Or in other words, what's wrong with building half-decent code the first time around? It doesn't take much more time and it makes refactoring afterwards so much easier. Using very common basic best practices when coding has nothing to do with over-architecting or trying to be clever.



Dependency injection was a fad. Pretty much every framework under the sun started using it and exposing it in the API and now it has more or less fallen out of favor, giving way to other fads such as framework metaprogramming. Following fads has little to do with writing good code the first time around. Good code is code that gets the job done, has some modicum of maintainability, and didn't take you 10 years to write perfectly the first time.


I believe all of that is fine, the problem is spending too much time on it. For example, writing comprehensive unit test may be not much better than having just a few, because there is no way to test for every possible bug. Also, in some situations it is better to have code with a few bugs than no code at all.


Unit testing is more about documenting the expected behavior of software, not necessarily to test every possible contingency.

If you want to write dirty code on an initial run, and refactor later unit tests will help out a whole lot.


Testing code - good. My mantra is "if you haven't tried it, it doesn't work".

Writing unit tests - usually takes too long. Shipping can happen 25% faster if you hack and adhoc-test and prototype like mad.

Its a question of process - and in a startup there is time for very little.


Last company I worked for got excited about dependency injection. Only problem is that only one developer really understood it. Then he quit.


what's wrong with building half-decent code the first time around?

It violates the spirit of MVP. While all ideals (MVP, DRY, etc.) should only be guidelines, they do have an effect on priorities. Simply said, shipping usually wins over everything else.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: