abp icon indicating copy to clipboard operation
abp copied to clipboard

Is it not Ideal to enforce the Architecture Principles by default rather by Optionating them by using the Archtectural Unit Test?

Open MohanaRanjan opened this issue 6 years ago • 3 comments

For the Domain Service usability and enforcing them in the Application, it has been suggested under the document "How do we Enforce using the Domain Service?" to use the Protected entity Attributes and developer has no second option to manipulate the entity at the Application Layer.

Since ABP is driving developing Application with Clean Code and best Architecture principles for building a Robust Application, my suggestion is, as a developer I wants to use this Framework then I have to adhere to the best practices.

If creating new entity with protected set does not come to my mind I still write code that smells. But I do not have intention to do that.

My suggestions is how about using the Architecture Unit Tests that will look for such flaws as and when I write new code.

I have come across good Architectural Unit Test Framework that come from the inspiration of ArchUnit for Java , ArchUnitTestNET and a related Article here to enforce Architecture Rules

So this unit Test will govern me write the code that is not different or away from suggested Best Practices.

If for some reason I want deviate from the best practice then i should do it consciously by disabling the Test case that is protecting me from doing this.

Will this not help developing the Software that always stick to best practices by convention and option to deviate from this willingly?

MohanaRanjan avatar May 22 '20 17:05 MohanaRanjan

We had talked this idea a few time internally with the core development team.

Forcing eveyone to strictly implement DDD best practices is not what we want to do. ABP Framework is progressive. It allows developers do the things how they know (when they don't want to use something in the framework).

However, an optional and configurable analyzer (like analyzing the code and gives errors/warnings) on building the solution is one thing we definitely want to do in the future.

hikalkan avatar May 31 '20 20:05 hikalkan

Thanks for your reply.

I have one comment and one suggestion.

ABP is built based on the best practices of DDD in mind. If am a developer who want to use this framework but want to do it in my own style, will it not restrict me at some point of development for not following the Framework best practices rules and obstruct my application further development?

Also, if I want to make simple application that involves simple CRUD operation and not having any business logic complexity,ABP framework would be too good to use and it looks a lot more for me interms of learning new framework.

My kind suggestion is ,when we ask the developer preferences for building the software using this Framework, we are asking few questions like

Which dotnet framework

MVC or angular

Multi tier or not etc to generate a scaffolding. In that place we should have one option which says "Enforce DDD best practices" check box and an information saying like "ABP is built with DDD in mind"

Now the scaffold code will either have enforced DDD architecture style and minimise the risk or having a scaffold code without architecture Enforcement and helps to play with framework freely.

Please let me know how you see this.

MohanaRanjan avatar Jun 04 '20 17:06 MohanaRanjan

If am a developer who want to use this framework but want to do it in my own style, will it not restrict me at some point of development for not following the Framework best practices rules and obstruct my application further development?

There are some strict rules (like Guid for user id). Beside such point, if you go with your own way, ABP doesn't hurt you. But if you follow ABP conventions, it helps.

Also, if I want to make simple application that involves simple CRUD operation and not having any business logic complexity,ABP framework would be too good to use and it looks a lot more for me interms of learning new framework.

CRUD application development is also easy with ABP. I suppose you already know CrudAppService.

Thank you for the suggestion. If we create an analyser, we can definitely ask to enable/disable it.

hikalkan avatar Jun 14 '20 10:06 hikalkan