What exactly is a business rule? [duplicate]

I’m trying to better organize my application architecture, so I’ve been doing some reading, but I keep running into references to “Business Logic” and “Business Rules”. I’ve never really understood what these actually are. I generally just focus on Use Cases and “User Stories”. Could someone explain what Business Logic and Business Rules are, and how they are related to Use Cases?

All the definitions I’ve found seem to pertain to actual businesses, not software development.

Because software is not always representative of a business, does that mean that software does not always have business logic? Or…

0

People use the terms “business rule” and “business logic” to refer to the portion of your application that is specific to your application and represents the core behavior of how things are supposed to work as opposed to generic functionality that could be useful in software written for a different client/business/customer base or code that exists to support the infrastructure of the application.

Often business logic is subject to change when the needs of the customer change, so we like to put it in a special place/tier so that we can modify it as needed.

Although the term seems to imply otherwise, non-business software also has business logic. For example, a rule that states that “when a user does xyz, the application should validate something” can be classified as a business rule.

Utility code, such as parsing/processing/data access and such would not be considered business logic.

It’s kind of a nebulous term and could mean different things to different people in different contexts. It’s not worth getting hung up on. The general idea is to separate your application into logical portions, each of which is responsible for something specific. How exactly this is done is something you learn from experience and working on well-designed large applications. But there aren’t any hard and fast rules. Ask three good developers and you’ll get six opinions.

5

Here’s an excerpt from Wikipedia:

It is a rule that defines or constrains some aspect of business and
always resolves to either true or false. Business rules are intended
to assert business structure or to control or influence the behavior
of the business Business rules describe the operations, definitions
and constraints that apply to an organization. Business rules can
apply to people, processes, corporate behavior and computing systems
in an organization, and are put in place to help the organization
achieve its goals.

With respect to what @aarong said, business rules or business logic doesn’t really mean you require some form of business entity to make this up.

This can mean any constraint or definition of a process that your application is supposed to do. These rules are meant to assert the behavior of your application and what it does.

For example, let’s put this logic in an ATM machine.

Business Rules could be:

  • The user should have an ATM card
  • The user should know the pin to the ATM card
  • The amount the user is trying to withdraw shouldn’t exceed the account balance
  • In case of any errors, revert any changes made to the system and reverse transactions if possible

Or in a more common place like Facebook:

  • You need a Facebook account to login
  • You must be logged in to add friends
  • The user must be able to select who can see their posts and pictures
  • The user should be notified about friend requests
  • The user can accept or decline friend requests

Stuff like that.

0

Business rules are rules that exist in the problem domain that define or restrict processes in that domain.

These are rules that may be applied by software.

The use cases are documented observations of the business rules in practice.

Example, if the problem domain is prescribing, then:

  1. a business rule could be “Can’t do refills on Control-II Medications”.
  2. a use case or story could be “Patient requests refill on Medication… System denies refill because refills aren’t allowed on Control-II Medication…”

Business rules aren’t necessarily associated with computer applications.

When you see the term in a book, you can generally think of it as “Requirements” although requirements encompass more than just business rules.

You could call the business logic where you decide what you will do with the data that you got from the user. There you can manipulate it and return or save on database. What you do with that data depends on the client needs.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật