Solved

OM perspective: Integrated main function or in a separate Driver class?

Posted on 2006-06-12
1
309 Views
Last Modified: 2010-04-16
What is better from an OM perspective: having a separate Driver class with just a Main function which will instantiate the Worker class (say Archiver), or integrating this Main function into the Worker class (say Archive())? As for the second option, if the Archive main function is static, how does it instantiate the class it's part of?

Thanks
0
Comment
Question by:gromul
1 Comment
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 500 total points
ID: 16890804
I would think the first approach is best as it seperates concerns, keeping the main function in a seperate class would be a more neater and maintainable solution. However, if you do go for your second idea, then its just a simple case of creating an object of the current class...

public class Archive
{
    public static void Main(string[] args)
    {
        Archive a = new Archive(...);
        a.SomeMethod();
   }

    public Archive(...)
    {
    }

    public void SomeMethod()
    {
        ...
    }
}
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 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