Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Digital Literacy Computer Basics Computer Languages Programming Paradigms

''object oriented programming often uses code objects to mirror real world objects'' --- what does this statement mean?

what is code object as there is no term on google named ''code object'' and what does the above statement really mean ? plz help me!!

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi Umang,

What this is referring to is a code paradigm called Object Oriented Programming. This uses objects and methods to perform actions in the same way that real-world objects have state and behavior.

For example, the calculator on my desk right now can be switched on and off. In the code you'd represent that behaviour using properties in an object.

The calculator can perform actions like adding numbers, subtracting numbers, multiplying them or divide numbers. You can use methods (which are really just functions) to represent that functionality. Methods represent behaviour. Adding numbers is behavior - performing an action.

Object Oriented Programming can be applied to almost any language.

seriously i am dumb since i am not getting it even now . sir i am not getting what does the term object oriented programming means and if we use real world objects state and behavior in it then how this is used to program codes for the web and all??

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

I don't think there's an easy way of defining what it actually is.

What it essentially is, is a method of programming. It makes programming structured and modular rather than a mere list of instructions from top to bottom in a script.

Wikipedia here describes OOP as "programming paradigm based on the concept of "objects", which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. A feature of objects is that an object's procedures can access and often modify the data fields of the object with which they are associated"

The best way of understanding OOP is to practice it.

I don't know how far along you are in your Treehouse journey. But I suggest you try the JavaScript courses. Learn the basics first if you haven't already before you move on to OOP concepts. There's content on OOP JavaScript already. And, in the next couple of months a new course on OOP in JavaScript will be released. So I'm confident with practice you'll start to understand :)