Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

Share

What's Wrong With Object-Oriented Programming?

Download to read offline

RigaDevDays 2017; 15 May 2017; Riga, Latvia; video is here: https://www.youtube.com/watch?v=K_QEOtYVQ7A

Related Books

Free with a 30 day trial from Scribd

See all

What's Wrong With Object-Oriented Programming?

  1. 1. /42@yegor256 1 Yegor Bugayenko What’s Wrong With
 Object-Oriented Programming
  2. 2. /42@yegor256 2 takes.org eolang.org “Elegant Objects”
  3. 3. /42@yegor256 3 “Java is the most distressing thing to happen to computing since MS-DOS.” —Alan Kay, 1997
  4. 4. /42@yegor256 4 “Object-oriented programming offers a sustainable way to write spaghetti code.” —Paul Graham, 2003
  5. 5. /42@yegor256 5 “OO seems to bring at least as many problems to the table as it solves.” —Jeff Atwood, 2007
  6. 6. /42@yegor256 6 Google Trends, May 2017 “OOP (blue) vs FP (red)” https://goo.gl/Ezmma8
  7. 7. /42@yegor256 7 “Objects are not data structures.” —Robert Martin, 2014 https://goo.gl/qmRFH4
  8. 8. /42@yegor256 8 —page 98 “A class is a collection of data fields that hold values and methods that operate on those values”
  9. 9. /42@yegor256 9 —page 40 “An object is some memory that holds a value of some type.”
  10. 10. /42@yegor256 10 “An object consists of some private memory and a set of operations.” —page 6
  11. 11. /42@yegor256 11 Theory Practicevs.
  12. 12. /42@yegor256 12 Getters & Setters 1
  13. 13. /42@yegor256 13 public class Book { private String title; public void setTitle(String t) { this.title = t; } public String getTitle() { return this.title; } }
  14. 14. /42@yegor256 14 Static Methods 2
  15. 15. /42@yegor256 15 public class BookUtils { public static void print(Book b) { System.out.println( “The title is: ” + b.getTitle() ); } }
  16. 16. /42@yegor256 16 NULL 3
  17. 17. /42@yegor256 17 Book b = library.find(“UML Distilled”); if (b == null) { // The book not found } else { System.out.println( “This is the book: ” + b ); }
  18. 18. /42@yegor256 18 Reflection 4
  19. 19. /42@yegor256 19 Book b = library.find(“UML Distilled”); if (b instanceof Ebook) { String pdf = Ebook.class.cast(b).getPDF(); }
  20. 20. /42@yegor256 20 Inheritance 5
  21. 21. /42@yegor256 21 pubic class Manuscript { protected String title; public String html() { return “<h1>” + this.title + “</h1>”; } } pubic class Book extends Manuscript { protected String title; public void rename(String t) { this.title = t; } }
  22. 22. /42@yegor256 22 Annotations 6
  23. 23. /42@yegor256 23 Book b = new Book(); String xml = m.marshall(b); @XmlRoot class Book { @XmlElement private String title; }
  24. 24. /42@yegor256 24 “I invented the term object- oriented, and I can tell you I did not have C++ in mind.” —Alan Kay, 1997
  25. 25. /42@yegor256 25 The article on the blog:
  • OvidiuConstantinescu3

    Mar. 17, 2019
  • 3d1l50n

    Aug. 4, 2017

RigaDevDays 2017; 15 May 2017; Riga, Latvia; video is here: https://www.youtube.com/watch?v=K_QEOtYVQ7A

Views

Total views

2,036

On Slideshare

0

From embeds

0

Number of embeds

4

Actions

Downloads

16

Shares

0

Comments

0

Likes

2

×