1 / 95

Object? You Keep Using that Word

Presented at Dynabyte (13th April 2016) <br><br>I do not think it means what you think it means. What object means to many programmers is managers, views, controllers, getters and setters, megalithic frameworks, spaghetti inheritance, lots of mocks and large classes. But is this what object-oriented development is really about? <br><br>The original vision of objects was focused more on the problem domain than the solution domain. Objects were supposed to be small, properly encapsulated abstractions composed from other objects. Classes were a mechanism for expressing objects, not the editing black hole of the development process. <br><br>Think you know objects? This talk strips back the layers of habits, frameworks and legacy to cast objects in a new but old light.

Kevlin
Télécharger la présentation

Object? You Keep Using that Word

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object? You keep using that word... @KevlinHenney

  2. / WordFriday

  3. Agglutination is a process in linguistic morphology derivation in which complex words are formed by stringing together morphemes, each with a single grammatical or semantic meaning. Languages that use agglutination widely are called agglutinative languages. http://en.wikipedia.org/wiki/Agglutination

  4. hippopotomonstrosesquipedaliophobia pneumonoultramicroscopicsilicovolcanoconiosis fylkestrafikksikkerhetsutvalgssekretariatslederfunksjonene Rindfleischetikettierungsüberwachungsaufgabenübertragungsgesetz muvaffakiyetsizleştiricileştiriveremeyebileceklerimizdenmişsinizcesine

  5. http://www.bonkersworld.net/object-world/

  6. OBJECT OBJECT- -ORIENTED ORIENTED Door Door VenetianBlind VenetianBlind Television Television Glass Glass Picture Picture Peephole Peephole Sofa Sofa TelevisionRemoteControl TelevisionRemoteControl http://www.bonkersworld.net/object-world/

  7. People will be using the words you choose in their conversation for the next 20 years. You want to be sure you do it right. Unfortunately, many people get all formal [...]. Just calling it what it is isn't enough.

  8. They have to tack on a flowery, computer science-y, impressive sounding, but ultimately meaningless word, like Object, Thing, Component, Part, Manager, Entity, or Item.

  9. http://classnamer.com/

  10. http://methodnamer.com/

  11. public interface BookEntity ... public interface BookEntityFactory ... public interface ISBNValidator ... public interface CatalogueRepository ... public interface CatalogueRepositoryProvider ... public abstract class AbstractBookEntity implements BookEntity public class BookEntityImpl extends AbstractBookEntity ... public class BookEntityFactoryImpl implements BookEntityFactory ... public class ISBNValidatorImpl implements ISBNValidator ... public class CatalogueRepositoryImpl implements CatalogueRepository ... public class CatalogueRepositoryProviderImpl implements CatalogueRepositoryProvider ...

  12. public interface Book ... public final class ISBN ... public interface Catalogue ... public class DescriptionOfCatalogueImplementation implements Catalogue ...

  13. managerialism, noun  belief in or reliance on the use of professional managers in administering or planning an activity  application of managerial techniques of businesses to the running of other organisations, such as the civil service or local authorities  belief in the importance of tightly managed organisations, as opposed to individuals, or groups that do not resemble an organisation Concise Oxford English Dictionary ∙ Dictionary.com ∙ Wikipedia

  14. One way to name classes is to give each a unique name, indicative of its purpose. Unique names give you the opportunity to convey a lot of information without creating names that are long and unwieldy. This is exactly the right thing to do if the names are in common use.

  15. Member Loan BookCopy

  16. IMember Loan IBookCopy Member BookCopy

  17. Loan Member BookCopy

  18. role, noun  an actor's part in a play, film, etc.  a person or thing's function in a particular situation  a function, part or expected behaviour performed in a particular operation or process Concise Oxford English Dictionary ∙ Merriam-Webster's Collegiate Dictionary

  19. Borrower Loan LoanItem Member BookCopy

  20. interface interface

  21. Parser Builder Tree

  22. Parser Builder Tree BuilderImpl

  23. Parser ParserListener Tree Builder

  24. Parser ParserListener Builder Tree

  25. You can communicate how the new class is the same by naming some superclass. It need not be the immediate superclass, if some distant ancestor communicates more clearly. You can communicate how the new class is different by finding a word that accurately highlights the reason the new class isn't just the superclass.

  26. Connection Factory Connection Connection Impl

  27. Connection Pool Connection Pooled Connection

  28. public Connection createConnection(Provider provider) throws ConnectionFailureException ...

  29. public Connection connectTo(Provider ofUpdates) throws ConnectionFailure ...

  30. OOP to me means only messaging, OOP to me means only messaging, local retention and protection and local retention and protection and hiding of state hiding of state- -process, and process, and extreme late extreme late- -binding of all binding of all things. It It can be done in Smalltalk and in can be done in Smalltalk and in LISP. There are possibly other LISP. There are possibly other systems in which this is possible, systems in which this is possible, but I'm not aware of them. but I'm not aware of them. things. Alan Kay Alan Kay

  31. William Cook, "On Understanding Data Abstraction, Revisited" William Cook, "On Understanding Data Abstraction, Revisited"

  32. Ignorance Ignorance Apathy Apathy Selfishness Selfishness

  33. Identity Identity State State Behaviour Behaviour

  34. Stack

  35. Stack {push, pop, depth, top}

  36. Stack[T] { push(T), pop(), depth() : Integer, top() : T }

  37. An interface is a contract to deliver a certain amount of service. Clients of the interface depend on the contract, which is usually documented in the interface specification. Butler W Lampson "Hints for Computer System Design"

  38. Stack[T] { push(T item), pop(), depth() : Integer, top() : T } given: before = depth() postcondition: depth() = before + 1 ∧ top() = item given: before = depth() precondition: before > 0 postcondition: depth() = before – 1 given: result = depth() postcondition: result ≥ 0 precondition: depth() > 0

  39. alphabet(Stack) = {push, pop, depth, top}

  40. trace(Stack) = {⟨⟩, ⟨push⟩, ⟨depth⟩, ⟨push, pop⟩, ⟨push, top⟩, ⟨push, depth⟩, ⟨push, push⟩, ⟨depth, push⟩, ⟨depth, depth⟩, ⟨push, push, pop⟩, ...}

  41. push Empty Non-Empty pop [depth = 1] depth depth top push pop [depth > 1]

  42. public class Stack_spec { public static class A_new_stack { @Test public void has_no_depth()  @Test( ) public void has_no_top()  } public static class An_empty_stack { @Test( ) public void throws_when_popped()  @Test public void acquires_depth_by_retaining_a_pushed_item_as_its_top()  } public static class A_non_empty_stack { @Test public void becomes_deeper_by_retaining_a_pushed_item_as_its_top()  @Test public void on_popping_reveals_tops_in_reverse_order_of_pushing()  } }      

  43. public class Stack_spec { public static class A_new_stack { @Test public void has_no_depth()  @Test( ) public void has_no_top()  } public static class An_empty_stack { @Test( ) public void throws_when_popped()  @Test public void acquires_depth_by_retaining_a_pushed_item_as_its_top()  } public static class A_non_empty_stack { @Test public void becomes_deeper_by_retaining_a_pushed_item_as_its_top()  @Test public void on_popping_reveals_tops_in_reverse_order_of_pushing()  } }      

  44. public class Stack_spec { public static class A_new_stack { @Test public void has_no_depth()  @Test( ) public void has_no_top()  } public static class An_empty_stack { @Test( ) public void throws_when_popped()  @Test public void acquires_depth_by_retaining_a_pushed_item_as_its_top()  } public static class A_non_empty_stack { @Test public void becomes_deeper_by_retaining_a_pushed_item_as_its_top()  @Test public void on_popping_reveals_tops_in_reverse_order_of_pushing()  } }      

More Related