news.volyx.in

Ask HN: Concepts that clicked only years after you first encountered them?

579 points by luuuzeta · 1344 days ago · 913 comments on HN

Article summary

The article discusses how some concepts in programming, such as logic gates and the relationship between current, voltage, and resistance, may not be fully understood until years after initial exposure. The author mentions that reading Petzold's Code helped clarify these concepts. The article also touches on the idea that some concepts may require a more empirical or theoretical approach to fully grasp. This realization can come from re-examining previously learned material with fresh eyes.

Main themes

  • dependency injection
  • unit testing
  • integration testing
  • code maintainability
  • testing effectiveness
  • design patterns
  • software development best practices

What commenters say

  • Dependency injection is a useful design pattern that makes code more testable and maintainable, but its value may not be immediately apparent.
  • Some developers believe that unit tests are often unnecessary or ineffective, and that integration tests are more valuable.
  • Mocking dependencies in unit tests can be problematic and may not actually test the functionality of the code.
  • The use of dependency injection and unit testing can be seen as a way to separate concerns and make code more modular, but it can also be overused or misused.
  • The concept of dependency injection is not new and has been around for decades, but its name and popularity may have changed over time.
  • Unit tests should assert something useful and not just be a transcript of the code under test with mock expectations.
  • The distinction between unit tests and integration tests is important, and unit tests should focus on testing the functional core of a module.
  • Some developers argue that the emphasis on unit test coverage can lead to writing unnecessary or low-quality unit tests.