PC Review


Reply
Thread Tools Rate Thread

Architecture guidelines

 
 
Steve
Guest
Posts: n/a
 
      27th Sep 2005
As a rule of thumb, is it good practice to abstract application
functionality from the form code behind in a c# winforms app? I have a
single form application, but I'm not sure where I should be doing my main
processing, if I should be working with the Form class instance or creating
an "engine" class and doing everything there? Are there any general
guidelines?

Hope that makes sense...


 
Reply With Quote
 
 
 
 
Michael Nemtsev
Guest
Posts: n/a
 
      27th Sep 2005
Hello Steve,

it's a good practice to absctact app functionality from the everything, not
form
U need to extract interface from yout func code.
by the way, it the FW2.0 forms already separated from code

S> As a rule of thumb, is it good practice to abstract application
S> functionality from the form code behind in a c# winforms app? I have
S> a single form application, but I'm not sure where I should be doing
S> my main processing, if I should be working with the Form class
S> instance or creating an "engine" class and doing everything there?
S> Are there any general guidelines?
S>
S> Hope that makes sense...
S>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      27th Sep 2005

"Michael Nemtsev" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Steve,
>
> it's a good practice to absctact app functionality from the everything,

not
> form
> U need to extract interface from yout func code.
> by the way, it the FW2.0 forms already separated from code
>
> S> As a rule of thumb, is it good practice to abstract application
> S> functionality from the form code behind in a c# winforms app? I have
> S> a single form application, but I'm not sure where I should be doing
> S> my main processing, if I should be working with the Form class
> S> instance or creating an "engine" class and doing everything there?
> S> Are there any general guidelines?
> S>
> S> Hope that makes sense...
> S>
> ---
> WBR,
> Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour
>
> "At times one remains faithful to a cause only because its opponents do

not
> cease to be insipid." (c) Friedrich Nietzsche
>
>


Hi Michael, thank you for the reply
I'm not sure what you mean here "it the FW2.0 forms already separated from
code"
can you elaborate please?


 
Reply With Quote
 
Joanna Carter [TeamB]
Guest
Posts: n/a
 
      27th Sep 2005
"Steve" <(E-Mail Removed)> a écrit dans le message de news:
%(E-Mail Removed)...

| As a rule of thumb, is it good practice to abstract application
| functionality from the form code behind in a c# winforms app? I have a
| single form application, but I'm not sure where I should be doing my main
| processing, if I should be working with the Form class instance or
creating
| an "engine" class and doing everything there? Are there any general
| guidelines?

You are heading in a very good direction here :-)

In theory, you should be able to build and test all your business classes
without any UI at all; using NUnit to buid your test framework. Then once
you have proven that your business classes are "bug-free", you can start to
think about how you want to display the properties of instances of those
classes.

Certainly, you should separate you app functionality from you UI; you might
also consider separating your app functionality from your database
connectivity; see some articles on OPFs (Object Persistence Frameworks) on
my website www.carterconsulting.org.uk they are targetting Delphi but the
principles are the same.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      27th Sep 2005

"Joanna Carter [TeamB]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Steve" <(E-Mail Removed)> a écrit dans le message de news:
> %(E-Mail Removed)...
>
> | As a rule of thumb, is it good practice to abstract application
> | functionality from the form code behind in a c# winforms app? I have a
> | single form application, but I'm not sure where I should be doing my

main
> | processing, if I should be working with the Form class instance or
> creating
> | an "engine" class and doing everything there? Are there any general
> | guidelines?
>
> You are heading in a very good direction here :-)
>
> In theory, you should be able to build and test all your business classes
> without any UI at all; using NUnit to buid your test framework. Then once
> you have proven that your business classes are "bug-free", you can start

to
> think about how you want to display the properties of instances of those
> classes.
>
> Certainly, you should separate you app functionality from you UI; you

might
> also consider separating your app functionality from your database
> connectivity; see some articles on OPFs (Object Persistence Frameworks) on
> my website www.carterconsulting.org.uk they are targetting Delphi but the
> principles are the same.
>
> Joanna
>
> --
> Joanna Carter [TeamB]
> Consultant Software Engineer
>
>



