Posted by: ahmedashfaque | December 8, 2014

software design fundamentals – part2

In the first part of this series we have seen, complexity in software design is the main issue and how we can reduce complexity by slicing and dicing the design. Today we will see how this makes your job simpler.

Slicing your application into layers is one of the best ways to not only reduce your complexity but also make your design a lot better. You have the user interface which your users see and from where they enter the inputs to your application. The application runs and does the required things based on these user inputs. It is very much possible to take this user interface separated from other parts of your application.

Concentrate only on the user interface when you are designing it and forget about other parts of your application. The user interface will have a lot of static information and some dynamic content. If you are developing the application to be used as a website then the simplest way to design it is think of it as consisting of web pages. You can design the pages as html pages using markup HTML tags. there are lots of free tools to design the web pages. There are also free scripts to create menus.

Once your static design of the user interface is ready then you can think of the dynamic content. You can find good resources to write dynamic content using javascript, vbscript, dotnet, java etc. You can design your forms and their content like textboxes, buttons etc. using free tools available.

So far you have seen, you do not need to know about your other layers in the application. So far so good. Later you will need to connect your web forms and fields which need dynamic content, to the business layer.

Now that your user interface is ready, you can think about the business layer. The business layer is where you will write your logic for getting data, processing data, sending data etc. Suppose your application is about building an online bank account access system for customers then your data is all about customer authentication, customer bank account, bank account processing for viewing balance, transferring money into some other bank account etc. If you are using an object oriented design then you need to create classes for user management, bank account management etc. Try to use best practices like encapsulating your data, modular class design, inheritance, persistence when you create your classes.

The last layer is your database. You need to create database entities like tables and fields for holding data for bank account information, user information, bank information, transaction information etc.

Some important points to note:

  • If you want to do simple database queries (e.g. display account balance, user authentication etc.) without doing any transaction then you can use database queries directly from the user interface. but never do transaction activities here.  when you open the database connection from user interface, make sure that you encrypt and decrypt the data.
  • All business transactions should be done in the business layer. Define your classes so that you will be able to take care of transactions like transfer money, pay bills, maintain user accounts (user name/password change, address change etc.). result of business transaction should be shown in the user interface.
  • Always ensure you open a database connection only when you are doing any database query. Always close the database connection when you end your query.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: