Implement business logic layer

C

Chris Zopers

Hello,

I would like to know what's the best way to implement a business logic
layer between my user interface and my database.

I would say I'd make a dll-project for the business logic layer and make
classes that represent objects/tables. For example, if I have a table
named 'tblPersons' I would make a class named 'clsPersons' and a class
'clsPerson' that represents one person/record. In class 'clsPersons' I
can make some business logic like 'get all persons living in a certain
city'.

What's the best way to display business logic in a Visual Basic.NET or
ASP.NET user interface? Should I use datasets (so my business logic
layer returns a dataset instead of a class object) or should I use the
class objects? If so, whats the best way to display these class objects?

For example, say I've developed a windows form to display a persons
data. From my business logic dll I've received an object of the type
clsPerson. I can't use databindings on a class object, can I?

Hope some can tell me more about this!

Greetings,
Chris
 
D

DArnold

Chris said:
Hello,

I would like to know what's the best way to implement a business logic
layer between my user interface and my database.

I would say I'd make a dll-project for the business logic layer and make
classes that represent objects/tables. For example, if I have a table
named 'tblPersons' I would make a class named 'clsPersons' and a class
'clsPerson' that represents one person/record. In class 'clsPersons' I
can make some business logic like 'get all persons living in a certain
city'.

What's the best way to display business logic in a Visual Basic.NET or
ASP.NET user interface? Should I use datasets (so my business logic
layer returns a dataset instead of a class object) or should I use the
class objects? If so, whats the best way to display these class objects?

I never used datasets and recordsets, not saying there is nothing wrong
with them. I favor the business and data persist objects. Even more so,
I favor the object that contains the business rules and data persist
code in one object, a very powerful solution.
For example, say I've developed a windows form to display a persons
data. From my business logic dll I've received an object of the type
clsPerson. I can't use databindings on a class object, can I?

Yes, you can do databindings on a class object. if you know how to do it.
Hope some can tell me more about this!

You get the CSLA book and read it, you download the CSLA Framework and
understand the basic class objects that are being used, you download the
project and see how it all works.

Then if you like, you can say I don't need the CSLA Framework, because I
have the basics, what the objects and how they work that are needed in a
solution, and I can do it myself from scratch.

http://www.lhotka.net/Article.aspx?id=1351540e-b941-446a-bacb-e0059cc82ee7

You may find some other examples of OOPs programming where the business
and data persist logic is separated, but it's still based on the basic
objects that are being talked about the the CSLA examples.
 
S

sloan

See
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry
or
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!139.entry

Stop with the Hungarian Notation. (nix on the clsSomeObject prefixed with a
cls)

public class Person
end class

public class PersonCollection
end class


//Should I use datasets (so my business logic
layer returns a dataset instead of a class object) or should I use the
class objects?
//
At the bottom of the 2nd URL above I list this URL:
And a reference to read from start to finish, aka, very informative for a
bird's eye view:
*
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/BOAGag.asp


If you pick "Custom Business Objects", then you should look at CSLA
framework, because Rocky makes it easier for you to take custom business
objects and make them bindable.
(IEditableObject and others I believe is the interface, its not trivial to
implement).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top