Daniel Sapoundjiev on
  Component Business Logic - CBL

Component Business Logic - CBL

Reusable logic in business layer of software application


As we write software, we want in the end to produce a final release of the project. We want to have product to offer it to the people. But it takes time. Small project can be made fast, but bigger one can take a lot of time. We want this project to be with high quality, so people will accept it.

Software development field is very dynamic field. There are always new technologies. Latest technologies and ideas from other fields are fast implemented there. People work day and night; they build big projects of any kind, for every business for every part of our life. So, itís amazing. But I see that itís hard for them. They want more and more, but at some point, the projects get bigger and it is so hard to handle them, hard to continue working on them. Hard to keep the quality when they get bigger. They want to build them fast, but it takes time. So much troubles during the project realization. And I see it, even in such dynamic field, with such cleverer people, they donít have the freedom that their minds need.

If we can write operating system like Windows for just one day, we can be a great software company. But it seems impossible. But nothing is impossible. I saw a way to write big projects for less time. Ok, may be not windows for one day. But thousand times faster than usual. I made a project and I saw it working in real life. I call this way of writing software One For All Software Development (OFA Software Development).

In this document will describe one part of this way of producing software. And this part is called Component Business Logic or for short CBL. Component business logic is an independent design technique and can be used in any software. Donít have to be part of OFA Software Development too.

Business logic and data live together. Business logic cannot live without a data. Data can live without the business logic in some static way, like in word document.

It is widely used to build a business logic layer to separate the code from the data layer and the presentation layer.

The business layer contains classes that contain the data and the business logic. They are mixed together. But if you want to reuse the business logic with other data you have to write it again. Test it again and every thing again. But specific logic is an independent part. You donít have to mix it with other staff. You can make it like separate component. And then you can use it in different projects.

You can see components in Delphi and C# but they are some how oriented to user interface components. And some how oriented to other components like Document, COM port that represents physical or logical entity. Like Html document, COM port, USB Port, Edit Box etc.

CBL is oriented to the logic. We want here to make a component that encapsulates some kind of logic. Not the object, not the entity.

But what is logic?

But what is logic! People used to think about logic like making decisions. You have some information and logically make the next logical step. Logic is an abstract thing. Like the decimal numeric system Like the money, like mathematics, and like time. They donít exists in nature, but they are invented by the people to help them in their life. They are useful but man must know which is real and which is not in his life. So the things just working some way and we use logic to describe the way that they work. But they donít have logic, they just live this way. They just move this way.

Not universal business logic

Even when it is difficult to make some business logic universal for reuse, I mean to make it as a reusable component, it is better to separate it from the data of the business layer. Sometimes when this logic stays outside separately there comes an idea how to make it universal component.

Reflection in CBL

A way to make CBL undependable is to configure it to work with some classes and fields in these classes. This can be implemented with the help of the reflection. Reflection helps very good to separate CBL from concrete classes and fields. You need just to give some names for the classes and fields in them.

Observer pattern

Observer pattern finds its place here too. You can attach to the data and listen for changes important for the concrete CBL component. Then this component operates logically. However the business data object model is observed by a lot of other stuff. So, observing comes here naturally.

Memory stuff

When the model is loaded not all CBLs are loaded. When user do not use some CBLs they are not in the memory. That makes programs use less memory and startup faster. Open models faster. Close faster etc.

Internal logic for model

There is some logic that model can not leave without it. It has to be always with the model. Even outside of it. That is something to thing about

Back to main menu