473,395 Members | 1,456 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,395 software developers and data experts.

Designing Classes...Art or Science?

I'm wondering if there are certain processes that I could follow to
learn to design better classes? Where could I find these processes?
Is designing classes more of an art that comes from experience or can it
at least be somewhat done by a process?

I have the most trouble with abstracting the specifics, such that a
class could be reused or just be generic such that anyone could use them.

My frustration has emerged in trying to learn n-tier architecture. I
can't seem to find a project small enough such that my eyes don't glaze
over trying to decipher the data or business layers. Or I can't find a
project that doesn't involve ASP.Net which I haven't really learned yet.
Nov 21 '05 #1
1 1273
Bob
You may not hear this very often, but the "art" of good architecture reminds
me a lot of taking thermo back in college. It was generally considered a
hard course, but I loved it (partly because easy doesn't keep my attention).
At the final we were allowed to bring a page of notes. I saw that many
people had scrawled as many equations they could in the tiniest hand on both
sides of their single 8 1/2 x 11 page. All I had was four equations written
on a note card (why not three? I can't remember). That's all I needed. From
them I easily derived everything required to answer all the problems on the
test, and I finished an hour early. A few precious drops of knowledge served
me far better than the fire hose.

How does this relate to designing an n-tier system? I believe there are a
few First Principles of design that can guide you through any problem:
Simplicity. Normalization. Interchangeability. Manageability.

- Simplicity
If it's not simple (this can be a relative, intuitive term), learn to hate
it. Be ruthless.

- Normalization
It's not just good database practice. Normalize your logic, don't repeat it
all over the place. Subclass. Use DLL's.

- Interchangeability
Always design with the assumption (even if it's not likely) that your UI can
change independently of the functions your app delivers to its users. As an
exercise, make a form to deliver a few data presentation and editing
functions to a user. Then make another, different form to deliver the same
functions, maybe with a different look and feel. Then apply the
Normalization principle to these data-presenting and editing functions...
the beginnings of "n-tier" design will emerge naturally and intuitively.

- Manageability
Don't "fly blind" with your data usage. When the time comes to make some
serious changes to your database design, you should be in the position to be
able to easily map the footprint of the impact. Don't worry too much about
this when your learning, but always keep it in mind. If you hard code SQL
into your app, ask yourself, "What if I have SQL like this (~x100) in lots
of places? How can it be managed so I can tell without doing a text search
through all of my projects where a certain table is being used?" (eventually
you may decide SQL belongs nowhere in hard code, even in the "business"
layer). Also ask yourself periodically, "How could I make my app keep track
of (and maybe self-document) all data-altering functions that are relevant
to its users?".

Some may tell you to learn by example, and that's good, too, but I strongly
recommend you focus on building a strong understanding of the "what" and
"why", as well as the "how". Do this and eventually you'll be able to take a
look at other people's work and make extremely relevant judgments, like
"this design is bad because the logic isn't normalized", or "I don't like
this system, how could you possibly manage changes to the database?".

These links also talk about proper design flowing from First Principles.
http://www.sdmagazine.com/documents/.../sdmsdw1b.html
http://www.asktog.com/basics/firstPrinciples.html

HTH,
Bob

"slonocode" <oh******@spamsux.sux> wrote in message
news:36*************@individual.net...
I'm wondering if there are certain processes that I could follow to
learn to design better classes? Where could I find these processes?
Is designing classes more of an art that comes from experience or can it
at least be somewhat done by a process?

I have the most trouble with abstracting the specifics, such that a
class could be reused or just be generic such that anyone could use them.

My frustration has emerged in trying to learn n-tier architecture. I
can't seem to find a project small enough such that my eyes don't glaze
over trying to decipher the data or business layers. Or I can't find a
project that doesn't involve ASP.Net which I haven't really learned yet.

Nov 21 '05 #2

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

Similar topics

6
by: E G | last post by:
Hi! I am having problems in designing a class. First, I have a base class that allocates a 3D data set and allows some other mathematical operations with it, something like this: template...
3
by: alexhong2001 | last post by:
When design a class, should always make it "derivable" as a base class? Is there really a situation that the designed class not "derivable"? When should make a member "protected"? Only when...
45
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
0
by: Julia Beresford | last post by:
Hi I have a VB .NET class library with classes and collection classes (classes that implement ICollection) that allow a client to read and write data to and from an SQL database. For example if...
8
by: pransri2006 | last post by:
Hi guys! I think all of u know about the designing of compilers. Can any body tell me about the designing of the compilers. And also tell me the difference between the compilers and Interpreter...
173
by: Zytan | last post by:
I've read the docs on this, but one thing was left unclear. It seems as though a Module does not have to be fully qualified. Is this the case? I have source that apparently shows this. Are...
5
by: The Cool Giraffe | last post by:
I'm designing an ABC and in connection to that i have run into some "huh!" and "oh...". Let me put it as a list. 1. Since the class will only contain bodies of the methods, only the header file...
1
weaknessforcats
by: weaknessforcats | last post by:
Introduction Polymorphism is the official term for Object-Oriented Programming (OOP). Polymorphism is implemented in C++ by virtual functions. This article uses a simple example hierarchy which...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.