object oriented programming in 2014:standard or legacy?
TRANSCRIPT
Object Oriented Programming in 2014: Standard or Legacy?
Mathieu François@Universitas Bina Nusantara
07/11/2014
Did Object Oriented Dominate Programming?
Introduction1. The Great Hopes About OOP*2. There is no Silver Bullet3. Case: Epigami OO Infrastructure
* Object Oriented Programming
• Encapsulation• Polymorphism• Inheritance
• Class of objects (constructor)• Instance of class• Method vs data• Message passing• Abstraction
OOP Definition
Why the OOP Cult?
OOP perceived as the solution for all software development challenges:
• Code reuse and recycling• Encapsulation of knowledge• Isolation of bug impacts• Design benefits, especially for very large
programs• Maintenance
Pure languages: Ruby, Python, Smalltalk, Scala, Eiffel
Languages mainly OOP but also have procedural elements: C++, Java, C#, VB.NET
Languages historically procedural but extended with OO features: Pascal, VB, Fortran, Perl, Cobol 2002, PHP
OOP In Almost Every Languages
OOP For Web App?
Yes: Languages, DOM, JSON
No: Service Oriented Architecture, Event-Driven Design
More about SOA in a few slides...
There Is No Silver Bullet
By Fred Brooks (1986), also author of TheMythical Man month (1975)
Essential Complexity vs Accidental Complexity
Since ‘modern’ languages (Fortran, COBOL), no real improvement about accidental complexity
org 7C00h jmp short Start ;Jump over the data (the 'short' keyword makes the jmp instruction smaller) Msg: db "Hello World! " EndMsg: Start: mov bx, 000Fh ;Page 0, colour attribute 15 (white) for the int 10 calls below mov cx, 1 ;We will want to write 1 character xor dx, dx ;Start at top left corner mov ds, dx ;Ensure ds = 0 (to let us load the message) cld ;Ensure direction flag is cleared (for LODSB) Print: mov si, Msg ;Loads the address of the first byte of the message, 7C02h in this case ;PC BIOS Interrupt 10 Subfunction 2 - Set cursor position ;AH = 2 Char: mov ah, 2 ;BH = page, DH = row, DL = column int 10h lodsb ;Load a byte of the message into AL. ;Remember that DS is 0 and SI holds the ;offset of one of the bytes of the message. ;PC BIOS Interrupt 10 Subfunction 9 - Write character and colour ;AH = 9 mov ah, 9 ;BH = page, AL = character, BL = attribute, CX = character count int 10h inc dl ;Advance cursor cmp dl, 80 ;Wrap around edge of screen if necessary jne Skip xor dl, dl inc dh cmp dh, 25 ;Wrap around bottom of screen if necessary jne Skip xor dh, dh Skip: cmp si, EndMsg ;If we're not at end of message, jne Char ;continue loading characters jmp Print ;otherwise restart from the beginning of the message times 0200h - 2 - ($ - $$) db 0 ;Zerofill up to 510 bytes dw 0AA55h ;Boot Sector signature ;OPTIONAL: ;To zerofill up to the size of a standard 1.44MB, 3.5" floppy disk ;times 1474560 - ($ - $$) db 0
OOD Is Not the Only Design Approach
Other Approaches or ‘Schools Of Thought’:• Functional• Event-driven• Data-driven• ‘Unix Philosophy’
Object-Relational Impedance
We use Object Relation Mapping (ORM) because Object DBs didn’t really take off
“organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations”
Bad collaboration or project management have not solved by OOP
Conway’s Law Still Applies to OOP
Infrastructure Since 15 years
• Hardware Technologies +++
• Virtualization Technologies +++
• System Configuration Management +
‘Infrastructure As A Code’: Really?
First deployment automation in the 90s (Jumpstart SUN & Co)
Puppet & Chef are just improved automation, not a new real paradigm
Light virtualization based on containers
From Infrastructure to Application-centric
The New Kid On The Block: Docker
OOD Applied to Docker
Docker
Image BuildRunning Container
‘Jailed’ ProcessFROM <image>
Init ScriptEXPOSE <service>
Container LinkLink Alias
Object-Oriented
ClassInstance of ClassEncapsulationInheritanceConstructorMethodMessage PassingAbstraction
Benefits
• Isolation• Security• Modularity• Traceability• Automation (Continuous Deployment)• Flexibility• Performance• Scalability• Price