There is a mechanic droid, which performance the maintenance and repairing of vehicles. It services each vehicle, and then track them manually by giving information about the vehicle to the head maintenance engineer, who then notes it down by hand. My task is to create a program which help mechanic droid to track each vehicle that has been serviced and store the information until it can be uploaded to a central repository. I need to use in memory persistence to store the information.
Punit Jain wrote:I have a task which I need to implement with SOLID Design principals.
Damon McNeill wrote:Just to preemptively avoid counter attacks, I mean that computer RAM is not persistent. ROM is a kind of "memory", but different in that is is immutable.
Punit Jain wrote:
Following is how I am thinking to design it:
1.) VehicleService interface [which will have the definition of create, update and delete methods]
2.) Vehicle class this would be a basic pojo class which will have vehicle information (i.e. model, year, class etc.)
Damon McNeill wrote:You might also need a Droid class, with some method with a signature like: VehicleService service(Vehicle v)
Maybe the Droid needs a reference to the List<VehicleService>, in order to append it to the list?
There's really not enough context given to suggest more...
Punit Jain wrote:
2.) Am I violating the SOLID principals anywhere?
then again, I'm a Taurus so that makes me a little bit more cautious and circumspect than most people when it comes to these kind of things.
Damon McNeill wrote:
I'm an Aries, so I tend to jump into things quickly... lol
I think we may have an issue about language. Many people here didn't learn English at their mother's knees, and many people don't realise that jargon is supposed to be very precise. I think the original intent was to persist the state of the object somewhere, but using the phrase memory persistence isn't quite 100% accurate. There are several ways I can think of to persist an object:-Damon McNeill wrote:. . . computer RAM is not persistent. ROM is a kind of "memory", . . .
A set of unit tests that set up scenarios like what happens when an android is working in offline mode and he services 20 vehicles. What would we expect to find in the android's memory?
Punit Jain wrote:How about this :
I have refactored most of my code. Following is refactored, MemoryPersistent Class :
Junilu Lacar wrote:
The changes you made on line 13 and 19 pretty much made the tests inconsistent and frankly, nonsensical. Neither of those display names match what the body of the tests are doing and you've made what was explicit more implicit. You've basically taken the dots and the lines that connected them and erased the lines and some of the dots.
Junilu Lacar wrote:
Starting with something like a VehicleService makes no sense to me in the context of the problem you were given. The problem revolves around a Mechanic Droid. Yes, the droid does vehicle servicing but neither the vehicles nor the servicing done on them is the main character, the droid is.. It's like you were given the general outline of the Star Wars saga and you started detailing out what an X-Wing fighter is and what its navigation and control parameters are. Luke, Leah, Han, Darth, Obi Wan, those are all the main characters; that's where you should focus first to fill out the script. Likewise, the droid is the main character of this story so start with the droid: what are its behaviors and responsibilities and what will it need to collaborate with to exhibit its behaviors and carry out its responsibilities.
Junilu Lacar wrote:Given everything I have told you so far, I'd like to challenge you to find the smells in this test that you wrote:
Identify the lines of code (yes, there are multiple) that smell and explain why they smell.
Punit Jain wrote:
1.) At line 47, the display name says about outstanding order but the method name is order received.
2.) At line 57, instead of using greater than I could have check for the exact number.
3.) Again the method name and display names are inconsistent at line 54 and 55.
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|