Solved

Architecture guides?

Posted on 2006-07-18
5
224 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

789 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