Thank you for the great response Joanna!

I'm glad you mention Data access, I was just designing that (on paper) and
will be using MS Access at first, then if all goes well moving to SqlServer,
so I figured that a data access class for each provider inheriting a common
interface would make the transition smoother in the future. I was also
considering the same approach for the UI, currently it's a desktop client,
but I would like to offer a web client later.

I will check out your links.


 
Reply With Quote
 
Scott
Guest
Posts: n/a
 
      27th Sep 2005
I used exclusively sql for a long time, so I always used SqlConnection,
etc... Then I discovered quite a while back the interfaces IDbConnection,
etc., which changed my entire outlook on db access. It does take some extra
work, sometimes (like when you actually need to instantiate a connection)
but works so much better and is database "independent" (almost).

Scott

"Steve" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> "Joanna Carter [TeamB]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> "Steve" <(E-Mail Removed)> a écrit dans le message de news:
>> %(E-Mail Removed)...
>>
>> | As a rule of thumb, is it good practice to abstract application
>> | functionality from the form code behind in a c# winforms app? I have a
>> | single form application, but I'm not sure where I should be doing my

> main
>> | processing, if I should be working with the Form class instance or
>> creating
>> | an "engine" class and doing everything there? Are there any general
>> | guidelines?
>>
>> You are heading in a very good direction here :-)
>>
>> In theory, you should be able to build and test all your business classes
>> without any UI at all; using NUnit to buid your test framework. Then once
>> you have proven that your business classes are "bug-free", you can start

> to
>> think about how you want to display the properties of instances of those
>> classes.
>>
>> Certainly, you should separate you app functionality from you UI; you

> might
>> also consider separating your app functionality from your database
>> connectivity; see some articles on OPFs (Object Persistence Frameworks)
>> on
>> my website www.carterconsulting.org.uk they are targetting Delphi but the
>> principles are the same.
>>
>> Joanna
>>
>> --
>> Joanna Carter [TeamB]
>> Consultant Software Engineer
>>
>>

>
>
> Thank you for the great response Joanna!
>
> I'm glad you mention Data access, I was just designing that (on paper) and
> will be using MS Access at first, then if all goes well moving to
> SqlServer,
> so I figured that a data access class for each provider inheriting a
> common
> interface would make the transition smoother in the future. I was also
> considering the same approach for the UI, currently it's a desktop client,
> but I would like to offer a web client later.
>
> I will check out your links.
>
>



 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      27th Sep 2005

"Scott" <(E-Mail Removed)_YOU.com> wrote in message
news:(E-Mail Removed)...
> I used exclusively sql for a long time, so I always used SqlConnection,
> etc... Then I discovered quite a while back the interfaces IDbConnection,
> etc., which changed my entire outlook on db access. It does take some

extra
> work, sometimes (like when you actually need to instantiate a connection)
> but works so much better and is database "independent" (almost).
>
> Scott
>
> "Steve" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> >
> > "Joanna Carter [TeamB]" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> "Steve" <(E-Mail Removed)> a écrit dans le message de news:
> >> %(E-Mail Removed)...
> >>
> >> | As a rule of thumb, is it good practice to abstract application
> >> | functionality from the form code behind in a c# winforms app? I have

a
> >> | single form application, but I'm not sure where I should be doing my

> > main
> >> | processing, if I should be working with the Form class instance or
> >> creating
> >> | an "engine" class and doing everything there? Are there any general
> >> | guidelines?
> >>
> >> You are heading in a very good direction here :-)
> >>
> >> In theory, you should be able to build and test all your business

classes
> >> without any UI at all; using NUnit to buid your test framework. Then

once
> >> you have proven that your business classes are "bug-free", you can

start
> > to
> >> think about how you want to display the properties of instances of

those
> >> classes.
> >>
> >> Certainly, you should separate you app functionality from you UI; you

> > might
> >> also consider separating your app functionality from your database
> >> connectivity; see some articles on OPFs (Object Persistence Frameworks)
> >> on
> >> my website www.carterconsulting.org.uk they are targetting Delphi but

