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

These days, when I start a new project, I think of my code as a tree. I start at the trunk and write the branches.

Each kind of state change needs to flow through the code in a consistent direction to avoid unexpected state mutations (like sap flows through a tree).

Another developer should be able to understand all the main parts of my program just by looking at the main entry point/file (the trunk of the tree).

Also, no dependency injection should be used; all dependencies need to be listed explicitly and be trackable to its source file. Dependencies need to either be explicitly imported where they are used or passed down through the branches explicitly via method or constructor arguments. Traceability is very important.

About classes/abstractions, they should be easy to explain to a non-technical person. If you can't explain a class or module to a non-technical person, it shouldn't exist because it is a poor abstraction.



> Also, no dependency injection should be used; all dependencies need to be listed explicitly and be trackable to its source file. Dependencies need to either be explicitly imported where they are used or passed down through the branches explicitly via method or constructor arguments.

Isn't the latter precisely dependency injection?

https://en.wikipedia.org/wiki/Dependency_injection#Construct...


Yep, I think GP meant DI frameworks.




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

Search: