+ 1

Definition of objects and instances in practice

Objects in practical terms are variables where their primitive type represents any class. Instances in practical terms are objects argued with any type of constructor, that is, its constructive value is assigned. both statements correct? if not, justify it.

5th Apr 2018, 5:39 PM
João Vitor Fernandes
João Vitor Fernandes - avatar
2 Respostas
+ 1
Hi JVF You are sort of on the right track although a gross oversimplification. You should also be aware of the two types of object abstraction -Class based ( as per most modern OOP languages) -Prototype based (as per Javascript) I wont go into the pros and cons of each as these are thoroughly discussed on the web. In short an object has both data and methods as well as encapsulation (scope). So you seem to have a handle on the data, but probably need to look into methods, (private and public) ie what can you do with the object, and explore the encapsulation part which is all about who and what, has access to the data inside the object. You are also on the right track in Object construction and instantiation, but the internals differs between Class based vs Prototype base objects. At the end of the day the idea is to use Objects to model the real world, and to provide as much encapsulation of our code so they adhere to the DRY(Don't Repeat your Self) principle. Just to add fuel to the fire, when you have finished looking at Objects , read up on Functional Programming which I think offers some better ways of doing things than OOP.
5th Apr 2018, 7:06 PM
Mike Choy
Mike Choy - avatar
+ 1
Thank you very much, clarified my doubts, MC. I will see about functional programming.
5th Apr 2018, 7:19 PM
João Vitor Fernandes
João Vitor Fernandes - avatar