1

I have spent sometime searching for an answer, but nothing helpful yet.

I am learning object oriented development and am working on a project to help understand the concepts.

I have an excel file that contains EmployeeID, EmployeeFirstName, EmployeeMiddleName, EmployeeLastName.

I need to call a stored procedure in the database, pass the EmployeeID parameter, and with the returned values, write to a csv file.

The output csv file will have the following columns: EmployeeID, EmployeeAddress, ClientID, ProjectID

How do I write the code in OOP format? (as in sample syntax for the employee class object)

Update:
How can I go about creating an Employee Object and create corresponding properties (such as EmployeeID, EmployeeFirstname, EmployeeMiddleName etc)

5
  • You are asking multiple questions here: 1) What would an employee class look like. 2) What's the best way to store this data? 3) How do I retrieve this data and store it in my object? 4) How do I then output this to CSV? All of these have many solutions - you might be better off having a go and then getting someone to look at your efforts. There isn't really a wrong answer (well, there is but it's more about skinned cats ;-) Commented Feb 7, 2012 at 22:41
  • @dash just looking for "what the employee class would look like". Commented Feb 7, 2012 at 22:43
  • @BobKaufman one specific challange is .. what would the employee class look like? Commented Feb 7, 2012 at 22:44
  • 1
    See something like: en.wikibooks.org/wiki/C_Sharp_Programming/Classes for a good starting point. You can add the properties you need (and remove the ones that are there) to suit. The most important thing is that this class should represent your employee in interactions with other parts of the system, and is also a good place to put employee specific functionality (see SRP - en.wikipedia.org/wiki/Single_responsibility_principle). Commented Feb 7, 2012 at 22:45
  • 1
    no problems - you have to start somewhere. Give it a go, and then, if you have more questions or are just wondering about something, come back to SO and ask! Commented Feb 7, 2012 at 22:53

1 Answer 1

1

This is a complicated question. My personal opinion is that code examples will do you no good. What you need to be worrying about is the different patterns you might use to tackle the problem in a general way... Writing actual code is almost trivial.

You need to design your code such that it would require minimal effort to adapt to a situation where your original data store no longer is an excel sheet or your output store no longer is CSV but XML etc etc...

Try to use abstract methods, interfaces, ...

A good place to start would be here.

A broad answer to a broad question.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.