HOME

TheInfoList



OR:

In computer
software Software is a set of computer programs and associated documentation and data. This is in contrast to hardware, from which the system is built and which actually performs the work. At the lowest programming level, executable code consists ...
, business logic or domain logic is the part of the program that encodes the real-world
business rule A business rule defines or constrains some aspect of business. It may be expressed to specify an action to be taken when certain conditions are true or may be phrased so it can only resolve to either true or false. Business rules are intended to ass ...
s that determine how data can be created, stored, and changed. It is contrasted with the remainder of the software that might be concerned with lower-level details of managing a
database In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases sp ...
or displaying the
user interface In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
, system infrastructure, or generally connecting various parts of the program.


Details and example

Business logic: * Prescribes how
business objects A business object is an entity within a multi-tiered software application that works in conjunction with the data access and business logic layers to transport data. For example, a "Manager" would be a ''business object'' where its attributes c ...
interact with one another * Enforces the routes and the methods by which business objects are accessed and updated Business rules: * Model
real-life Real life is a phrase used originally in literature to distinguish between the real world and fictional, virtual or idealized worlds, and in acting to distinguish between actors and the characters they portray. It has become a popular term on the ...
business objects (such as accounts, loans, itineraries, and inventories) Business logic comprises: *
Workflow A workflow consists of an orchestrated and repeatable pattern of activity, enabled by the systematic organization of resources into processes that transform materials, provide services, or process information. It can be depicted as a sequence of ...
s that are the ordered tasks of passing documents or data from one participant (a person or a software system) to another. Business logic should be distinguished from business rules. Business logic is the portion of an enterprise system which determines how data is transformed or calculated, and how it is routed to people or software (workflow). Business rules are formal expressions of business policy. Anything that is a process or procedure is business logic, and anything that is neither a process nor a procedure is a business rule. Welcoming a new visitor is a process (workflow) consisting of steps to be taken, whereas saying every new visitor must be welcomed is a business rule. Further, business logic is procedural whereas business rules are declarative. For example, an
e-commerce E-commerce (electronic commerce) is the activity of electronically buying or selling of products on online services or over the Internet. E-commerce draws on technologies such as mobile commerce, electronic funds transfer, supply chain manageme ...
website might allow visitors to add items to a shopping cart, specify a shipping address, and supply payment information. The business logic of the website might include a workflow such as: * The sequence of events that happens during checkout, for example a multi-page form which first asks for the shipping address, then for the billing address, next page will contain the payment method, and last page will show congratulations. There will also be business rules of the website: * Adding an item more than once from the item description page increments the quantity for that item. * Specific formats that the visitor's address, email address, and credit card information must follow. * A specific communication protocol for talking to the credit card network The web site software also contains other code which is not considered part of business logic nor business rules: * Peripheral content not related to the core business data, such as the
HTML The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
that defines the colors, appearance, background image, and navigational structure of the site * Generic error-handling code (e.g., which displays the HTTP Error Code 500 page) * Initialization code that runs when the web server starts up the site, which sets up the system * Monitoring infrastructure to make sure all the parts of the site are working properly (e.g., the billing system is available) * Generic code for making network connections, transmitting objects to the
database In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases sp ...
, parsing user input via HTTP POST events, etc.


Business logic and tiers/layers

Business logic could be anywhere in a program. For example, given a certain format for an address, a database table could be created which has columns that correspond exactly to the fields specified in the business logic, and type checks added to make sure that no invalid data is added. Business logic often changes. For example, the set of allowable address formats might change when an online retailer starts shipping products to a new country. Thus it is often seen as desirable to make the code that implements the business logic relatively isolated, or loosely coupled. This makes it more likely that changes to business logic will require a small set of code changes, in only one part of the code. Distant but strongly coupled code also creates more of a risk that the programmer will only make some of the necessary changes and miss part of the system, leading to incorrect operation. A
multitier architecture In software engineering, multitier architecture (often referred to as ''n''-tier architecture) is a client–server architecture in which presentation, application processing and data management functions are physically separated. The most wide ...
formalizes this decoupling by creating a business logic layer which is separate from other tiers or layers, such as the
data access layer A data access layer (DAL) in computer software is a layer of a computer program which provides simplified access to data stored in persistent storage of some kind, such as an entity-relational database. This acronym is prevalently used in Microsof ...
or
service layer In intelligent networks (IN) and cellular networks, service layer is a conceptual layer within a network service provider architecture. It aims at providing middleware that serves third-party value-added services and applications at a higher a ...
. Each layer "knows" only a minimal amount about the code in the other layers—just enough to accomplish necessary tasks. For example, in a
model–view–controller Model–view–controller (MVC) is a software architectural pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements. This is done to separate internal representations of infor ...
paradigm, the controller and view layers might be made as small as possible, with all the business logic concentrated in the model. In the e-commerce example, the controller determines the sequence of web pages in the checkout sequence, and is also responsible for validating that email, address, and payment information satisfy the business rules (rather than leaving any of that up to the database itself or lower-level database access code). Alternative paradigms are possible. For example, with relatively simple business entities, a generic view and controller could access database objects which themselves contain all the relevant business logic about what formats they accept and what changes are possible (known as the database model). Some tiered schemes use either a distinct
application layer An application layer is an abstraction layer that specifies the shared communications protocols and Interface (computing), interface methods used by Host (network), hosts in a communications network. An ''application layer'' abstraction is speci ...
or a
service layer In intelligent networks (IN) and cellular networks, service layer is a conceptual layer within a network service provider architecture. It aims at providing middleware that serves third-party value-added services and applications at a higher a ...
, or consider the business logic layer to be the same as one of those.


