objects and encapsulation encapsulating useful abstractions hopefullyyou are seeing how defining new classes like projectile and student can be good way to modularize program once we identify some useful objectswe can write an algorithm using those objects and push the implementation details into suitable class definition this gives us the same kind of separation of concerns that we had using functions in top-down design the main program only has to worry about what objects can donot about how they are implemented computer scientists call this separation of concerns encapsulation the implementation details of an object are encapsulated in the class definitionwhich insulates the rest of the program from having to deal with them this is another application of abstraction (ignoring irrelevant details)which is the essence of good design for completenessi should mention that encapsulation is only programming convention in python it is not enforced by the languageper se in our projectile class we included two short methodsgetx and getythat simply returned the values of instance variables xpos and yposrespectively our student class has similar accessor methods for its instance variables strictly speakingthese methods are not absolutely necessary in pythonyou can access the instance variables of any object with the regular dot notation for examplewe could test the constructor for the projectile class interactively by creating an object and then directly inspecting the values of the instance variables projectile( xpos ypos xvel yvel accessing the instance variables of an object is very handy for testing purposesbut it is generally considered poor practice to do this in programs one of the main reasons for using objects is to hide the internal complexities of those objects from the programs that use them references to instance variables should generally remain inside the class definition with the rest of the implementation details from outside the classall interaction with an object should generally be done using the interface provided by its methods howeverthis is not hard and fast ruleand python program designers often specify that certain instance variables are accessible as part of the interface one immediate advantage of encapsulation is that it allows us to modify and improve classes independentlywithout worrying about "breakingother parts of the program as long as the interface provided by class stays the samethe rest of the program can' even tell that class has changed as you begin to design classes of your ownyou should strive to provide each with complete set of methods to make it useful