I work on the application as a hobby. It is written in Java and is part of a system for calculating decompression schemes for scuba diving. The problem is that I have a class that stores my dive plan, but this is not a problem because it works fine, but I had the feeling that it could be designed better, so I would like to ask for some feedback.
Now I have the following.
A DivePlan class that has an ArrayList DiveOpperations ( ArrayList<DiveOpperation> ). The DivePlan class has 3 functions. One was planning a descent, one was planning an ascent, and one was planning a flat dive at the same depth. All of these functions add a DiveOpperation object to an ArrayList. However, ascents and descents have some other attributes as dives, which remain at the same depth. For example, the speed in m / s of ascent / descent. I set the speed to 0 for flat dives, but it is not. I know that I have to create separate classes that extend DiveOpperation , but I don’t know if it is an ascent , descent or flatdive when I get it from an array.
What will be a good design for such functions?
source share