Object-Oriented Programming2:29 with Jeremy McLain
What does object-oriented programming really mean?
Object oriented programming is the predominant way that developers think 0:00 about software development. 0:03 But what does object oriented programming really mean? 0:05 It means we can think of a software program as a bunch of distinct objects 0:08 working together. 0:12 A software program can be defined by how different objects 0:13 interact with each other. 0:17 These objects, just like objects in the physical world, 0:18 have their own characteristics and attributes. 0:21 They also have their own abilities and behaviors. 0:24 For example, the object I have in my hand right now is a PEZ dispenser. 0:26 It has attributes. 0:31 For example, it's green and orange. 0:32 And it has ten pieces of PEZ inside of it. 0:34 It also has behaviors. 0:36 It can dispense. 0:38 Thanks Yoda. 0:39 I am another type of object. 0:41 I'm a human and I can interact with the Pez dispenser. 0:43 I can add Pez to it. 0:46 We can even break this simple object into smaller objects with their own attributes 0:51 and behaviors. 0:55 For example, Pez dispensers have a head and a body. 0:56 Although these are all parts of the Pez dispenser, 1:00 we can think of each of them as distinct parts. 1:02 If we were creating a software application for 1:05 a Pez dispenser we might model each of these objects separately in code. 1:08 Thinking about software this way has lots of benefits. 1:13 For one, it makes thinking about building a large software application a lot easier. 1:16 We just have to think about the different types of objects that the software 1:21 is composed of. 1:24 Then you can craft each of those objects one at a time. 1:25 These objects can then be composed together to make something really cool. 1:29 Thinking about the program in an object oriented way 1:33 naturally breaks it up into smaller parts. 1:36 And that makes the whole program easier to code. 1:39 Another major benefit is software reuse. 1:43 The code that's written to describe an object could be reused 1:46 in another software project that needs the same type of object. 1:49 Code reuse is really important. 1:53 Now-a-days, in order to write a software application, you actually only have to 1:54 write a tiny percentage of the total code that makes up the entire program. 1:59 Reusing code is what makes it possible to write so much software so quickly. 2:04 In fact, many software developers believe so much in code reuse 2:09 that they share the code they write by putting it on the web for anyone to use. 2:13 This is called open source code. 2:18 It's only because they follow the principles of object oriented programming, 2:20 that others are able to integrate that code into their own software projects 2:24 so easily. 2:27
You need to sign up for Treehouse in order to download course files.Sign up