DEV Community

Discussion on: What Is Business Logic?

Collapse
 
royledford profile image
Roy Ledford • Edited

Business rules are set and defined by the stakeholders and sit on top of the rules defined by the tech and structre of the application.

For example and app might store customer data; id, name, and phone. The app and db only need to enforce the rule that id is provided and unique. The name and phone would be string data but no requirements are needed for the content. These are rules defined by the application and must be adhered to for it function properly.

The stakeholders (business) however, may require the name to be unique, and a min length. The phone can be blank but if provided must include the area code plus 7 characters and must be all numbers. These are rules defined by the business to meet their needs.

The app would function without the business rules but wouldn't be very useful.