It's UWAweek 17 (1st semester, week 8)

help2005

This forum is provided to promote discussion amongst students enrolled in CITS2005 Object Oriented Programming.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 89 articles.
Currently no other people reading this forum.


 UWA week 16 (1st semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
1:09pm Fri 19th Apr, Andrew G.

ANONYMOUS wrote:
> When we use inheritance (extends), we create a dependency on the parent class, correct? Does using an interface instead of an abstract base class make our code more flexible?
Dependency can have various meanings, and I am not sure how you are using it here. The same goes for the concept of flexibility. As a sweeping generalization, I would say that interfaces are "more flexible" than inheritance. Interfaces have no implementation details to inherit, and so it is impossible to depend on those implementation details and end up coupled with them. However, inheriting implementation from another class is sometimes explicitly desired to enable code reuse. It is better to have a single (private) implementation that every class that needs it reuses than to have every class reinvent the wheel. One reused implementation is more flexible to change than many reimplementations of the same. If you want to read ahead, we will be covering interfaces and these sorts of OOP design concepts in future lectures. You may particularly want to look into the SOLID design principles, which are a set of conventions to help write better structured and more maintainable OOP code.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy