Solved

Architecture guides?

Posted on 2006-07-18
5
221 Views
Last Modified: 2010-04-16
Hi

I'm a relative newbie to C# programming and the whole Visual Basic approach.

I wrote an application to monitor if websites are up or down and I can click on a date and get a pie chart of the up and downtime for any given day.

Now my problem is that all my code is within one Form - 'Form1'

Anyone know any tutorials (or just general adivce) on home to split it up?

In general should one screen in an application have one .cs page?
I have a tab control in my form. Should I spilt each tab into a page?
And I also have a file called NetworkTools.cs which has functions like

/// <summary>
        /// Returns an arraylist on the PCs on the network
        /// </summary>
        /// <returns></returns>
public static ArrayList getComputers()
       
/// <summary>
        /// checks if an email is in the correct format
        /// </summary>
        /// <param name="inputEmail"></param>
        /// <returns></returns>
        public static bool isValidEmail(string inputEmail)

Is this good practise?

Thanks!
H

0
Comment
Question by:hmcgeehan
5 Comments
 
LVL 1

Accepted Solution

by:
Prambo earned 50 total points
ID: 17129222
There is an article in MSDN Magazine about best practices for UI programming, introducing a "new" pattern called MVP:
http://msdn.microsoft.com/msdnmag/issues/06/08/DesignPatterns/default.aspx

Yes, you should have one .cs page for each screen. Whether you split the tab into a page or not is a matter of taste but it sounds like a good idea to me.
The class NetworkTools.cs seems to just contain static utility functions and that is ok also, depending on if there is no other place where they would fit better, like e.g. an email class for isValidEmail.
0
 
LVL 8

Expert Comment

by:navalarya1982
ID: 17142764
hi,

You need not worry much abt design issues in this early.. stages.. :) just design things and they should work...

now regardsing ur design query

as a general rule.. we should not have non ui related code in form1 file. so u need to move it to new file and implement that logic in some class file.

this approach is good in sense that tomorrow u can change ur presentation layer more easily.. today u have windows from if u want to go for cosole or web then u can do it more easily...

So always better idea to seperate presentation layer and business logic layer.

regards,
Naval
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now