ghazalghorabi / TDA553-lab1

0 stars 0 forks source link

OCP #18

Open martinjonsson01 opened 1 year ago

martinjonsson01 commented 1 year ago

Ni skriver : "For example in Saab we had one specific characteristic: Turbo which Volvo did not have and therefore we chose to have Turbo in the Saab file. This is an example of where we used the Open-Closed-Principle. We extend the Car into Saab and Volvo (with its own unique characteristics). But we can't change them into something else like a boat, they will still remain cars. So we can broaden the function of each car, but not change it altogether."

vilket nästan är vad OCP säger, förutom den fetstilta biten. "closed for modification" innebär inte att man inte kan ändra funktionaliteten av bilen, det innebär att man inte behöver ändra Car för att kunna lägga till nya funktioner. Så rättare sagt följer ni OCP här eftersom ni kan utöka bilen med en turbo (open for extension) utan att behöva pilla runt inuti Car-klassen (så den är closed for modification).

Notera att detta inte är en critical issue, jag ville bara förtydliga lite för er!

https://github.com/ghazalghorabi/TDA553-lab1/blob/9a7bb11cad1ca4ae09a075ccccd54899b74953ad/src/reflection.txt#L2