Answer the question
In order to leave comments, you need to log in
Proper software development!?
Hello!
For personal experience, I develop a certain program. The programming language is C#. And he first began to build the business logic of the program in a UML diagram. It turned out something like this (this diagram is not correct, that is, an approximate template that is subject to further corrections and additions. Approximately 1/3 of the program):
After these sketches, I had a strange feeling?! Since I have no experience in developing and modeling projects, I asked myself such questions: "Am I doing everything right?", "Am I building a diagram correctly?", "Is it necessary to use class inheritance more or class aggregation?", "Normal Should I create a bunch of instances of other classes in each class?", "
I sketched several codes for this diagram. The creation and initialization of class instances turned out somehow like this. After what I saw, I became completely scared: D (also subject to further corrections):
As you can see, I have a lot of questions that I can’t get answers to. I ask experienced developers to criticize me, answer questions and give advice for the future! :D
Unfortunately, I did not find the spoiler tag.
Answer the question
In order to leave comments, you need to log in
of course not correct. Where does this belief that everything can be done right come from?
you cannot create a new product right away, most of the things you can only understand in the process of implementation how to do better. Therefore, allow yourself to make mistakes, do not be afraid to make mistakes, make mistakes, correct yourself and develop the product.
- Methods?
- No, I haven't heard
. To be more precise:
Company c = new Company();
c.SetInfo("Travel", "Touristic company");
Address address = new Address();
var idCountry = address.AddCountry("Name");
var idCity = address.AddCity(idCountry, "City");
address.AddOffice(idCity, "Main office", "Street", "Email", ... );
Contact contact = new Contact("website", address);
c.AddContact(contact);
Tour tour = new Tour("China", "Hong Hong");
c.AddTour(tour);
...
And here the nesting is also not needed.
Here you have the entity Company (Company) in your company, are there any countries? No, she has offices (Office)
And the offices already have a specific address (Address) and he doesn’t care about all the rest, so nesting is not needed here, it will be needed when filling out, for example, to show the dropbox to the user, for this, make the AddressDataBase what something with nested addresses. And usually if there are a lot of offices, then they indicate contact details
, that is
class Company
{
public List<Office> Offices {get; set;}
public string Description {get; set;} //Тут описание вашей компании: год основания там и все такое.
public Contacts GlobalContacts {get;set;} //Глобальные контакты для всей компании
}
class Office
{
public Address Address {get; set;}
public List<Employee> Employees {get; set;}
public List<Tour> Tours {get;set;}
public Contacts Contacts {get;set;}
}
class Address
{
public string Country {get;set;}
public string City {get;set;}
public string Street {get;set;}
public string HouseNumber {get; set;}
}
class Tour
{
public string Country {get; set;}
public string City {get; set;}
public Hotel Hotel {get; set;}
}
class Hotel
{
public string Description {get;set;}
public Address Address {get; set;}
public List<Image> Images{get; set;}
}
var office = new Office(
new Address(country, city, street, houseNumber),
new List<Employee>(),
new List<Tour>(),
new Contacts { Email = "[email protected]"}
);
"Is it normal to create a bunch of instances of other classes in each class?"
I myself was looking for good lessons on this topic, but did not find any (so that everything would be shown in full on the fingers: D).
Read msdn -> Class Library Development Guide
Правила именования
Описывает правила именования типов и членов в библиотеках классов.
Правила разработки типов
Описывает правила по использованию статических и абстрактных классов, интерфейсов, перечислений и структур.
Правила разработки членов
Описывает правила разработки и использования свойств, методов, конструкторов, полей, событий и операторов. В данном разделе также описываются лучшие методики разработки.
Разработка с обеспечением расширяемости
Описывает правила по проектированию расширяемых библиотек.
Правила разработки исключений
Описывает правила по проектированию, генерации и обработке исключений.
Правила использования
Описывает правила использования массивов и атрибутов, а также правила реализации операторов равенства.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question