SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
6.
/16@yegor256 6
complexity is growing
because
data has no semantic
7.
/16@yegor256 7
OOP was supposed to
become a solution
8.
/16@yegor256 8
“Objects expose
behavior and data”
— article about
Procedural Programming
9.
/16@yegor256 9
API DB
book1
book2
book1 = API.fetch();
book2.isbn = book1.isbn;
book2.title = book1.isbn;
DB.save(book2);
10.
/16@yegor256 10
class Book {
public String isbn;
public String title;
}
11.
/16@yegor256 11
class Book {
private String isbn;
private String title;
public String getIsbn();
public String getTitle();
public void setIsbn(String);
public void setTitle(String);
}
12.
/16@yegor256 12
1. Data is still visible
2. Still imperative
3. No semantic
13.
/16@yegor256 13
API
DB
new DBBook(new APIBook());
14.
/16@yegor256 14
class APIBook implements Book {
String title() {
// make HTTP request
// parse JSON and
// return title
}
}
15.
/16@yegor256 15
class DBBook implements Book {
private Book book;
String title() {
String title = this.book.title();
// save title to the DB
return title;
}
}