Good resource for Classes - best practices

  • Thread starter Thread starter Rico
  • Start date Start date
R

Rico

Hello,

I'm looking for a bit of a crash course on how to properly put together a
connection class and a customer class. This will be done in Access VB as
well as VB6, so anything that uses one or the other (or both) as an example
would be great.

Thanks!

Rick
 
Rico said:
Hello,

I'm looking for a bit of a crash course on how to properly put together a
connection class and a customer class. This will be done in Access VB as
well as VB6, so anything that uses one or the other (or both) as an
example would be great.


That's extremely vague. Can you provide more information on what
functionality you're wanting to get from these classes? For that matter, why
do you think you need BOTH of these classes? I can see a Customer class, but
not a Connection class (presumably, this class would "hold" the connection
to the database). It'd probably be better to just provide a connection
string to the Customer class and let it "manage" the connection itself.
 
MikeD said:
That's extremely vague. Can you provide more information on what
functionality you're wanting to get from these classes? For that matter, why
do you think you need BOTH of these classes? I can see a Customer class, but
not a Connection class (presumably, this class would "hold" the connection
to the database). It'd probably be better to just provide a connection
string to the Customer class and let it "manage" the connection itself.

I thought he likely meant a "data source" instead of "connection" class.
(And Customer := Consumer) But like you, believed the question was too vague
to provide a good answer.

However, a Connection Class can be useful in situations where you connect to
more than one source using the same code base (ie, use an IConnection as
your ADO source), or if you need to centralize Errors or Events.

-ralph
 
Thanks for your replys...and YES that's the kind of information I need (re:
why I'm using a connection class)....I DON'T KNOW WHY aside from the fact I
was asked to create them, hence I need a crash course on classes and best
practices on building and using them. I've been feeling my way around a
little, looking at a template to know how to use the class (Let and get for
properties, etc.) but really don't feel like I know what I'm doing.

I guess on the contrary, my question was too specific. I'm not looking for
info specifically on how to put together a connection class and customer
class, but more about "Best Practices when creating classes" and also find
information / best practices specifically, using a connection class.

You can also email me at the following email address
hemmingway427 (at) shaw (dot) ca

In the form of an email address of course.

Thanks!
Rick
 
Rico said:
Thanks for your replys...and YES that's the kind of information I need (re:
why I'm using a connection class)....I DON'T KNOW WHY aside from the fact I
was asked to create them, hence I need a crash course on classes and best
practices on building and using them. I've been feeling my way around a
little, looking at a template to know how to use the class (Let and get for
properties, etc.) but really don't feel like I know what I'm doing.

I guess on the contrary, my question was too specific. I'm not looking for
info specifically on how to put together a connection class and customer
class, but more about "Best Practices when creating classes" and also find
information / best practices specifically, using a connection class.

You can also email me at the following email address
hemmingway427 (at) shaw (dot) ca

In the form of an email address of course.

Thanks!
Rick

It sounds like you need a course in OO, not necessary the mechanics.
Any of the Advanced VB books should be helpful. A very useful book, if you
can find it, is Stamatakis' "Microsoft Visual Basic Design Patterns"
(Microsoft Press).

For OO in general I like Meyer's "Object-Oriented Software Construction".
Mainly because he comes at it from a slightly different direction than most
of the popular books (which you will also end up with a few of <g>). It is
always useful to have more than one view.

-ralph
 
Hi Ralph,

Yes, that is what I definitely need for sure. Right now I'm in the
unenviable position of having very little expreience with classes, yet being
asked to create them just the same. I was hoping to find a quick and dirty
guideline on best practices only so I don't go too far in the wrong
direction or at least be able to recover gracefully if I do (if that makes
sense). If I can't find anything, I'll just plug along as I'm doing now,
but always hate doing things without the benefit of some prior research.

I will check out the design patterns book for sure.

Rick
 
classes are a waste of time.

just use modules.

I've seen countlesss people take a module and paste a module into the
class; change a couple of thigns.. and presto-chango-- they think that
they are OOP experts.

It makes me sick

-Aaron
 
Rico said:
Hi Ralph,

Yes, that is what I definitely need for sure. Right now I'm in the
unenviable position of having very little expreience with classes, yet being
asked to create them just the same. I was hoping to find a quick and dirty
guideline on best practices only so I don't go too far in the wrong
direction or at least be able to recover gracefully if I do (if that makes
sense). If I can't find anything, I'll just plug along as I'm doing now,
but always hate doing things without the benefit of some prior research.

I will check out the design patterns book for sure.

Rick
<snipped>

This just isn't the media for getting into a general discussion of OO. When
you come across a specific question for a specific solution - then by all
means post.

A main sore point with classic VB and OO is not all OOPL constructs are
available, and because of VB's general reliance on implementing "Classes"
using OLE/COM, there does tend to be some over-head. (However, you will reap
immediate benefits in readability and reuse.) There is also perhaps more
resistance to OO among VBers for the above reasons as well as a long
tradition of using VB in a linear or data-centric fashion. (Aaron's comment
is not an un-common opinion. <g>)

