What's the point of Object Orientation?

Video thumbnail (Frame 0) Video thumbnail (Frame 5545) Video thumbnail (Frame 6656) Video thumbnail (Frame 8422) Video thumbnail (Frame 10845) Video thumbnail (Frame 13230) Video thumbnail (Frame 14788) Video thumbnail (Frame 19074) Video thumbnail (Frame 22028) Video thumbnail (Frame 25330) Video thumbnail (Frame 26560) Video thumbnail (Frame 38278)
Video in TIB AV-Portal: What's the point of Object Orientation?

Formal Metadata

What's the point of Object Orientation?
Title of Series
Part Number
Number of Parts
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license.
Release Date

Content Metadata

Subject Area
Iwan Vosloo - What's the point of Object Orientation? This talk covers the basics of what Object Orientation (OO) is really about. It focusses on the problem OO is aimed at solving and shows where the OO mechanisms of Python fit into this picture. This material can serve as an introduction to OO for beginners, but also as a homing signal for experienced programmers who are doubting whether they are reaping the benefits OO promises. ----- Object Orientation (OO) is often introduced in terms of how it is implemented by a specific language. However, understanding the theory underlying OO is not quite the same as understanding how OO concepts are supported by a particular language. It is insightful to understand the simple OO fundamentals and how these map to the particular implementation provided by Python. In this talk I will first explain the very basics of OO from a language-neutral point of view with the aim of showing what OO can offer you and to give a glimpse of the simple mathematical theory underlying OO. I hope to give you enough information to help you distinguish between better and worse designs and to detect whether you’re using OO as it was intended. I will also very briefly show how these fundamentals map to Python. This talk is for anyone: whether you’re new at Object Orientation, or a practitioner wondering whether OO is worth the effort you’ve spent trying to use it.
Functional programming Greatest element Link (knot theory) Multiplication sign Insertion loss Encapsulation (object-oriented programming) Dimensional analysis Programmer (hardware) Mechanism design Goodness of fit Natural number Object-oriented programming Software framework Endliche Modelltheorie Physical system Social class Programming language Touchscreen Inheritance (object-oriented programming) Projective plane Bit Word Wave Arithmetic mean Process (computing) Googol Computer animation Self-organization Video game
Programmschleife Computer animation Causality Multiplication sign Computer program Statement (computer science) Sound effect Bit Branch (computer science) Endliche Modelltheorie Computer programming
Code Line (geometry) Virtual machine Code Sound effect Line (geometry) Disk read-and-write head Computer programming Arithmetic mean Maize Computer animation Average Quicksort Physical system
Logical constant Point (geometry) Context awareness State of matter View (database) Set (mathematics) Theory Data model Mathematics Term (mathematics) Set (mathematics) Finitary relation Object-oriented programming Endliche Modelltheorie Data structure Office suite Data compression Theory of relativity Information Mapping Electronic mailing list Bit Line (geometry) Connected space Subset Arithmetic mean Personal digital assistant Network topology Video game Right angle Quicksort Object-oriented programming
Trail State of matter Multiplication sign Real number Orientation (vector space) Execution unit Multiplizität <Mathematik> Disk read-and-write head Computer programming Subset Positional notation Causality Finitary relation Object-oriented programming Diagram Multiplication Theory of relativity Bit Connected space Type theory Word Positional notation Computer animation Network topology Right angle
Point (geometry) Implementation Link (knot theory) Code Execution unit Online help Parameter (computer programming) Mereology Disk read-and-write head Subset Number Mathematics Different (Kate Ryan album) Operator (mathematics) Object-oriented programming Operations research Algorithm Theory of relativity Inheritance (object-oriented programming) Online help Structural load Computer program System call Type theory Arithmetic mean Computer animation Right angle Object-oriented programming
Master-Gleichung Computer file Code Orientation (vector space) Gene cluster Insertion loss Focus (optics) Theory Type theory Computer cluster Term (mathematics) Operator (mathematics) Object-oriented programming Data structure Social class Programming language Zoom lens Mapping Online help File format Block (periodic table) Classical physics Extreme programming Instance (computer science) Supersymmetry Type theory Process (computing) Computer animation Social class Right angle Quicksort HTTP cookie
Axiom of choice Meta element Email Dynamical system Execution unit Source code File format Client (computing) Disk read-and-write head Computer programming Neuroinformatik Medical imaging Mechanism design Radio-frequency identification Different (Kate Ryan album) Object-oriented programming Exception handling Social class Physical system Metropolitan area network Touchscreen Mapping Gamma function Electronic mailing list Amsterdam Ordnance Datum Bit Hecke operator Instance (computer science) Lattice (order) Complete metric space Inflection point Arithmetic mean Process (computing) Uniform resource name Order (biology) Code refactoring Quicksort Permian Wide area network Point (geometry) Slide rule Inheritance (object-oriented programming) Computer file Transformation (genetics) Student's t-test Mass Infinity Product (business) Term (mathematics) Googol Code refactoring Contrast (vision) Traffic reporting Information Interface (computing) Classical physics Multilateration Line (geometry) Group action Limit (category theory) Word Personal digital assistant Mixed reality Universe (mathematics) Statement (computer science) Video game Social class Table (information) Functional programming Run time (program lifecycle phase) Code Multiplication sign Decision theory View (database) Insertion loss Parameter (computer programming) Mereology Encapsulation (object-oriented programming) Thermische Zustandsgleichung Thomas Kuhn Mathematics Cuboid Endliche Modelltheorie Logic gate Library (computing) Programming language Email File format Moment (mathematics) Attribute grammar Statistics Type theory Exterior algebra Googol Right angle Object-oriented programming Row (database) Filter <Stochastik> Dataflow Functional (mathematics) Implementation Link (knot theory) Real number Theory Attribute grammar Power (physics) Hypothesis Revision control Causality Operator (mathematics) Gamma function Boolean algebra Operations research Slide rule Inheritance (object-oriented programming) Planning Subject indexing Pointer (computer programming) Computer animation Fiber bundle Abstraction
it all of them we already if you want to father object-orientation and and was small will present us some ideas about nature of and good morning everyone uh and a big thanks to the organizers would seem to be doing really well again this year I 4 of live a double life in the Python will die and behind the project called real it's an experiment we we're trying to build a wave framework where you can express your whole way that tension using Python and no C is a central ascriptive HTML and all that but all the words like the wasn't losses like I have there on the screen we we can do really cool stuff already like this complicated example is all leave behind 1 class and not talking about that year because I did last year and the link live at the bottom is to talk of last year if you're interested in uh and you should have and help us so rather than sticking to the same topic I thought I should be something from my day job we derive spent a lot of time In the last decade sitting with programmers who working on big systems systems that have grown 14 15 years and they struggle with these things there was once a going struggle to edit button to operate for an entire week so this and my job there is to maintain these people and help them to improve the design of these things and to taste them and stuff like that 1 of the things that I realized is that are very basic things about object orientation that are used in ways that weren't intended to and then they tend to make things very difficult for these people and I always wonder about this and if if you gonna look on google the way object orientation is introduced usually is by means of things like over inheritance and encapsulation and all kinds of stuff that really those genes are the dual very not appoint not what it's all about so the purpose of the presenting today are very very basic but I have never seen it before it's actually comes out of books and things that were written in the nineties and and before that so 1st thing to 1st object orientation it really is it's not about object-oriented programming there's a lot more to it the whole idea is that you want to actually express how you understand the problem dimension and both something that we call on the phone model they will map to a programming language decoding some kind of programming language pitch does not need to be an object oriented programming language in the in fact some functional programming languages can work well too but if you have an object oriented programming languages then you will have some supporting mechanisms in a as Python gives us so and therefore is a little bit more on the beginning of all of this
conceptual model and then have you know this old guy that that was a very cool guy it's all about cause and effect and I actually think that that is how a lot of people understand the program something happens and something else happens which triggers something else to happen it's programs are a little bit more
complicated because we can't branch we've but if statements we've got loops and so on which means that that the trace that you will follow through a program could be different each time so that's a little bit more complicated to understand but you probably think that you do understand a program of this size what if it's
like a hundred lines of code can you still understand all of that and no work any journal usual effects elsewhere you probably can maybe maybe you're really smart but sort of systems on average that
I tend to work with all it's more like 190 thousand lines of code and I can't understand them so what does it take to understand a program like that we we have this thing in our heads that have evolved over millenia called an understanding the helps us do basically determine what we should care about what represents danger what represents opportunity and this is sort of an and a built in feature that we have and if I say what does it mean to understand the program I'm really asking can we use this machine every that we already have just beta manage programs if you don't then you have this maze of your code in wage all of it because you need to know how to navigate from 1 place to the other and there is no meaning so let's talk about
conceptual models because understanding is all about conceptual models if I have to explain something to you all probably explain things in terms of concepts right so conceptual models all really all about concepts and concepts are actually quite cool things in this example here I've got a constant Jeremiah and you can see there that it applies to to of the objects in my witness to Jesus so I can do now is if I know something about trees if I have some information about it for example that they're useful because you can stand on them if you want to change a light bulb right I can say that information only once and I know that it applies to both of them if if I didn't have I'd have to store that information what so it's a compression but what that the really important thing about constants also is that we give them meaning by means of giving them a definition so I can define what chair is in that definition helps me when something new comes into my winners that I've never ever seen before I can use this definition to decide how it but does this new thing actually does 1 of my concepts actually applied to this new thing if it does everything that I've learned about cheese in my entire life all of a sudden become useful in connection with this new thing that's really actually quite amazing from a
mathematical point of view model concepts states so it taken care of the constant chair can be the set of all the and so with basics as well and this provides the foundation for everything object oriented because everything that you know about the theory in mathematics also and help you to reason about a lot of stuff 1 important thing concepts in my on just a list and unstructured list of of concepts that actually have an intricate structure in 1 of the things that give rise to the structure that we also have substates here so of office chair in this example also conforms to the definition of but maybe we can say a little bit more about office cheese so that of a more specialized kind of context right so this is the 1 thing that gives rise to structure the other thing is that I can actually connect objects from 1 state to objects in another state in this case I through some lines data show that 1 assigned to a particular data and another year is assigned to another but this sort of pictures should be familiar to you as well if if you think of mappings and relations and so on in mathematics but is
another way also to look at this if you take all of that stuff away and you just keep the connections there are 2 of them so they can be a state as well so this state of connections is also a constant and this the relation is the concept of assignment in this particular example before I move on just a quick where we like to specify a little bit more about relations and we call that multiplicity so we would like to always say all in this particular example more than 1 kid can be assigned to the same basic but not the other way around right but that becomes a bit complicated to talk about these things and to denote them using been diagrams right so in the nineties before then I think a lot of people came up with a lot of notations for dealing with
stuff and finally standardized your about which you probably know and this exact picture that I have here is the same as saw in the previous 1 and I guess you almost know you're mouth but I'd like you to look at it possibly with different eyes thinking that chair here is the same of which offers trees form a subsidy that I can say something more about which is over there could be assigned to base but we we don't actually program with the hidden causes and stuff like that right so but it also isn't about physical objects that's not what orientation is about it's about concepts and most concepts all actually intangible things because they really just exist in our heads and this is a real world example from the investment industry so they could be a concept called investment in the instrument which is something I can buy in the hope that it will become with more over time right the subset of those things are called unit trusts they work in a particular way and that all slightly different to other investment industry instruments right and I can have something like a portfolio that's the way for me to keep track of all the things that I None of these things really exist in the real world they're all intangible and can only exist in heights and we keep inventing these things as we go on something you need to know is that our needs are very flexible for example 6 can overlap so I can be both a person and an investor at the same time actually it gets worse because how I classified can change over time so I can be a person and eventually also be an employee and it sounds that edge also become an they might be stop being an employee that's how we think about the world it's time for me to change terminology because no 1 really talks about concepts even though all of this stuff is based on concepts and definitions that I've talked about up to now but the word concept is merely a label that I've attached to concepts so that I can talk to you and explain to you the concept of a constant typically in 0 0 yeah of course you can attach more than 1 label to a concert and in the label type is more commonly attached to what I've explained right now because of course also synonyms so from now on I'm going to try and switch terminology but please don't
forget concept things get interesting only when we actually make changes to 2 objects and this is where Operations coming and operation is also a constant it is something its definition basically saying all what it sees that you want to happen to a number of objects so operates on a number of objects in this particular example load prices is something that can create a bunch of prices in the text and the unit trusts based on the data in a price for that please note that I'm not saying how you do this there's no algorithm you know anything this is just what it means and that's what concepts all about the import meaning right at the end of the day we also need implementations for these things and this is where methods coming operate shoes are implemented by methods and an operation can be implemented by many methods because there's many different ways to do something right the same thing but we summary what we covered so far the let's say just for argument's sake that we will be you anything we'll call anything in the world and object the subset of those things all types Bronson parts especially because they can have subtypes and they classify other objects a special kind of type is-a relation and relations link objects to be right and it has a special kind of type is 10 operations which operates on a bunch of objects and it's implemented by a number of different methods but you can
set with a head full of concepts how does that help you because you still have this spaghetti bowl of code mind somewhere what's the point how does the topic
what you can do is you can forcibly structure your code in a way that conforms to the structure of the constitutional create in this particular example if you take the blue block there you can sort of block out a lot of detail and say OK well this is a method that's a method that has to do with polishing SUSY farts right you can you can block out the rate law grave and say well this is also means it is the method that I used to deposits and files it actually put them together and blocks the bigger least out of detail and its appearance has to do with the operation of Washington for and if you take this to its logical extreme you end up in a place where you can really just think of your code in terms of the concepts that are in your which means that all of that that's it's in that you can forget about it because you can just focus on what you really want to for example I can explain to you the price file has a particular file format tomorrow perhaps it's interesting to note that a but there are 2 kinds of file formats the 1 in and the other 1 is use the right and I can no absolutely nothing will need to know absolutely nothing about Excel if I just want to look at the method for parsing CSV files so we need as Python really coming to all of us there are basically 2 kinds of object oriented languages 1 sort is prototype-based that's what job was to does python conforms to the class called oriented programming languages so i'm gonna wiki run through that just explain how would have talked about up to now
actually maps department well we need some way of actually saying expressing the types in 19 and Python and this is week losses coming but please note that the clusters that much more restrictive things then the top which is a more theoretical things classes or like cookie cutter you can create instances and all those instances all the instances that are classified by that also that that applies to you can't change the class of an instance there are a couple of restrictions like that just to show you are not talking nonsense that adopt to show that it works right for
relationships we've got some something equally simple we don't have anything like the relationship that can actually attached to different things we just have a one-way pointer and that's an attribute so even a portfolio has owner at tributes conforms to 10 point to another object somewhere else right and that's all we have to anything we wanna do with relationships has to be built on top of and once again just to show you that actually works right methods and operations are interesting was that actually both present in python but operations on their explicitly and sort of their NGOs former now talk about that a little bit later but you know that a method is basically just the function and bison except for the 1 other strange restriction and that's that the method as to belong to a class that's also something that the theory doesn't actually expect but to make things work in the real world of computers we have to look for limitations obviously the other interesting thing that Python does is it allows you to it it it it has a little bit of a trick if a method is a function you could call it like I wrote there you could call it on the actual loss and Boston instance in right but Python just as a little bit of syntactic sugar which has an important role to play so that we can call this method on the actual object right I'll talk about that in a moment again just for completeness I had to put this slide in here have as the other examples and work so we do initialize instances right but more importantly subtyping and this is uh probably 1 of the most most use things in the world so to be able to express this idea of subtyping we have inheritance might have consumed by the end of course when you create a class that inherits from another 1 is that this clause will also have the methods of its superclasses In other words people think that it's about reusing the goat that's actually not it's an expression of during the day and it stays 0 but the Unit Trust Fund actually is a concept in my head which conforms to the definition of an investment instruments and just again that adopt this to show you that it works is get back to operations that let's I've got 2 scenarios where I've got 2 different involve formats and I have had an operation balls now remember an operation is a concept it's got a definition the definition of course perhaps means that EPA's operates on 2 things file format and a file and it will return to me the data that's in the park maybe line-by-line for example what we would do in Python is we would actually write 2 different methods right we will have a partial method answers the file format that has a particular implementation deadly different implementation on the Excel file format that the way Python actually knows that these things all different implementations of the same operation because we call them we gave them the same name it allows us to write code like this assumes that the price file has a file format than you can say for lines in price followed format this particular file right In other words when you look at this code and when you have to understand this code you can make use of this concept of passing files without having to know the details of how it's gonna work you don't even have to know that there are many file formats you just must understand the definition of the concept part that's all if we didn't have the enough to write something like this and there are a lot of things wrong with this just a few quick words on design when you think about the conceptual model when you discuss things and debate things with uh businessperson for example you live in that world where you could come up with a model like this a person that can become an employee eventually not be 1 anymore it's a the problem with this is that it's not implementable we understand it pretty well but we can't implement this is what design is all about you can go take that design and come up with a different understanding that you also understand equally well but it's implementable in this particular case we decided to think about it a little differently and say well perhaps a person can have roles and there are 2 types of roles in Boolean invasive and I can add roles and overweight during the lifetime of a person this gets the same job done but it's implementable so that's what design is all about course design is a difficult thing and I would never be able to make statements about it quickly and easily but you do Gates who was designed and built the design this just to give you a feel for why this is important I've got this picture this is actually a real world example from 1 of my clients who would like to stay anonymous it's has been reverse-engineered from actual code that's got to do with how the Commission's are being calculated in an insurance company I would never be able to explain to you how this company thinks about calculating commissions using the because most of the things on you really don't impart any meaning to me at all there we there because someone needed something to put a method on and didn't quite know what to call it right I set with this exact self went through this code I can't remember I think it took me about 2 weeks and gamma this can you see the contrast I can actually use this I can use this to explain something to you I can say OK when we do a quote we quote for particular scenarios and I quote scenario is composed of a bunch of benefits I can say that if we work out commission in these benefits on bundled together because commission is worked out differently for different bundles I can also say that this scenario is for a particular product and that each product has its own commissions the you know a lot more already and you have an index that actually makes sense in index that matches your understanding that you can use to navigate the scope
1 1 other quick example just because the people have to use inheritance in their own right I have another client they've got a system that has this class called optical table noun object table is something that just displays a table on the screen for you uh in which each row is an object in each got them is an attribute of that object and at some stage they'd had the need that people would have to focus on this thing for example maybe you just wanna see the unit trusts that are actually active and then they created object table with folder little but later on someone had need that you must also be able to full to these things by diet and so that ended up the table by date if you argue with someone about this it's very difficult to say that these things aren't concepts they are concepts people with Richard is also a constant right but is it a useful 1 does it say a lot about what's going on here or is it just and that the use of inheritance to reuse code there are other ways of doing this for example you could say let's change optic tables so that it actually has faltered and we introduce a new concept called filter thing when we create an object we can decide if you wanted to have filters or not and that the right wants for you could say let's say we've got 3 objects the kinds of things you have to report so the an object table is just a simple table that displays stuff from the table but the report is something that has focused and an object table and it uses that's focus to decide what gets displayed in object so there are lots of ways you can read these things and if you don't actually pick them to import meaning that's when you run into problems and that's what so it's all about by prepared most of this talk from a book that is out of french uh you will still find second-hand copies of it on Amazon I think it's that required James Martin and James Odell I highly recommend it if you wanna know about good and bad design work for many years the refactoring would makes your side the chat about this stuff that you welcome to e-mail me you can even use our e-mail and mailing list and then various ways link to all the slides thank you FIL thank you very much any questions about object-oriented well it things the talk that was great come on people if you choosing a programming language 2 2 2 on the fathers students would Python be the best choice I don't know about based I really do like Python uh I have to admit that it's because I have to make money also and sometimes work with clients to job on 1 nice thing about job is that the refactoring tools work really really well and refactoring is a good way to learn about design because you see what's bad and you realize what can be beta and and to see that transformation in front of your eyes is really a good thing so I think that's that's a pretty weak we can actually do bit the very 1st person wrote his thesis on reflecting in small talk with the same limitations we have been invited but I think even despite that I probably would still choose Python just because there's a lot of less unnecessary flow and also because Python allows you to not always do everything in classes and methods if you just need a little more function somewhere you can stick it in there and I think that helps a lot it's questions so general for example offers you a lot of great tools for not only refactoring but some expressing concepts and what especially about job was build in the ability to define abstract classes and interfaces now I know that Python for example is introduced abstract base classes which in my opinion is a really valuable tool but only during runtime right because the implementation of ABC's is only validated during runtime so I was wondering is there any tool that you can recommend to get a more might get a better understanding of the way classes interact even before you actually run the code in Python I'm sorry I'm not aware of anything it's it's actually something I would really really like I think the fact that Python is a dynamic language it's something that means we have to deal with these things differently and and how it was done before 1 before in other languages is to say well if you can use the price functionalities and things to if you run your tastes collected data about what calls what then that gives you a lot of that static compile-time information that you otherwise than having by and I'm I actually really would love to see a tool that does that and so that refactoring tools can be based off of that but I'm not aware of anything like that did you ever run into the problem that you have to look up that you had a concept which you could not realize for programming language you chosen had to on Heck concept or Hector programming language to make it actually work I'm going to have to say no but I probably cheated year image uh you know nothing is perfect and the aim of this is not to have a perfect that aim of it is just to help you have a good map of your code to uh works well with our power its work and if you think about it very very complicated things are expressed in terms of concepts if you think about Fourier transforms for example it's a constant the right 0 no I haven't but sometimes you you cheat because remember losses on the only things that are concepts here the relationships also constant the operations also constant and sometimes you'll express a certain bit of information about something by adding a decorated to remain or whatever but I think that we have enough place here too to deal with everything that we need to deal the the so what's your opinion about took typing the meeting a completion and decision I actually think it works quite well I think that these are a lot of problems that a job for example run into with interfaces legal table create a lot of colossus that doesn't really explain much value they are very functional and names like sortable that doesn't tell me too much but just gives me the mechanics of making sure that this thing will work with other things so yeah I I would actually prefer that means over using abstract myself sources for example in in most cases think the we have 1 question from online I translated from online on critics boxes asked the students fresh out of interest to understand some different and better than all the world to mind all and the students don't get taught object-oriented continuous I don't know what it was this particular subject material which is actually very theoretical just gives you a different point of view on things right but if I search on Google I gave encapsulation inheritance information hiding it's almost like teaching someone how to drive a car by explaining how the court works so I I don't actually know I don't have enough exposure to know what's being taught in universities currently but my feeling from where I stand aside Mrs. things I don't see them all when you have a lot of parent classes when you're doing subtyping and what not 55 tools that could really easily the bot like if you have the same method or in multiple all classes parent classes that's a LIMSI ongoing conflict of all the methods did you have a father to all of the could easily toboggans you what is the order of execution because sometimes it's not really what you would want you to remember having several superclass yes if you if you feel like 1 child is built up from multiple it would make sense or slightly thanks yeah but sometimes you get a conflict in you you you try to do your best separate and not have discovered but there is life you know I tried to avoid mixing is an awful inheritance so who were actually in in our codebase we have a couple of meetings in the skirted but I have come up with a plan to change that and I can't wait to the rarity implemented I think that multiple in here this doesn't really add much to the picture usually you can actually express things differently by composing rather than inheriting for example so but I have been searching for tools like that cause I tried just not to do it at all it's actually a comment for for a question I don't know if this is what you're looking for but I think that in Python 3 and I don't know if in Python through you actually have this magic parameters that objects of the mass of the solution or the year and moral under under moral other the you have this and you can expect the inspect it in a raffle sessions actually which object it is just before the question how the functional programming is an alternative Cayuga Claudia as being functions could be used Robin objects well think about a function in a function can just be an implementation of an operation and if you work with me that I don't know a lot of functional languages but if in Haskell for example you can state that uh what types of the function is actually applicable to and you can have multiple functions with the same name but they expect different types so has can actually also choose at runtime with actually implementation of it will you so I think that the same concepts apply we have 5 minutes so I feel free to ask questions and I well if there are no questions and I think that occur at the time so I 1 program