need an Opinion about how to start this project i`m practicing..
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: need an Opinion about how to start this project i`m practicing..

  1. #1
    Join Date
    Sep 2013
    Posts
    16

    need an Opinion about how to start this project i`m practicing..

    ok, so i have this project ' i need to print Salary of Employees ,production employees , quality control employees , sales employees ,and director employes in every Department
    production employees: hour payment ,hours.
    quality control employees: day payment , days.
    Salary of Employees : hour payment ,hours, bonus for this month.
    director of the Department (in each Department there is an director): global payment for 1 month, bonus for Achievements of the Department

    so i sketch this diagram:

    Name:  factory.jpg
Views: 9
Size:  76.5 KB
    am i doing right?
    or i have some mistakes

  2. #2
    Join Date
    Sep 2013
    Posts
    16

    Re: need an Opinion about how to start this project i`m practicing..

    any 1 for reviewing?

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,197

    Re: need an Opinion about how to start this project i`m practicing..

    I'd start by understand what and why an Interface is used. You've got the Director interface used in several classes that aren't implementing the full interface. If you were to write the code for this model, you'll find it doesn't compile.

    As far as the model, you need to define what the interface is going to do and then apply where it is needed. It is unlikely that the Director interface is used everywhere you are using it. Perhaps you need to create other interfaces that do other specific tasks?

    In addition, I would also get rid of the naming inconsistencies within your interfaces and classes. You've got a mix between uppercase and lower case. Read up on .Net naming conventions so you understand when to use each and why. Sure, you can be sloppy and mix whatever you want, but if you want to learn and become a professional, you'll probably want to write professional quality code (and part of writing professional quality code is following a consistent naming convention).

  4. #4
    Join Date
    Jan 2010
    Posts
    1,099

    Re: need an Opinion about how to start this project i`m practicing..

    Well, we normally can't tell if you have mistakes without knowing what the system is supposed to do and how it's supposed to function in more detail - because there's no one specific design that is right; you can approach the problem in different ways. So elaborate a bit on the requirements.

    To figure out the correct class diagram, you have to first understand how your system will be used, and how it will work; what components are supposed to interact, etc. Now, as for the diagram you've posted: I'm kind of guessing that all of those relationships are simply associations, but note that you've used the UML relationship symbol for generalization - so you might want to fix that to get your point across better (if your UML is a bit rusty, you really only need to look up 3 types of relationships: association, composition, and generalization).

    What Arjay said about naming inconsistencies refers to public class/interface members - the C# naming convention is to use PascalCasing for all public members. Anyway, if you want to represent private members, use a third subsection reserved for class fields (you can put properties in the method section, cause they are really methods).

    Once you've have a fleshed out design - start by writing the classes and their public members according to your specification. Interfaces will have to be implemented by something, of course, but you can write code for the other classes against those interfaces even if they aren't implemented yet - you just will not be able to run it. Make sure you figure out the interactions reasonably right (and that mostly means what public members allow the classes to interact with each other ), because this will be harder to change later on if needed, while the implementations behind them can change relatively easily.

    (BTW: Public members of a class are known as the class' interface, but this is not the same concept as C# interface types that appear in your diagram, although they are related, so I was purposely avoiding to use the designation to avoid confusion. But in short, what I said above is that you need to figure out how classes interact, and they always rely on their interfaces (public members) to interact.)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center