Advantages and disadvantages of Polymorphism by tariqerp

VIEWS: 13,821 PAGES: 1

Advantages and disadvantages of Polymorphism.doc

More Info
									Advantages of Polymorphism:

    1) The biggest advantage of polymorphism is creation of reusable code by programmers, Classes once
         written , tested and implemented can be easily reused without caring about what’s written in the cases.
    2)   Polymorphic variables help with memory use, in that a single variable can be used to store multiple data
         types (integers, strings, etc), rather than declaring a different variable for each data format to be used.

Disadvantages of Polymorphism:

. It's esoteric. Not very easy for the beginner to just pick up and go with
it. Rather it takes often years of dedication before abstraction becomes
second nature.

2. Huge up-front hit in migrating legacy code as it often has to re-designed
from scratch. Of course in the long run, in terms of re-use, performance and
robustness, this eventually becomes an advantage.

3. Whenever you use "high-level" languages, some degree of low-level control
is forfieted. Ususally in frameworks which are designed to interop with
legacy APIs this isn't a problem but think of the performance hit you get
when you compare C# with pure C. Of course, most would willingly sacrifice a
10% performance hit, versus a 200% increase in productivity any day.

To top