3 levels of architecture?

Using VB.NET 2008

I want to know what is 3 architecture tier for Windows applications?

Is it possible to give an example of creating code for insert, delete, update in a database using a three-tier architecture.

Note that I am not asking for real code. Just give me an example.

+2


source to share


6 answers


I'll give you the gist of it. Real torque.

You have three levels:

  • DAL - Data Access Layer
  • BRL - Business Rules Level
  • Presentation - forms, etc.


In DAL, you configure how your application connects to databases, how it retrieves datasets, etc. etc. etc. Anything related to data access.

In BRL, you set how your program will handle data received from the DAL. Ways and other things here.

And in the Presentation area, you just make things empty and create things from BRL. The presentation area should never touch the DAL, nor the beauty of the 3rd level layout. You can work in different areas, and not step on other peoples.

0


source


From Layered Architecture



Three-tier '[2] - client-server architecture, in which the user interface, the logic of the functional process ("business rules"), computer data storage and data access are supported as independent modules, most often on separate platforms.

+1


source


Currently, a normal 3-tier application consists of a user interface written in Javascript, CSS and HTML that runs in the browser, a business rule layer that runs on a web server and can actually be built on VB.NET, and a storage layer that runs on a database server written in SQL and stored procedures.

It would now be possible to create a UI layer in VB.NET as a Windows application, which then calls the business rules layer on the web server using the web services interface. This gives you more flexibility than a browser and doesn't require learning as many APIs as possible, but it doesn't. This can only really be done in an enterprise situation.

This article has a simple VB.NET application, which is a graphical Windows application that calls the Google Web Services API to perform searches and spell check. This is a good example of a UI layer. Then check out this article and use a web service developed with VB.NET. This is in line with the business rules layer, and in a real 3-tier application, it would be based on a database like SQL Server. If you were using Access, this would not be a real three-tier application. The database must be running on its own server and accessible over the network to be considered a tier.

The advantage of a 3-tier app is that you can scale each layer separately, and since each layer is simpler, scaling is easier too. DBAs can scale to a cluster of databases, the business rules layer can scale with a load balancer and multiple servers, and the user interface is simply replicated to as many clients as you need.

+1


source


I don't know if this is the right way to use it, but I often use 3-level int like this:

  • One big solution, with the name of the project
  • One dll project that has a DB connection using LINQ or whathever. Checking only the required database fields
  • Another DLL project that has a link to a project that is linked to the DB and validates all data using business administration rules. Sometimes you may want the repositorium class, which has methods that can be used from within the GUI layer.
  • Finally, the GUI layer, which can be HTML or WINForms, which refers to the bussines layer and invokes all the matching methods, transmits data transparently and waits for validation in the business process rules.

You can communicate with each layer using bool methods that return true if all is well and personalized exceptions for each possible error and capture them at the top level.

+1


source


I believe the best way to understand this is to look at an example. If you go here: http://www.codeproject.com/KB/vb/N-Tier_Application_VB.aspx

You can download the example and read the walkthrough for creating a very simple level 3 application in VB.Net. It's a bit outdated in that it's a Visual Studio 2003 project, but it should be easy enough to follow the upgrade wizard and run it to test it out.

0


source


I would like to give a quick overview of this programming style, and perhaps I will explain it in more detail next time.

First of all, the 3-Tire concept involves splitting your program or application that you design into 3 layers, the first level is for database management in CRUD operation which means {Create, Read, Update, Delete} data from your database using any types of databases: for example, Oracle, SQLserver, MySql, etc. This means that you can connect your application to any type of database without specifying a String connection to just one database, and we'll get more details on that next time.

The second level is the business layer, which includes user data validation and other similar operations in which you process your business rules and the core of the program, the third and last level is the presentation layer, which refers to user inputs and user interfaces of the user interface {Various input forms}

Honestly, you can split your solution {Program, application, site} into subroutines to avoid data loss, organize your work, and share your application development among the team members.

in my opinion, this is a wonderful thing to learn in the process of development, and as grapeVine told me, if you want to enrich your knowledge and experience, then you should recognize this important question.

0


source







All Articles