Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Most modern programming languages, such as Java, C#, Ruby, and Python, are object-oriented languages, which help group individual bits of code into a complex and coherent application. However, object-orientation itself is not a language; it's simply a set of ideas and concepts.
Let Simon Allardice introduce you to the terms—words like abstraction, inheritance, polymorphism, subclass—and guide you through defining your requirements and identifying use cases for your program. The course also covers creating conceptual models of your program with design patterns, class and sequence diagrams, and unified modeling language (UML) tools, and then shows how to convert the diagrams into code.
So what happens if you write a class that never gets instantiated? Well, this can be a useful technique in Object Orientation. I've shown this example of the BankAccount collection of classes where we have a BankAccount class defined at the top with accountName and balance, deposit behavior, and withdrawal behavior. And then we have three more specialized classes that inherit from it, CheckingAccount, SavingsAccount, InvestmentAccount, and so on. But during the process of writing this, we might realize that will only ever instantiate an actual CheckingAccount or SavingsAccount or some other specialized account, we'd never actually instantiate a BankAccount class.
Now if that's the case, this class can be considered an abstract class. It exists purely for the sake of being inherited. Abstract classes are never instantiated. Now this class is still incredibly useful, it can contain functionality, methods, variables, and so on because they'll all be inherited. So it exists to provide shared behaviors. In some languages like C# or Java, you can explicitly mark a class as Abstract when declaring it, which means the language won't allow it to be instantiated.
And you must inherit from it before instantiating an object. Actually, the VB.NET keyword to enforce this is must inherit. But in other languages there is no official word for this, so you can just do it by a mission--just don't create an object from this class. Although with dynamic languages like Ruby, this kind of formality is not supported by design, it's just not the way that Ruby works. It's a much more common technique in C#, Java, VB.NET, and C++. So if that's an abstract class, a name for a class that can be instantiated.
Well, if don't say otherwise, we just assume that all classes can be instantiated but just as a term to use to distinguish them from abstract classes you can refer to a class that can be instantiated as a concrete class.
There are currently no FAQs about Foundations of Programming: Object-Oriented Design.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.