Learning object oriented programming may seem like a chaw but in reality once learnt it's not difficult. However many programmers learn object orientation programming instead of the whole object orientation process, for example what do we mean by object orientation? What does the APIE acronym stand for and do we understand all concepts of this acronym? Those who may even have a general knowledge of object orientation programming may want to take this course because it'll give a higher definition of object orientation and all concepts that surround it. To truly understand how to program in an object oriented manner then we must first understand all there is to know about the concepts, ideologies and fundamental understanding not just the syntax of any one language.
If you just know how to program object oriented then that will not cut it. What happens when you need to map out an application are you using UML and are you using it correctly? Everything we do in the programming world is for real world use so understanding the syntax only or understanding object orientation in a general way will not cut in large scale projects. So those programmers who may have been exposed to object orientation syntax may find this course of some use and don't for object oriented analyse and design don't refer to any programming language. Also new comers will definitely learn a boat load from this course in the simplest manner possible right from the start even if you don't want to do the programming part.
This course includes lectures that break subjects down like abstraction, polymorphism, inheritance and encapsulation in a simplified spoon fed manner for anyone to understand from beginner or even an experienced programmer who wants to know more about the object oriented fundamentals.
Welcome to this course that'll teach you about object oriented analysis, design and programming. This course isn't just about learning syntax, it'll teach you the why behind lots of commonly used terminologies and phrases used in OOP. Also the concepts will be explained even how to define objects themselves.
Defining an object can be tricky, so we need to know the very definition of an object. How do you define an object and then how is it translated into the programming world.
A class is used to build an object in programming. But why would you want to use classes? Why do they exist and have purpose in programming? Well we're about to find out.
Abstraction is the necessary process of simplifying our program's. It's a principle that is carried all throughout programming and not just object oriented programming. As programmers we must simplify and the best way to do that is abstraction.
Polymorphism may sound like a big word but all it really means is 'many forms'. For example if you use the plus '+' symbol you can add two numbers together and likewise using the same plus operator two strings will be concatenated together.
Inheritance is a form of instantiating a sub class with that class then pulling in all the parents' properties and method's. Inheritance has a lot to do with abstraction.
Encapsulation is grouping properties and methods together in an object, it's essentially the container that keeps everything together. However this is not the only one purpose of encapsulation. It also involves black boxing which is hiding certain properties and methods to further ensure our application works the way it should.
Object oriented analysis is very important when starting a new project. Missing this stage will be disastrous for large scale project's and even small ones if not done properly. Also over doing this stage will in essence hamper you so finding the right balance is good. Once the data analysis has been done we can then move onto the next step which is designing the program.
The universal modelling language is very important for diagramming the class structure of a program. This lecture will give you a brief overview as you've already seen some UML in prior lectures.
UML is simple but allows for complex modelling. However don't go too far with UML lest it become burdensome instead of a tool to help produce a good program structure. Mainly your UML will be simple with standard inheritance relationships. However you can also show aggregation and composition relationships as well with UML, these are the essentials and pretty much should cover all UML you really need to know.
Sequence diagrams are hear to explain to you as a programmer, or your client, how the user will interact with your program. If you or your client is unsure about how a certain scenario will play out then you'll need to demonstrate it with this useful digram making it as detailed as possible. Please don't create a sequence diagram for every scenario that could happen in your program; as this would simply waste time making diagrams for things you already know.
Classes are made up of many member's, a member being either a property or method. However for each member we can set the access level, ensuring a more robust application structure.
Overriding is to do with the way in which your members work within inheritance. For example a sub class can have a member that'll override or overwrite the parent member with the same name. This can be very useful for abstraction and makes our application more flexible when creating objects.
Shared, class level or what's more commonly known as a static member are shared across all instances (objects) of that class. Also a static member can be accessed in memory without even creating a single instance (object) from that class.
To put it simply a concrete class can be instantiated, which means we can create an object from that class. An abstract class is a class that we cannot create an object directly from. An abstract class is there purely for inheritance.
Interfaces are a lot like contracts for our application. It ensures that our classes that implement a certain interface will have the methods required. This can be useful later on for ensuring we can check this object has that agreement ensuring we can call that method.
Traits are important in single inheritance languages. Most of the time there is no need for multiple inheritance however in programming languages like PHP that only support single inheritance; traits can be useful to solve the problem of code reuse.
Before we begin this project let's start at the design phase. In reality you would go to the analysis stage and gather all data together and then design the application.
Firstly for code reuse, and dependancy on for the sub classes, we can focus on the abstract class and create it first.
Once we have created the abstract class we can now create the sub classes. We also will create interfaces for the penalty method to be called on certain accounts.
Next we want to finish off creating our concrete classes. We need to finish explaining the withdraw method and then complete the concrete classes.
Now lets add a trait and then use that trait with the bank account plus for the debit and savings accounts. This'll allow us to create a more robust application.
Now we have our classes we can call the sub classes. This will then create instances of the sub classes and allow us to perform actions on those instances or objects.
Next we'll take a look at running our program even further to find out more about instantiating classes and producing instances of a class (objects) at runtime. Also we'll review the process of checking for a certain interface which guarantees certain methods are able to be run on our object's.
Using interfaces at runtime is very important as it'll allow us to check to make sure an object has the correct methods that we know can be called on this object. This way we use interfaces for class integrity and avoid runtime errors.
When instantiating classes sometimes we need special property values each time we instantiate a new object. We can do this via a constructor function.
In this lecture we'll add a constructor function to our abstract bank account class. Then I'll link up the parent constructor to the sub class constructor.
Just as an example of static properties and methods in PHP. Also constants are in fact compiled to memory like static properties however they are not variable, they can only be set once and cannot change through the lifetime of the program.
Thank you for watching this lecture, I hope you have learned a lot and review this course periodically to refresh your knowledge on OOA, OOD and OOP.
Lawrence Turton works as a web developer & graphic designer specialising in HTML, CSS, jQuery, UI & UX design. He has previously worked with Fifteendesign producing websites, iPhone and Android apps and started his own agency in 2010 called Elite Web Design. During that time Lawrence has established a wide range of clients from blue chip companies to large corporations. From a young age he was an online instructor and started to work with two of the leading online training specialists Cartoonsmart and Envato. Lawrence always created projects involving designs in Photoshop and bringing his creations to life by coding them with web technologies. This gives him a unique perspective into real world projects from start to finish and a wealth of information for new comers to the web industry.