Why layering your application is important? Provide some bad layering example.

Technology CommunityCategory: Software ArchitectureWhy layering your application is important? Provide some bad layering example.
VietMX Staff asked 3 years ago

Each component should contain ‘layers’ – a dedicated object for the web, logic and data access code. This not only draws a clean separation of concerns but also significantly eases mocking and testing the system.

Though this is a very common pattern, API developers tend to mix layers by passing the web layer objects (for example Express req, res) to business logic and data layers – this makes your application dependant on and accessible by Express only. App that mixes web objects with other layers can not be accessed by testing code, CRON jobs and other non-Express callers