Data Implementation in C#

Hello All.

As someone who has spent years doing procedural programming (C, asm), instead of OOP, I am struggling with how to design/implement my data. C# seems (at least to me) to want to tie the data to a form. I "think" I need something a little more global in scope.

I'm trying to modify an e-mail program written in C# I downloaded. Part of the problem is that I think it was written under an older version of Visual Studio (I am using Studio 2005 for 2.0 frameworks). This program, even when "converted" by VS2005 does not have a program.cs file, but instead main() is inside the form definition file. This program does EVERYTHING inside the same form. It displays the pop3 server name and allows you to enter the user name and password. There are connect/disconnect buttons, a retrieve button, and a large text box where messages can be listed. While the example is good about showing POP3 access, it is a poorly designed user program.

For example, I want to put the setup info (pop3 server name, password, etc) into a second form (reachable via an 'options' button or something). However, this information would need to be accessible within the main form as it accesses the server and pulls down the e-mails.

Sorry to be so long winded, but now for my question. How should I implement this from a data implementation perspective? Do I have a separate code file where I create a class with the setup info, then access that info from the options form, or the mail-retrieval-form? Is this a case for using a singleton for that information?

Anyone have any suggestions for good programming books? I have the Microsoft "Training Kit for MCTS 70-526 Windows Development", and the "Visual C# 2005: The Language". Both of those include good learning examples of features, but no large scope of application development, particularly of data implementation.

And that's the part I'm struggling with. ANY advice suggestions are greatly appreciated.

- ron
[2038 byte] By [ronmoles] at [2007-11-20 11:27:19]
# 1 Re: Data Implementation in C#
Hello All.

As someone who has spent years doing procedural programming (C, asm), instead of OOP, I am struggling with how to design/implement my data. C# seems (at least to me) to want to tie the data to a form. I "think" I need something a little more global in scope.
Yes you need a bit more global sght of that. C# IMHO is a typical
OOP labguage. Its doesn't tie data to a form, no - to understand C# you need to understand OOP e are working with objects which are the base of all data. As quicker you nderstand the idea behind OOP as more you will get the idea of good design or implementation of programs using C#

Classes are just like different wheels in a gear, well designed they work together in a smooth way and carry all whats needed to be done from your program. Every object will have its exactly defined purpose. If you dont have it that way, you will end up in a caotic mesh of data which conflicts or are unlogically mixed together.

Good class design goes hand in hand with good database design if your classes for example works in connection to a database.

The Layer where to show your data is the form then, but this is only the last layer of them. Sure you may also design Controls, which are used to present your data. If they are well designed they are presentation objects which do their work more or less independent of which data you want to present. ( Basically for written presentation of data you transform them into strings, but you may also construct controls which give a graphical output of what your data should represent.
... but instead main() is inside the form definition file.
Sounds me to be VS 2003 style or older. When i have had this IDE the first time I looked at it and gave it away as it doesn't fullfill my ideas of how a good IDE should work. This was, why I didn't change from VB 6.0 to any dot net before VS 2005 ;)


This program does EVERYTHING inside the same form. It displays the pop3 server name and allows you to enter the user name and password. There are connect/disconnect buttons, a retrieve button, and a large text box where messages can be listed. While the example is good about showing POP3 access, it is a poorly designed user program.

... then access that info from the options form, or the mail-retrieval-form?You can do it in that way if you get an easy to handle program this way.

For the books: I have read "Windows Forms Programming in C# Part 1 and 2 by Chris Sells" which are both very good for having a read thread of one project through the whole book, showing lots of different technics of OOP.

If you need basic knowledge about OOP, years ago I had read a 'Dummies' book about OOP ( OOP for Dummies ) I dont know the English name of this series of programming books. They are in a funny style. Dummie is German and means something like 'idiot' They are paperpacks yellow covered and every book title ends with 'for dummies'.
C for Dummies, OOP for Dummies, VB for Dummies... But I dont know if they are available in english too
JonnyPoet at 2007-11-9 11:36:39 >