473,397 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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 2971
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*********@nospam.com> wrote in message
news:u1**************@TK2MSFTNGP15.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.googlegr oups.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.googlegr oups.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*********@nospam.com> wrote in message
news:ei*************@TK2MSFTNGP11.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.googlegr oups.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
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...
16
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
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...
1
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. ...
2
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....
6
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...
25
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...
8
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....
9
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...
8
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,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.