473,569 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Business Layer

Hi Gurus,

I am still a new developer, learning things everyday, need some concept
advices (Windows App.). I have learned that we should keep our code seperate
from user interface layer.

Suppose I have a form named Form1.

Before framework 2.0 we were creating a new class(Business layer) and put
all the code on it to keep it seperate from user Interface code.
But in Framework 2.0 Microsoft is automatically seperating the user
interface code and put it in a Form1.Designer. vb.

My question is if I don't create a new bussiness layer class and just use
the default class(Form1.vb) , then is it against the rule of business layer,
or should I continue to use the Business class.

I need some advises/suggestion.

Thanks for any help you can provide on this.
Green

Nov 23 '05 #1
6 2976
Green,

What you describe are called "partial classes". The main purpose and use of
partial classes is to allow for code generation to work better with non-code
generated content. The IDE generates the code for your controls on the form
but it does not alter the procedural code that you add to interact with your
controls. This should really be the limit to which partial classes are used.
Others might offer differing opinions.

I think that business or data logic should remain in different classes.

The place where your suggestion breaks down is if you want to create an
application that is both web based and forms bases. Putting business logic /
code in the partial class for the form does not allow it to be shared
between the two. In addition, your business code will typically contain
logic that can be shared between multiple forms.

Hope this helps.

--

Andrew Robinson
www.binaryocean.com
www.bellinghamdotnet.org
"Green Taylor" <Gr*********@no spam.com> wrote in message
news:u1******** ******@TK2MSFTN GP15.phx.gbl...
Hi Gurus,

I am still a new developer, learning things everyday, need some concept
advices (Windows App.). I have learned that we should keep our code
seperate from user interface layer.

Suppose I have a form named Form1.

Before framework 2.0 we were creating a new class(Business layer) and put
all the code on it to keep it seperate from user Interface code.
But in Framework 2.0 Microsoft is automatically seperating the user
interface code and put it in a Form1.Designer. vb.

My question is if I don't create a new bussiness layer class and just use
the default class(Form1.vb) , then is it against the rule of business
layer, or should I continue to use the Business class.

I need some advises/suggestion.

Thanks for any help you can provide on this.
Green

Nov 23 '05 #2
Green,

Andrew is absolutely correct. I wanted to jump in with some general
advice. It's great that you are learning and that you are asking these
questions to a community of peers. I would urge you to consider this.
The fact that you have a single class called BizLayer, is not enough
abstraction. You should really be looking at what metaphors exist in
your problem space and creating classes that represent and manage those
metaphors. We could talk for a long time about how to do interface
abstraction, decoupling, and proper design, however there are many more
qualified then me and may books discussing it. I am glad you are
asking questions and encourage you today to start to read about design
principals and patterns. You may not get them yet, but they will start
to make sense as you continue to build software. There is one in
particular that helped me with my designs. The "Single Responsibility
Principal". Start with that one. It will help you understand that
your system is made up of many classes (i.e. metaphors) and you should
not be afraid of brining them to life.

Just hoping to spur design thought in a new developer. Remember
computer science is not about the technology, it's about problem
solving. Solving problems is about understanding them. Understanding
them is about breaking them down. Break them down by using metaphors.

Hope this helps,
Michael Moser

Nov 23 '05 #3
Thanks Andrew and Michael for answering my question and clearing my doubt.

Green

<mi************ @gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Green,

Andrew is absolutely correct. I wanted to jump in with some general
advice. It's great that you are learning and that you are asking these
questions to a community of peers. I would urge you to consider this.
The fact that you have a single class called BizLayer, is not enough
abstraction. You should really be looking at what metaphors exist in
your problem space and creating classes that represent and manage those
metaphors. We could talk for a long time about how to do interface
abstraction, decoupling, and proper design, however there are many more
qualified then me and may books discussing it. I am glad you are
asking questions and encourage you today to start to read about design
principals and patterns. You may not get them yet, but they will start
to make sense as you continue to build software. There is one in
particular that helped me with my designs. The "Single Responsibility
Principal". Start with that one. It will help you understand that
your system is made up of many classes (i.e. metaphors) and you should
not be afraid of brining them to life.

Just hoping to spur design thought in a new developer. Remember
computer science is not about the technology, it's about problem
solving. Solving problems is about understanding them. Understanding
them is about breaking them down. Break them down by using metaphors.

Hope this helps,
Michael Moser

Nov 23 '05 #4
I have one more question.
Is is always a good idea to create a bussiness logic in a new class even if
we don't use/share it anywhere else.

Green

<mi************ @gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Green,

Andrew is absolutely correct. I wanted to jump in with some general
advice. It's great that you are learning and that you are asking these
questions to a community of peers. I would urge you to consider this.
The fact that you have a single class called BizLayer, is not enough
abstraction. You should really be looking at what metaphors exist in
your problem space and creating classes that represent and manage those
metaphors. We could talk for a long time about how to do interface
abstraction, decoupling, and proper design, however there are many more
qualified then me and may books discussing it. I am glad you are
asking questions and encourage you today to start to read about design
principals and patterns. You may not get them yet, but they will start
to make sense as you continue to build software. There is one in
particular that helped me with my designs. The "Single Responsibility
Principal". Start with that one. It will help you understand that
your system is made up of many classes (i.e. metaphors) and you should
not be afraid of brining them to life.

