- Objects
- Classes
- Inheritance
-
Programming in Java on Your Computer - Classes and Objects in BlueJ
- Trying out Code in BlueJ
- The Code for Creating and Using Objects
- Source Code and Methods
- Accessors and Mutators
- Constructor Code
- Scope
- Inheritance
-
BlueJ Review - Class Code
- Simple Debugging
- Interactive Picture
- Refactoring Code with Inheritance
Objects
Premium Content - Free Preview
The previous module discussed the basics of programming, but it didn't go into details of how code is structured. In the early days of programming, people wrote programs which were executed linearly from top-to-bottom, and the most structure they had was separation of code into different tasks.
You saw simple examples of this in the algorithm flowcharts, and in the code you've programmed. This type of linear programming can work well for small pieces of code, but it becomes more difficult when projects grow in size. Complex applications cannot be modeled well with long linear code, so a more-structured approach to programming is needed.
Objects
Java enforces a programming methodology known as Object-Oriented Programming (OOP). OOP is inspired by the real world, where people interact with different objects to do different tasks. An Object has behaviors that it does, and it has a current state that its in. For example, a car might have the following behaviors:
- accelerate
- brake
- brighten Lights
while its current state might be:
End of Free Content Preview. Please Sign in or Sign up to buy premium content.
Comments
calo
Jan 14, 4:31 PMI think it would be good if pictures with schemes could be zoomed
Learneroo
Sep 24, 1:18 PMOK you can click on the pictures for larger ones. Code can be disorganized without objects, objects let code be organized into components that communicate with each other.