Skip to content

Taking it further #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Taking it further #2

wants to merge 10 commits into from

Conversation

indykid
Copy link
Owner

@indykid indykid commented Dec 22, 2015

moves polymorphism from Movie to PriceCode

jarkyn added 10 commits December 20, 2015 14:19
introduces subclasses of Movie
it is possible for a movie to change its type during its lifetime, from
'new release' to 'regular', for example
subclassing based on movie type doesn't allow for such change as we
cannot change the class of an object to represent type change
hence the implementation of PriceCode and its subclasses
makes use of existing polymorphism to minimise control flow
this data is not used anywhere
it was useful for control flow before polymorphism was applied
@indykid
Copy link
Owner Author

indykid commented Jan 4, 2016

This builds up on the re-write version of the solution and improves polymorphism implementation to reflect the fact that in real store a movie can change its type during its lifetime (from new release to regular for example), therefore representing such type with subclass would limit this ability.
On this premise representing polymorphism by subtyping PriceCode rather than Movie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant