Why Feature-Sliced Design (FSD) Isn't Always Necessary for a Modular Client
Feature-Sliced Design is often presented as a universal solution for organizing code in complex projects. However, in reality, it's not always mandatory, especially for modular and reusable client code. It all depends on the developer's qualifications and the specifics of the task.
Developer Qualification Matters
Experienced developers know how to organize code without approaches like FSD. They:
- Clearly understand the principles of separation of concerns. For example, where business logic should reside and where interface interaction should be handled.
- Know when to split code and when it will complicate the project.
- Are familiar with design patterns. This helps create understandable and maintainable structures.
Often, experience and common sense allow them to write clean and modular code without delving into complex approaches.
Small SPAs: Challenges with FSD
In small Single Page Applications (SPAs), FSD is more likely to create unnecessary complexity:
- Excessive file structure, simple functionality can be implemented in a few modules without deep division.
- Slower prototyping, initial iterations take more time.
- Sometimes the approach creates excessive rules that are not suitable for a specific task.
When FSD Is Justified
There's a paradox: FSD is useful both for those who already understand architectural principles and those who don't.
It's undeniable that FSD performs well in large applications with dozens of screens, where it's important to clearly delineate areas of responsibility. But even in such cases, the key role is played by the competent application of principles.
FSD !== good code
(specifically code, not architecture)
Simply using FSD doesn't guarantee well-written code. It provides a structure, but the actual implementation within that structure still depends on the developer's skills.
And ?
Is FSD effective if the developer is initially incapable of properly separating code? In my opinion, no. Consider Angular: it sets a clear architecture, but does it inherently help? More likely not, as everything ultimately depends on the developer themselves. Architecture is not just about creating folders and assigning names to them.
Feature-Sliced Design is an approach that should be used wisely. For small projects, simpler approaches that don't complicate development are more suitable. Ultimately, code quality depends more on the developer than on the chosen architectural approach, because the latter depends on the former.