This prototype is intended to be a visualization of Classes and Objects in object-oriented programming.
Classes and objects are fundamental to object-oriented programming languages like Java. Object-oriented programming is often difficult for students who are only familiar with sequential programming because code is more fragmented. We wanted this prototype to give students a chance to experience classes and objects in action without the need to worry about syntax.
Learn how classes and objects work in space! Store planet classes in an inventory around your left hand (unique to virtual reality) and use them to create full-scale planets to fill your solar system.
The Actual Experience
Build your own custom solar system by designing model planets and using them to build unique planets.
- Design model planets by selecting different sets of features, like size, color, rings, and moons.
- Use the models to create unique individual planets, then set them loose to orbit your sun.
- Classes act as templates for objects and define which attributes an object will have. (Model planets act as templates for planets in orbit and each model has a particular set of attributes.)
- Objects are initialized with specific values for their attributes and then instantiated. (Individual planets are customized by setting the values for each of their features and then sent to orbit.)
- Many objects can be created from the same class. (A planet model can be used to create many individual planets.)
- Attributes are defined within the class and set when an object is initialized. (Features for a type of planet are selected to make the model, then those features are customized when an individual planet is being created.)
Step by Step Walkthrough Guide
- Get familiar with designing and developing for Oculus Rift and Touch.
- Explore virtual reality interfaces for inventory.
- Explore whether or not object customization is a useful way to represent classes and objects.
- Find out whether or not classes and objects can be represented by a user interface.
- Explore the potential benefit of adding small doses of syntax to the experience.
As this was one of our first prototypes, many of the lessons we learned were about usability when working with the Oculus Touch controllers.
- No one can see the buttons from inside the VR headset (unless you render the controllers in VR, which we didn’t).
- Having a unique gesture for each customization seems cool, but makes it nearly impossible to remember how to work the experience. Consistent controls are much more effective.
- Pointing with the index finger and pressing a button with the middle finger on the same hand sounds sensible but is actually rather difficult for many people. Most people would rather press a button with their index finger or thumb.
- If an interface is going to represent a concept, that interface needs to be well-defined and have clearly distinct elements and sections.
- It helps to introduce interactions gradually in a complex experience rather than give players access to everything at once. That way players aren’t so overwhelmed and confused that they can’t focus on anything but figuring out the controls.
- Because a solar system is a familiar concept, the ideas that we were trying to get across sometimes got buried in people’s expectations of how a solar system experience should behave.
- The idea of classes and objects translates fairly well in this experience, but the experience itself isn’t necessarily terribly engaging. The usability problems really get in the way and the interactions get repetitive quickly.
- This is a novel presentation, but doesn’t necessarily add anything new to teaching classes and objects other than the fact that virtual reality is cool.
Role in a Lesson
This experience could be used as a way of introducing objects and attributes in object-oriented programming if it were played at or near the beginning of a lesson and followed up with code-based practice. It could also be used as reinforcement of a lesson if students played it after learning the material.
Additionally, this experience does actually introduce a bit of memory management, as the
solar system can only hold seven orbits. If a player wants to add a new planet after the seventh is already there, they must take one of the existing planets and remove it by dragging it to the black hole.
Connections between the experience and programming:
- Model planets correspond to classes.
- Features (size, color, ring, moons) correspond to attributes.
- Planets in orbit correspond to objects.
- Customizing and creating an individual planet corresponds to initializing and instantiating an object.
If this experience were used as an introduction to the concept, then a teacher could follow it up with code like this, which is a simple pseudo-code representation of what happens in the experience:
//the sun has only color and size
//a planet that has all 4 attributes
//instantiate an instance of planet
Planet my_planet = new Planet();
//set the color attribute of planet
my_planet.color = Red;
//set the size
my_planet.size = 1;
//set the rotation of ring
my_planet.ring = 0.5;
//set the number of moons
my_planet.moon = 3;
Ideas for Future Development
Interface and Usability
- Make the controls more intuitive and add a strong introduction or tutorial.
- Add further variation to classes, like fundamentally different types of planets (gas giants, ice planets, etc) or other solar bodies. This is where this prototype starts to be in danger of becoming a solar system simulator, but that would not necessarily keep it from teaching about classes and objects.
- Introduce inheritance. Currently, changing an existing planet model and saving it also changes the planets created from that model, but that is the closest this experience comes to addressing inheritance.
- Find a way to incorporate methods as well as attributes. Right now this prototype shows attributes quite well but doesn’t show methods at all.
Overall, the teachers we’ve shown this experience to have thought it was a cool idea that demonstrates objects and attributes particularly well. Most have seen how this experience could enhance a lesson, but one also pointed out that he was not sure that this was necessarily any better than the simple coding examples he uses (other than the fact that it’s cool).
The students we showed this prototype to generally thought this was a cool experience but did not typically get as much out of it as we had hoped. Many did not see the relationship between the planet models and the planets in orbit, which we had hoped to see even with students that were not already familiar with object-oriented programming. Those that were familiar with object-oriented programming typically identified what each element of the experience represented, suggesting that this particular experience may be more effective as post-lesson practice than as an introduction.
Thoughts From the Team
Miriam – I was pretty excited about this prototype when we first made it, and I still think it represents the concept well, but it has a long way to go before it would be ready to use as a teaching tool. It’s definitely the most frustrating to lead people through and feels like it has the least payoff. It’s a better example than a teaching tool.
Joe – Solar system is the most complicated prototype in our project, because it taught people exactly the relationship between class and object without any missing part, which means it will take some time for fully digesting that conception even after you are done playing with that. And also because this is mainly and teaching experience, there is no objective and comparison for people to understanding what is the advantage part of it and why it is the preferred choice.
Jiawen – Solar system is really a step by step experience. We map them to CS terms in a certain way so that every operation is meaningful. But somehow not that direct. We need to tell them the mapping. As a VR experience, it might be more fun if the player can interact more with the solar system they create. On the other hand, this prototype has most complicated interactions. It is a great exploration for Oculus touch gesture.
Nick – Solar system is what I expect of as a prototype that teaches class and objects. It teaches every process essential to the object and class model: class definition, member variables, instantiation and even deletion. What can be improved for this prototype is majorly interaction: the pointing mechanism in this prototype received a lot of criticisms. This can be improved in future iterations.
Luna – Solar system can be used as a representation of class and objects with attributes, but lack some precision because it does not contain methods, which may cause confusion. And I agree that this does limited improvement on existing methods such as using animals to teach class and inheritance.
Download the Code and Check it Out for Yourself
To learn more about this prototype and its development, check out these blog posts:
- Week 3: Getting Going
- Week 4: Figuring Things Out
- Week 5: Quarters
- Week 6: Wrapping Up Solar System and Fractal Magic
- Week 7: Of Factories and Flags