I don't know how to structure my program...
So we have to write a program about shipping companies containing fleets and fleets containing different kind of ships. I already made a IshipRepository in the domainlayer and a ShipRepository in the databaselayer. But now is my question we also have to keep a list of shipping companies and fleet. Do I make a repository for each of them or not? If I use one repository for all of them how ould it look like? We are not using databases yet but storing the objects in lists
8 Replies
__
This is the assignment
We enter the world of shipping.The management of ships is done by shipping companies, where each shipping company has several fleets, and each fleet consists of a number of ships. There are different types of ships, we distinguish:-Containership: length, width, tonnage, name, number of containers, cargo value-RoRo ship: length, width, tonnage, name, number of autos, number of trucks, cargo value-Cruise ship: length, width, tonnage, name, number of passengers, route-Ferry: length, width, tonnage, name, number of passengers, route-Olite tanker: length, width, tonnage, name, cargo value, volume (liters), cargo (oil, benzene,diesel or naphtha)-Gast tanker: length, width, tonnage, name, cargo value, volume (liters), cargo (LPG, LNG or ammonia)-Tugboat: length, width, tonnage, nameExtra info:-Cargo value: is the value of the cargo expressed in euros. -Tonnage: is the volume of the ship-Traject: for a ferry this is a fixed route between 2 ports, for a cruise ship this is a variable list of ports called at. In the route of a cruise ship, the sequence of ports is important. Ports can easily be represented by their names.A fleet has a name (e.g. North Sea fleet) and has a number of ships. It should be possible both to add ships to a fleet and to remove ships. One ship is allowed of course but
It should be possible to add or remove a fleet.The same fleet of course only appears once. A fleet must also be quickly searchable by name. A shipping company is active in several ports, so it must be possible to add ports to a shipping company (and also to remove ports). It must also be possible to give an overview of the ports belonging to a shipping company in alphabetical order.Ports are simply represented by a name only (e.g. Antwerp, Rotterdam, ...) It must also be possible to place a ship in another fleet (e.g. place ship "De Plank "in fleet "Stille oceaan"). Furthermore it should be possible to give an overview of :-The total cargo value of the ships belonging to a shipping company.-The total number of passengers.-The tonnage per fleet to be listed (from large to small).-The total amount of volume the tankers can carry.-The available tugs.A shipping company should also be able to display info about a particular ship (based on the name of the ship).
when you are planning to use databases later, there will be a repository for every top level business object you store. so having a repository for shipping companies and fleets (if they are different from the companies) makes sense
after a little back and forth with chatgpt:
- ShippingCompanySolution
- ShippingCompany
- ShippingCompany.cs
- Ports
- Port.cs
- Fleets
- Fleet.cs
- Ships
- Ship.cs
- ShipTypes
- Containership.cs
- RoRoShip.cs
- CruiseShip.cs
- Ferry.cs
- OliteTanker.cs
- GastTanker.cs
- Tugboat.cs
- Statistics
- Statistics.cs
- Utils
- Search.cs
- Data
- Interfaces
- IShippingCompanyRepository.cs
- IFleetRepository.cs
- IShipRepository.cs
- IPortRepository.cs
- Repositories
- ShippingCompanyRepository.cs
- FleetRepository.cs
- ShipRepository.cs
- PortRepository.cs
- Models
- ShippingCompanyModel.cs
- FleetModel.cs
- ShipModel.cs
- ContainershipModel.cs
- RoRoShipModel.cs
- CruiseShipModel.cs
- FerryModel.cs
- OliteTankerModel.cs
- GastTankerModel.cs
- TugboatModel.cs
- PortModel.cs
- ShippingCompany.Tests
- ShippingCompany.Tests.cs
- Ports
- Port.Tests.cs
- Fleets
- Fleet.Tests.cs
- Ships
- Ship.Tests.cs
- ShipTypes
- Containership.Tests.cs
- RoRoShip.Tests.cs
- CruiseShip.Tests.cs
- Ferry.Tests.cs
- OliteTanker.Tests.cs
- GastTanker.Tests.cs
- Tugboat.Tests.cs
- Statistics
- Statistics.Tests.cs
- Utils
- Search.Tests.cs
- Data
- Repositories
- ShippingCompanyRepository.Tests.cs
- FleetRepository.Tests.cs
- ShipRepository.Tests.cs
- PortRepository.Tests.cs
i didnt look to deeply into your actual assignment thoug. just pasted it into chatgpt and added some experience comments, like having tests in a separate assembly and adding the data access layer.
i cant determine if these files make actual sense without starting to solve your assignment for you 😄
No it's great thank you 😄
You asked cgpt to give you a good structure
?
of the program, I should've done this instead of asking for code xp
yes.
chatgqp requires a littlebit experience, so you can actually tell it what you want and also interpret and detect shitty answers
Do I make a repository for each of them or not?do they require you to make repositories? because if they don't then you can think of the features of the program first
We are suposed to use the repository pattern
do you have to use clean/onion arch? that's what it sounds like from your talk of domain and database layers
I personally advocate for $vsa
https://www.youtube.com/watch?v=T-EwN9UqRwE
https://codeopinion.com/restructuring-to-a-vertical-slice-architecture/
dotnet
YouTube
Vertical Slice Architecture: How Does it Compare to Clean Architect...
Is Vertical Slice Architecture the next big thing or just as cool new kid?
Enterprise software development requires you to choose the right architecture. This session with Luke Parker will provide a realistic dive into Vertical Slice Architecture (VSA) with .NET; showcasing the potential shift from Clean Architecture (CA) to VSA.
You will lear...
Derek Comartin
CodeOpinion
Restructuring to a Vertical Slice Architecture
What is Vertical Slice Architecture? It's about focusing and organizing code by features and capabilities, not technical concerns!