the
> >> principles are the same.
> >>
> >> Joanna
> >>
> >> --
> >> Joanna Carter [TeamB]
> >> Consultant Software Engineer
> >>
> >>

> >
> >
> > Thank you for the great response Joanna!
> >
> > I'm glad you mention Data access, I was just designing that (on paper)

and
> > will be using MS Access at first, then if all goes well moving to
> > SqlServer,
> > so I figured that a data access class for each provider inheriting a
> > common
> > interface would make the transition smoother in the future. I was also
> > considering the same approach for the UI, currently it's a desktop

client,
> > but I would like to offer a web client later.
> >
> > I will check out your links.
> >
> >

>
>


Hi Scott,

From what I have read, the IDbConnection is an interface and I futher
understood that interfaces don't have implementation. So can you explain a
bit more how you would use this interface?

Thanks,
Steve


 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      27th Sep 2005

"Steve" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> As a rule of thumb, is it good practice to abstract application
> functionality from the form code behind in a c# winforms app? I have a
> single form application, but I'm not sure where I should be doing my main
> processing, if I should be working with the Form class instance or

creating
> an "engine" class and doing everything there? Are there any general
> guidelines?
>
> Hope that makes sense...
>
>


I'm realizing that I have a ton of questions about architecture design, lots
of ideas that I want to bounce around. Do any of you know of an appropriate
news group for such a discussion?


 
Reply With Quote
 
Frank Rizzo
Guest
Posts: n/a
 
      27th Sep 2005
Steve wrote:

>As a rule of thumb, is it good practice to abstract application
>functionality from the form code behind in a c# winforms app? I have a
>single form application, but I'm not sure where I should be doing my main
>processing, if I should be working with the Form class instance or creating
>an "engine" class and doing everything there? Are there any general
>guidelines?
>
>Hope that makes sense...
>
>

Yes it is a good practice. There are several caveats though. The
traditional c++ way has been to set up interfaces for everything. I
tend to use abstract classes/methods and virtual methods which gives you
everything interfaces give you plus ability to write code common to all
implementation just once. In addition, virtual classes allow you to
have fall back code (i.e. if the derived code doesn't implement it, the
app relies on the base implementation).

It is a good practice, no doubt. However, as you've probably found out,
it takes more setup time to do your app correctly. I've been in many
situations where the client needed the app yesterday and nothing else
mattered, so my principles had to stand aside for the purpose of expediency.

Regards

 
Reply With Quote
 
Joanna Carter [TeamB]
Guest
Posts: n/a
 
      27th Sep 2005
"Steve" <(E-Mail Removed)> a écrit dans le message de news:
e$(E-Mail Removed)...

| From what I have read, the IDbConnection is an interface and I futher
| understood that interfaces don't have implementation. So can you explain
a
| bit more how you would use this interface?

PMFJI. we use interfaces a lot; they are essentially a contract that
guarantees that any class that implements that contract will provide the
declared properties and methods.

Declaring an interface allows you to state the services that your
data-access layer or UI will provide, but doesn't state *how* those services
will be provided. Thus you can write an Access OPF behind the interface and
also a SQL Server OPF behind the same interface.

Your application code always talks to the same interface, but you can change
the implementing class simply by deciding which OPF to instantiate.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is formatting guidelines(based on APA guidelines) pk Microsoft Word New Users 2 28th May 2008 01:30 PM
guidelines =?Utf-8?B?a2F0ZXQ=?= Microsoft Powerpoint 2 5th May 2006 03:46 PM
Re: COM, GAC and Guidelines Nicholas Paldino [.NET/C# MVP] Microsoft C# .NET 2 16th Jun 2004 06:47 PM
Need Guidelines to aid in deciding b/w FAT Client and Client-Server Architecture =?Utf-8?B?U2F1cmFiaA==?= Microsoft Dot NET 0 20th Apr 2004 09:56 AM
EWF - Need guidelines for use... Scott Kelly Windows XP Embedded 4 5th Sep 2003 10:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:50 PM.