this second version of the main algorithm is certainly more concise the number of variables has been reduced to eightsince theta and yvel have been eliminated from the main algorithm do you see where they wentthe value of theta is only needed locally inside of getxycomponents similarlyyvel is now local to updatecannonball being able to hide some of the intermediate variables is major benefit of the separation of concerns provided by top-down design even this version seems overly complicated look especially at the loop keeping track of the state of the cannonball requires four pieces of informationthree of which must change from moment to moment all four variables along with the value of time are needed to compute the new values of the three that change that results in an ugly function call having five parameters and three return values an explosion of parameters is often an indication that there might be better way to organize program let' try another approach the original problem specification itself suggests better way to look at the variables in our program there is single real-world cannonball objectbut describing it in the current program requires four pieces of informationxposyposxveland yvel suppose we had projectile class that "understoodthe physics of objects like cannonballs using such classwe could express the main algorithm in terms of creating and updating suitable object using single variable with this object-based approachwe might write main like thisdef main()anglevelh time getinputs(cball projectile(anglevelh while cball gety(> cball update(timeprint("\ndistance traveled% meters (cball getx())obviouslythis is much simpler and more direct expression of the algorithm the initial values of angleveland are used as parameters to create projectile called cball each time through the loopcball is asked to update its state to account for time we can get the position of cball at any moment by using its getx and gety methods to make this workwe just need to define suitable projectile class that implements the methods updategetxand gety defining new classes before designing projectile classlet' take an even simpler example to examine the basic ideas examplemulti-sided dice you know that normal die (the singular of diceis cubeand each face shows number from one to six some games employ nonstandard dice that may have fewer ( fouror more ( thirteensides let' design general class msdie to model multi-sided dice we could use such an object in any number of simulation or game programs each msdie object will know two things