The best way to gain a feel for OO is to read other peoples code and most
importantly just start playing with it. Don't be overly concerned with doing
it the "right-way" at first. For two reasons: One, there never is a
"right-way", there are always multiple ways to provide a solution - some
just make more sense than others for YOUR problem domain. Second, the
average competent programmer usually has a feel for what is working and what
is not. You may not know exactly why something is ugly - but you just feel
it. Unfortunately, you usually have to start typing before the bells start
going off. <g>

One of the nice advantages to OO is that you can generally cut 'n paste your
way out of a blind alley, cf. to a linear approach where one often ends up
scrapping the whole thing. <g>

-ralph
 
Ralph;

I militantly disagree with this:

A main sore point with classic VB and OO is not all OOPL constructs are

available

it is not a sore point.

the users of VB aren't sitting here-- asking us to build objects.

75% of VB6 developers never built a class.

I don't see this as a 'main sore point' I see your OOP _CRAP_ as
unnnecessary HOGWASH that Microsoft has bestowed upon us.

it is DEAD WEIGHT; AN UNWANTED 'FEATURE'

start fixing bugs and stop selling us on features you stupid ****ing
company


-Aaron
 
it's not that 'vb isnt fully oop'

it's not that 'we need oop'

it is an unnecessary FEATURE that does
_NOTHING_PRACTICAL_EXCEPT_SLOW_DEVELOPMENT_AND_EXECUTION_

applications built with classes RUN SLOWER than real applications

go sell your wares elsewhere, VB COMMIE

-Aaron
 
This is not Microsoft. It's populated mainly by helpful private people who
don't need bad language or abuse. Even if your beef has substance, this is
not the right target..
 
THIS _IS_ MICROSOFT

when you sit there and you accept all of these changes in the
language-- when you help VB6 people to learn the new language you are
destroying a legacy that has value for some useless CON.

VB.net has already been killed.

If you're not pissed off then you're not enlightenend.

I'm just sick and ****ing tired of them selling us a new version
instead of FIXING BUGS.

it's like-- we spend 3 years learning the new version and then presto
chango; it's changed again.

I just don't see the value in VB.net.

I wish that MS didn't create C#.

but as it stands now; C# is vastly more popular; and I can't sit idly
by while new programmers come into this obsolete language.

-Aaron
 
THIS _IS_ MICROSOFT

when you sit there and you accept all of these changes in the
language-- when you help VB6 people to learn the new language you are
destroying a legacy that has value for some useless CON.

VB.net has already been killed.

If you're not pissed off then you're not enlightenend.

I'm just sick and ****ing tired of them selling us a new version
instead of FIXING BUGS.

it's like-- we spend 3 years learning the new version and then presto
chango; it's changed again.

I just don't see the value in VB.net.

I wish that MS didn't create C#.

but as it stands now; C# is vastly more popular; and I can't sit idly
by while new programmers come into this obsolete language.

-Aaron
 
To the original poster: Check out Deborah Kurata's
book, "Doing Objects in VB6". I read her VB2005 book
and believe both cover the same thing -- object-oriented
programming with Visual Basic. Her VB6 book was available
on amazon for like 61 cents that last time I checked.

To Aaron - pfui.

Robin S.
-------------------------------------
 
RobinS said:
To the original poster: Check out Deborah Kurata's
book, "Doing Objects in VB6". I read her VB2005 book
and believe both cover the same thing -- object-oriented
programming with Visual Basic. Her VB6 book was available
on amazon for like 61 cents that last time I checked.

To Aaron - pfui.

Robin S.
<snipped>

And perhaps worth only 61 cents.

Ms. Kurata was more author than authority in this early book. I say 'was',
because to her credit, her knowledge and understanding of OO has visibly
grown since then. "Doing Objects" is an interesting book, once you have
learned enough to filter out the nonsense. I would have reservations
recommending it as a first book even at 61 cents.

-ralph
 
Ralph said:
<snipped>

And perhaps worth only 61 cents.

Ms. Kurata was more author than authority in this early book. I say
'was',
because to her credit, her knowledge and understanding of OO has
visibly
grown since then. "Doing Objects" is an interesting book, once you
have
learned enough to filter out the nonsense. I would have reservations
recommending it as a first book even at 61 cents.

-ralph

Interesting; it wasn't her first book; I think she started with
"Doing Objects in VB4."

I can't speak for the VB6 book; I got a lot out of the VB2005 version.
It exemplified how to use business objects and the 3-layer model
really well. It wasn't a OOP class/inheritance/interfaces, etc.,
reference, although it helped me understand that with more clarity.

Robin S.
 
yeah I've got that book.. it's a decent read.

it still didn't convince me to build everything into classes.
and I dont think that taking code that is in a module and pasting it
into a class makes you an expert OOP programmer

I wish that there were better documentation on this shit; but the
bottom line is that OOP makes your programmers SLOWER and HARDER TO
DEVELOP.


-Aaron
 

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

Back
Top