news.volyx.in

John Carmack on inlined code (2014) (number-none.com)

556 points by bpierre · 670 days ago · 389 comments on HN

Article summary

John Carmack discusses the benefits of inlining code, citing his experience with the flight control code for the Armadillo rockets, where inlining subroutines led to cleaner and more efficient code. He argues that inlining can help avoid bugs and improve code readability, but notes that it may not be suitable for all situations. Carmack also touches on the importance of understanding the problem domain and avoiding unnecessary abstractions. He shares his personal experience of applying this approach to his code at Id and finding it beneficial.

Main themes

  • Inlining code
  • Code readability
  • Software development best practices
  • Abstraction
  • Problem-solving
  • Code maintenance

What commenters say

  • Inlining code can be beneficial for readability and bug avoidance, but may not always be the best approach.
  • Over-abstraction can lead to maintenance headaches and should be avoided in favor of simpler, more straightforward solutions.
  • The decision to inline code or create abstractions depends on the specific problem domain and the trade-offs between readability, performance, and maintainability.
  • Experience and judgment are essential in determining when to apply principles like DRY and YAGNI, as there is no one-size-fits-all solution.
  • Some argue that doing things the 'right way' from the start can save time in the long run, while others believe that 'good enough' solutions can be sufficient and less prone to over-engineering.
  • The importance of understanding the problem domain and avoiding unnecessary complexity is a key factor in making decisions about code structure and abstraction.
  • There is a balance to be struck between code reuse and the potential for increased complexity and maintenance costs.
  • The value of inlining code and avoiding abstractions is not universally agreed upon, and different approaches may be suitable for different projects and teams.