Just hoping to spur design thought in a new developer. Remember
computer science is not about the technology, it's about problem
solving. Solving problems is about understanding them. Understanding
them is about breaking them down. Break them down by using metaphors.

Hope this helps,
Michael Moser

Nov 23 '05 #5
A better way to think about what you are asking is maybe should you be
putting more than one class in each file? Some argue that putting multiple
related classes in one physical file is a good thing. I put each class in
its own file with very very few exceptions. Sometimes building business code
into a class helps simplify design and improve readability even when said
business code is used only in a single place. And you never know when you
might reuse the same logic else where in your application.

Like all aspects of programming, there are many ways to look at this and
typically, there is never only one correct answer. I often wonder if I am
writing and designing in the "best" way. It is nice just knowing that others
struggle with these issues just as I do.
--

Andrew Robinson
www.binaryocean.com
www.bellinghamdotnet.org
"Green Taylor" <Gr*********@no spam.com> wrote in message
news:ei******** *****@TK2MSFTNG P11.phx.gbl...
I have one more question.
Is is always a good idea to create a bussiness logic in a new class even
if we don't use/share it anywhere else.

Green

<mi************ @gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Green,

Andrew is absolutely correct. I wanted to jump in with some general
advice. It's great that you are learning and that you are asking these
questions to a community of peers. I would urge you to consider this.
The fact that you have a single class called BizLayer, is not enough
abstraction. You should really be looking at what metaphors exist in
your problem space and creating classes that represent and manage those
metaphors. We could talk for a long time about how to do interface
abstraction, decoupling, and proper design, however there are many more
qualified then me and may books discussing it. I am glad you are
asking questions and encourage you today to start to read about design
principals and patterns. You may not get them yet, but they will start
to make sense as you continue to build software. There is one in
particular that helped me with my designs. The "Single Responsibility
Principal". Start with that one. It will help you understand that
your system is made up of many classes (i.e. metaphors) and you should
not be afraid of brining them to life.

Just hoping to spur design thought in a new developer. Remember
computer science is not about the technology, it's about problem
solving. Solving problems is about understanding them. Understanding
them is about breaking them down. Break them down by using metaphors.

Hope this helps,
Michael Moser


Nov 23 '05 #6
It's been my experience that every class as Andrew says should be in
it's own file. It's just easier for the next guy or gal who works with
your software to find their way around your solution.

Nov 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
5035
by: Stuart Hilditch | last post by:
Hi all, I am hoping that someone with some experience developing nTier apps can give me some advice here. I am writing an nTier web app that began with a Data Access Layer (DAL), Business Logic Layer (BLL) and User Interface Layer (UIL). The problem I found with this was circular referencing...
16
9007
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
4
3006
by: pratham | last post by:
Hi! I'm making a database application and i heard from a friend that it is more proffecional and easy to do this with bussines objects. Can anyone tell me where i can find more info on bussines objects and how to implement them with c#? I would appreciate any help. How can i decide that what things go into business layer and what
1
1872
by: Nemisis | last post by:
hi guys, Currently converting an old classic asp system to a OOP asp.net application. We are building the new application using a 3 tier arcitecture and i was wondering about the following. I have a parent class, that when inserted, inserts a few child classes into the database, based on other classes. In the old system, this is wrote...
2
1996
by: Ranginald | last post by:
Hi, I am confused about the business layer vs. the dal layer and I could use some help..... I. If the DAL layer has all the methods to work with the db with a typed data sey (e.g. ShowProducts(), InsertProducts() ), then why does the business layer need to wrap these methods with set/get?
6
14139
by: Dhananjay | last post by:
hello everyone i have got a problem i want to design business layer, data access layer , presentation layer for asp.net using C#.net , can anyone help me to solve this problem. i want some resources to complete this. i am trying very hard. Do you have any idea about website or any links where i can find some examples based on this concept.can...
25
2755
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as this application is heavily data-centric around MSDE database. Would it be better to use custom business objects or extend
8
4122
by: morleyc | last post by:
Hi, until recently i was quite happy to add data sources from mssql database in visual studio and drag the datasets directly onto the form this creating a directly editable form which worked well. However i have recently started a project which will require synchronization to a remote database. Also the underlying database provider may...
9
2724
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic in. My business classes are, of course, decorated with the: <System.ComponentModel.DataObject() attribute. So, I drop a GridView on a webform...
8
1752
by: Charles Law | last post by:
This is a sort of pattern question, but relating to how components are coupled in a three-tier system. I have a presentation layer, business layer and data access layer, the first is the EXE, whilst the other two are implemented as DLLs. The EXE also references a DLL that contains various user controls, one of which is based on a grid...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.