business-logic-layer

Business Logic Layer And Why It Matters To Understand Blockchain Business Models

In programming, the Business Logic Layer (BLL) serves as an intermediary for data exchange between the presentation layer and the Data Access Layer (DAL). The Business Logic Layer handles the business rules, calculations, and logic within an application which dictate how it behaves. That is, the BLL determines how data from the database is used and what it can and cannot do within the application itself. 

Understanding a business logic layer

The business logic layer handles the business rules, calculations, and logic within an application which dictate how it behaves. That is, the BLL determines how data from the database is used and what it can and cannot do within the application itself. 

In this way, the business logic layer manages communication between the database and the presentation layer – sometimes referred to as the end-user interface. It forms part of the multitier architecture of software engineering where various functions are physically separated.

Separation typically involves functions assigned to one of three layers:

  1. User interface (UI) layer – where all presentation and user interaction occurs. Data is displayed to the user. The user sends and also receives data.
  2. Business logic layer (BLL) – as we have noted, the BLL deals with application processing and coordinates the flow of data between the UI and DAL.
  3. Data access layer (DAL) – or the layer where data management takes place. In most cases, this is via a web service or database.

Collectively, each of the three layers plays an integral role in many web applications. Consider the example of an insurance website that features an application where consumers can view their insurance policies. 

The consumer’s browser interacts with the application’s user interface layer code, with customer policy data held in the data access layer. The BLL is the most important component since it contains any important calculations or business logic and ultimately, determines whether the consumer is entitled to obtain insurance cover.

Differentiating between business logic and business rules

Business logic sets out how business objects interact with each other and enforces how these objects are updated and accessed. Logic decides how data is transformed, calculated, and sent to workflows, which are the ordered tasks one participant (user, software) sends to another.

Business rules, on the other hand, are formal expressions of “real-world” business policy, such as those relating to loans, accounts, and itineraries. 

To explain the difference more succinctly, it can be helpful to remember that any procedure or process falls under the business logic banner. Any factor that is neither of these can be considered a business rule. 

When a consumer visits an eCommerce website, for example, business logic defines a workflow where the consumer can add a product to their cart, enter their postal address, provide their credit card details, and land on a confirmation page. An example of a business rule in this process may describe a particular method for communicating with the VisaNet electronic payments network.

Defining a business logic layer

Both the UI and DAL are relatively easy to define and understand. However, there is less clarity on what constitutes a BLL. As a result, many businesses (including Apple and Microsoft) exclude the BLL from their applications entirely and have UI code communicate directly with the DAL.

In coding, this leads to what is colloquially called the “Fat Controller”. This describes a controller with domain logic servicing too many requests. In turn, controller logic becomes overly complex and too dependent on domain concepts. Ultimately, this complexity makes code maintenance difficult. 

A better option is to design the application to support multiple different user interfaces. Code that is common to each user interface then becomes the business logic layer.

Generally speaking, this code is any which deals with the following:

  1. Persisting data (to the DAL).
  2. Displaying data (to the UI layer).
  3. Accessing data (from the DAL).
  4. Making logical decisions.
  5. Performing calculations.
  6. Maintaining application state.
  7. Coordinating workflow.
  8. Processing commands (from the UI layer).

Used properly, the BLL centralizes as much common logic as possible and is not tied to a particular UI. This enables the application to support any number of user interfaces and minimizes instances of code duplication. 

It’s also worth noting that the code in the UI layer must necessarily shrink as it grows in the BLL. This concept is central to the “Thin Controller” theory. As the BLL grows and starts to become bloated, the layer can be separated further by moving from a three-tier to an n-tier architecture.

Benefits of business logic layers

Business logic layers are a recommended software engineering convention. Together with the user interface and data access layers, this multitier architecture has important implications for code reusability and modular design

To that end, there are several benefits to adopting the compartmentalized approach:

  1. Code maintenance – as we touched on briefly in the previous section, multitier architecture makes code maintenance much easier. When a business requirement changes, the associated business logical layer is often the only component that requires code to be altered. By the same token, it can be very difficult to determine where in the application a code change should be made if there is no compartmentalization whatsoever. 
  2. Application releases – another benefit of the business logic layer and multitiered architecture is the ease with which application releases can be rolled out. It stands to reason that if the BLL was the only layer to be updated, then it is the only one that should be used in the production environment. That is, the user interface layer and data access layer can be left alone and remain unaltered.
  3. Ease of learning – development teams may also benefit from the BLL and multitier architecture approach. Individual employees need only specialize in presentation development, data, or business logic skills to more rapidly learn their specific part of the application. This also has positive implications for efficiency. Since each layer can be worked on at the same time, the development timeframe becomes shorter.

Key takeaways:

  • A business logic layer serves as an intermediary for data exchange between the data access layer (DAL) and the user interface (UI) layer.
  • Finding it too difficult to define, many businesses omit the business logic layer completely. With the DAL communicating directly with the UI, code becomes overly complex and maintenance problematic.
  • A business logic layer allows developers to design applications that support multiple user interfaces. This minimizes the chances of needless code duplication.

