1 Parametric Polymorphism Polymorphism Techniques C++ Templates.
Polymorphism ruby
-
Upload
glenn-espinosa -
Category
Software
-
view
183 -
download
0
Transcript of Polymorphism ruby
Replacing Conditionals With
Polymorphism@gpespn
“Any fool can write code that a computer can understand.
Good programmers write code that humans can understand.”
-- Martin Fowler
@gpespn
@gpespn
But why? • Easier to read • Maintainability • Extensibility • Isolation of change • Easier to test
@gpespn
B+
@gpespn
C-
@gpespn
New Feature! Guest sessions
@gpespn
@gpespn
F-
@gpespn
I just want to send a message
to an object
@gpespn
-Woof!
-Meow!
@gpespn
Polymorphism
tell don't ask
@gpespn
@gpespn
@gpespn
@gpespn
still have conditional!
@gpespn
Create a high level abstract
class
@gpespn
@gpespn
Abstract Subclass Subclass
@gpespn
Polymorphism
@gpespn
@gpespn
Whats the catch? • Parallel interfaces • Design patterns that are confusing to those unfamiliar to them
• New words/vocabulary into application. LOC went up! • Increased big picture complexity in exchange for macro clarity
• Too many Objects
@gpespn
@gpespn
Questions?