Paweł Chudzik 8/15/2017

Inheritance gone wrong

Read Original

This technical article analyzes a common design flaw in object-oriented programming using Java's Stack class as an example. It explains how inheriting from the Vector class exposes inappropriate methods (like random insertion), violating the LIFO principle. The author proposes solutions like composition/delegation and depending on interfaces rather than concrete implementations to enforce proper encapsulation and design.

Inheritance gone wrong

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week