Read Next: Proof-of-stakeProof-of-workBitcoinEthereumBlockchain.

Connected Business Concepts

blockchain-economics
According to Joel Monegro, a former analyst at USV (a venture capital firm) the blockchain implies value creation in its protocols. Where the web has allowed the value to be captured at the applications layer (take Facebook, Twitter, Google, and many others). In a Blockchain Economy, this value might be captured by the protocols at the base of the blockchain (for instance Bitcoin and Ethereum). However, according to blockchain investor Paivinen due to ease of forking, incentives to compete and improved interoperability and interchangeability also in a blockchain-based economy, protocols might get thinner. Although the marginal value of scale might be lower compared to a web-based economy, where massive scale created an economic advantage. The success of the Blockchain will depend on its commercial viability!
proof-of-stake
A Proof of Stake (PoS) is a form of consensus algorithm used to achieve agreement across a distributed network. As such it is, together with Proof of Work, among the key consensus algorithms for Blockchain protocols (like the Ethereum’s Casper protocol). Proof of Stake has the advantage of security, reduced risk of centralization, and energy efficiency.
proof-of-work
A Proof of Work is a form of consensus algorithm used to achieve agreement across a distributed network. In a Proof of Work, miners compete to complete transactions on the network, by commuting hard mathematical problems (i.e. hashes functions) and as a result they get rewarded in coins.
vbde-framework
A Blockchain Business Model according to the FourWeekMBA framework is made of four main components: Value Model (Core Philosophy, Core Values and Value Propositions for the key stakeholders), Blockchain Model (Protocol Rules, Network Shape and Applications Layer/Ecosystem), Distribution Model (the key channels amplifying the protocol and its communities), and the Economic Model (the dynamics/incentives through which protocol players make money). Those elements coming together can serve as the basis to build and analyze a solid Blockchain Business Model.
ethereum-blockchain
Ethereum was launched in 2015 with its cryptocurrency, Ether, as an open-source, blockchain-based, decentralized platform software. Smart contracts are enabled, and Distributed Applications (dApps) get built without downtime or third-party disturbance. It also helps developers build and publish applications as it is also a programming language running on a blockchain.
the-graph-token
The Graph is an ERC20 Utility Token (built on top of Ethereum) to enable consumers to freely query the blockchain through a fully decentralized database kept by indexers, incentivized by the payment of tokens (called GRT). The network is also ministered by curators and delegators that help maintain a high-quality index.
bat-token
BAT or Basic Attention Token is a utility token aiming to provide privacy-based web tools for advertisers and users to monetize attention on the web in a decentralized way via Blockchain-based technologies. Therefore, the BAT ecosystem moves around a browser (Brave), a privacy-based search engine (Brave Search), and a utility token (BAT). Users can opt-in to advertising, thus making money based on their attention to ads as they browse the web.
ripple-blockchain
In 2012, co-founders Christian Larsen and Jed McCaleb created Ripple, a technology acting as both a pre-mined cryptocurrency called XRP and a digital payment platform enabling monetary transactions. Where Ripple is the tech company, XRP is the decentralized ledger.
stellar-blockchain
In 2014, Jed McCaleb – which also played a key role in the development of Ripple – created a cryptocurrency to provide fast, reliable, and affordable money transactions. The same cryptocurrency has considerably grown seven years later. It is now one of the most stellar cryptocurrencies to provide a real-time platform that links banks, payment systems, and people. Meet, Stellar!
bittorrent-token
In early 2019, a joint project between TRON and BitTorrent Foundation called BitTorrent Token came to fruition. BitTorrent Token launched to tokenize in-demand file-sharing protocol and enhance content delivery and bandwidth accessibility with blockchain technology.
chainlink-token
Chainlink is considered the most established decentralized oracle network. As an ecosystem housing several decentralized oracle networks running simultaneously. As a decentralized oracle service built on Ethereum, Chainlink has the power to support the development of blockchain solutions for both traditional businesses and enterprises.
decentralized-exchange-platforms
Uniswap is a renowned decentralized crypto exchange created in 2018 and based on the Ethereum blockchain, to provide liquidity to the system. As a cryptocurrency exchange technology that operates on a decentralized basis. The Uniswap protocol inherited its namesake from the business that created it — Uniswap. Through smart contracts, the Uniswap protocol automates transactions between cryptocurrency tokens on the Ethereum blockchain.
polkadot-token
In essence, Polkadot is a cryptocurrency project created as an effort to transform and power a decentralized internet, Web 3.0, in the future. Polkadot is a decentralized platform, which makes it interoperable with other blockchains.
cardano-blockchain
Designed and created as an alternative to Ethereum, Cardano claims to be the first decentralized blockchain protocol to use a scientific approach and undergo a peer evaluation.
solana-blockchain
Solana is a blockchain network with a focus on high performance and rapid transactions. To boost speed, it employs a one-of-a-kind approach to transaction sequencing. Users can use SOL, the network’s native cryptocurrency, to cover transaction costs and engage with smart contracts.

Main Free Guides:

Scroll to Top
FourWeekMBA
[class^="wpforms-"]
[class^="wpforms-"]