Question How to build the correct way of n-tier apps without service and remoting?

witecloner

Well-known member
Joined
Feb 12, 2009
Messages
45
Programming Experience
Beginner
Sorry if my thread is place in incorrect forum.

Hai All ...

Could anybody help me? i'm praticing how to build the n'tier application. I have read some book tell about this, like "Building Client/Server Applications With VB.NET" by Jeff Levinson, beth massi video tutorial "building simple n-tier applications", and other else.

In my practice, i create 3 projects to handle each layer progress. That are DAL (Data Access Layer), BLL(Business Logic Layer) and UIL (User Interface Layer).

My problem is i don't want to use web service like beth massi do, and i don't want to use remote object like Jeff L do. So i decide to create it by my rules. Here above something that i do.

In DAL Section, I put all datasource like Beth Massi do over here. I also create a manager class like massi do to handle datasource over here. Also in this class, i create the UML structure of this datasource.

VB.NET:
'SatuanManager.vb
Option Strict On
Option Explicit On

Imports TradingStudio.BLL.Structures
Imports TradingStudio.BLL.Interfaces
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient

Public Class SatuanManager

    'Inherits MarshalByRefObject

    Implements ISatuan

    Public Sub Delete_Record(ByVal intUID As Integer) Implements BLL.Interfaces.ISatuan.Delete_Record

    End Sub

    Public Function Loading_Data() As BLL.DataSet_Satuan Implements BLL.Interfaces.ISatuan.Loading_Data
        Dim ta As New DAL.DataSet_SatuanTableAdapters.UnitTableAdapter
        Dim Satuan As New BLL.DataSet_Satuan

        ta.FillByFlag(Satuan.Unit)

        Return Satuan
    End Function

    Public Function Loading_Record(ByVal intUID As Integer) As BLL.Structures.Structure_Satuan Implements BLL.Interfaces.ISatuan.Loading_Record

    End Function

    Public Sub Save_Record(ByVal StrucSatuan As BLL.Structures.Structure_Satuan, ByRef intUID As Integer) Implements BLL.Interfaces.ISatuan.Save_Record

    End Sub

#Region "Private Attributes"
    Private paUnitUID As Integer
    Private paUnitID As String
    Private paUnitName As String
    Private paUnitModerator As String
    Private paUnitFlag As Boolean
    Private paUnitModified As Date
#End Region

    Public ReadOnly Property UnitUID() As Integer
        Get
            Return paUnitUID
        End Get
    End Property

    Public ReadOnly Property UnitFlag() As Boolean
        Get
            Return paUnitFlag
        End Get
    End Property

    Public ReadOnly Property UnitModified() As Date
        Get
            Return paUnitModified
        End Get
    End Property

    Public Property UnitID() As String
        Get
            Return paUnitID
        End Get
        Set(ByVal value As String)
            paUnitID = value
        End Set
    End Property

    Public Property UnitName() As String
        Get
            Return paUnitName
        End Get
        Set(ByVal value As String)
            paUnitName = value
        End Set
    End Property

    Public Property UnitModerator() As String
        Get
            Return paUnitModerator
        End Get
        Set(ByVal value As String)
            paUnitModerator = value
        End Set
    End Property

End Class

In BLL Section, the dataset which i put in DAL Section auto generate over this section. I also create two class again in this section. There are Interfaces class and Structures class.

VB.NET:
'Interfaces.vb
Option Strict On
Option Explicit On

Imports TradingStudio.BLL

Namespace Interfaces

    Public Interface ISatuan
        Function Loading_Data() As DataSet_Satuan
        Function Loading_Record(ByVal intUID As Integer) As Structures.Structure_Satuan
        Sub Save_Record(ByVal StrucSatuan As Structures.Structure_Satuan, ByRef intUID As Integer)
        Sub Delete_Record(ByVal intUID As Integer)
    End Interface

End Namespace

VB.NET:
'Structures.vb
Option Strict On
Option Explicit On

Namespace Structures

    <Serializable()> Public Structure Structure_Satuan
        'Public Structure Structure_Satuan
        Public UnitUID As Integer
        Public UnitID As String
        Public UnitName As String
        Public Moderator As String 'Sama Dengan Operator
        Public Flag As Boolean
        Public Modified As Date 'bisa juga dengan menggunakan byte()
    End Structure

End Namespace

In BLL Section, I build user form over here. Over this user form i create a datagridview to show the dataset rows.

VB.NET:
'UI_Form.vb
Imports TradingStudio.BLL
Imports TradingStudio.DAL

Public Class Satuan_Main

    Private Sub Satuan_Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim DataSatuan As New DAL.SatuanManager

        Me.DataGridView1.DataSource = DataSatuan.Loading_Data.Unit

        With Me.DataGridView1
            .Columns("UnitUID").Visible = False
            .Columns("Flag").Visible = False
            .Columns("Modified").Visible = False
            .ReadOnly = True
        End With

    End Sub
End Class

And Here above my complete source :
myN-Tier

Am i build a correct way of the n-tier applications? where should i place user interface presentation? where should i place that uml object?

thank's
 
Back
Top