开发者

Class Naming Decisions in VB.Net

I'm going to start using inheritance for the first time and I have a question about how to name one of my Classes.

I have an Employee Class which 2 applications will be using and one of the applications requires a slightly altered set of data.

My plan is to create a basic Employee Class for one app and another Class that inherits from this for the other app.

Should I name them both Employee and then access through different nam开发者_运维百科espaces?

App1.Employee.GetEmployees
App2.Employee.GetEmployees

The take away from this thread and my gut tells me that they should be named differently.

App1Employee.GetEmployees
App2Employee.GetEmployees

The only reason I'm questioning if this is right is because the Property definitions will be the same. The only difference will be that the GetEmployees functions will return slightly different sets of data.

As I'm typing this I'm starting to wonder if I should use a single Class and have an overloaded function called GetEmployees.


You should put that into a class library and use this dll from both apps.

But i don't see the need of inheritance here if the definition is the same for both apps(same properties) and only the factory-function that returns instances of Employee returns different Employees on each app. You could add a parameter to this function(maybe some kind of Enum or filter) that returns the correct.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