DEV Community

Discussion on: Lay Out Your Code Like You'd Lay Out Your House

Collapse
 
codemouse92 profile image
Jason C. McDonald

Fantastic! However, this should be paired with a well-tempered inheritance structure, so you're not repeating yourself unnecessarily. You may have seventeen types of lamp in your house, but they all implement the same common wiring and structure.

There are also some things that should be shared among rooms, such as electricity, plumbing, and so forth. No point recreating the entire electrical system for each individual room...that would just make it hard to maintain the system! Implement the common system instead.

Collapse
 
okolbay profile image
andrew

prefer composition over inheritance - extracting non-legit abstractions is coupling your modules without bringing much benefit.