Tools and techniques

Business logic can be extracted from procedural code using a
business rule management system A BRMS or business rule management system is a software system used to define, deploy, execute, monitor and maintain the variety and complexity of decision logic that is used by operational systems within an organization or enterprise. This logic, a ...
(BRMS). The
business rules approach Business rules are abstractions of the policies and practices of a business organization. In computer software development, the business rules approach is a development methodology where rules are in a form that is used by, but does not have to be ...
of software development uses BRMSs and enforces a very strong separation of business logic from other code.
User interface management systems A User Interface Management System (UIMS) is a mechanism for cleanly separating process or business logic from Graphical user interface (GUI) code in a computer program. UIMS are designed to support N-tier architectures by strictly defining and e ...
are another technology used to enforce a strong separation between business logic and other code. The
magic pushbutton The magic pushbutton is a common anti-pattern in graphical user interfaces. At its core, the anti-pattern consists of a system partitioned into two parts: user interface and business logic, that are coupled through a ''single'' point, clicking the ...
is considered an "anti-pattern": a technique that in this case creates undesirable constraints which make it difficult to code business logic in an easy-to-maintain way. A
domain model In software engineering, a domain model is a conceptual model of the domain that incorporates both behavior and data.Fowler, Martin. ''Patterns of Enterprise Application Architecture''. Addison Wesley, 2003, p. 116. In ontology engineering, a do ...
is an abstract representation of the data storage types required by business rules.


See also

*
Drakon-chart DRAKON is a free and open source algorithmic visual programming and modeling language developed within the Buran space project following ergonomic design principles. The language provides a uniform way to represent flowcharts of any com ...
*
Relocating logic In computer programming, a self-relocating program is a program that relocates its own address-dependent instructions and data when run, and is therefore capable of being loaded into memory at any address. In many cases, self-relocating code is a ...
*
Business process modeling Business process modeling (BPM) in business process management and systems engineering is the activity of process modeling, representing processes of an enterprise, so that the current business processes may be analyzed, improved, and automated. B ...


References


Further reading

* — McLaughlin discusses the
façade pattern The facade pattern (also spelled ''façade'') is a software-design pattern commonly used in object-oriented programming. Analogous to a facade in architecture, a facade is an object that serves as a front-facing interface masking more complex und ...
for implementing the business layer of an application. * * * — Turau presents an application framework implemented using
Java Servlet A Jakarta Servlet (formerly Java Servlet) is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web application ...
s and
JavaServer Pages Jakarta Server Pages (JSP; formerly JavaServer Pages) is a collection of technologies that helps software developers create dynamically generated web pages based on HTML, XML, SOAP, or other document types. Released in 1999 by Sun Microsystems, J ...
that enables the separation between business logic and presentation logic, allowing development of each to proceed in parallel along relatively independent but cooperating tracks. * — Pau and Vervest develop an approach for the embedding of business logic into the communications network that underlies a distributed application with a multiplicity of
actors An actor or actress is a person who portrays a character in a performance. The actor performs "in the flesh" in the traditional medium of the theatre or in modern media such as film, radio, and television. The analogous Greek term is (), lite ...
, in order to optimise the allocation of business resources from a network point of view.


External links


Business Layer Guidelines
{{DEFAULTSORT:Business Logic Software architecture Business process