In the previous tutorial oop PHP, we have learned about the 5 key term in oop. But before we discuss further fifth term, we will first learn the concept of oop alias Object Oriented Programming. This concept is certainly valid for the general good of PHP and other programming such as Java support oop.
Remember this. Actual oop is a way of thinking in creating the program.
In fact in many cases, our program will not differ greatly with the methods that may be structured for this we know. But the important thing is to think how to make everything as an object. Remember this keyword: Think of an object. The more simple, when we create a program, then we will create a variety of classes that we will often use the class and we will make into an object that you can develop later.
Usually books or tutorial will be using examples of objects such as a cat, a house or car. Because the explanation that describes the process of program-based oop similar to the way we think everyday. If not, please believe you buy or read books about oop.
But I never felt that the explanation itself directly with the real examples in the real world has become an example of programming in the abstract. Because we may not make a cat or a house or car with PHP? Therefore I will give a slightly different explanation. I will not start from the example of a real example the abstract, but from the way some thought in making program. Next we see a new process of thinking oop with comparisons to the day-to-day life of yesteryear.
Hopefully more clearly.
Ok, to make it easier to imagine how to make a difference in a normal program and oop, I will submit some of the comparison between the way of thinking in the programming. Ready?
At the beginning of our career, we will generally make a program without function. For example we will create a calculator program. In this example we will focus on making the appearance.
Imagine a calculator. We definitely need to make the future look like a calculator that is not it? Where there are a few key numbers and mathematical operations, and the screen will display any of us in the press that button, and others. Furthermore, in making the program a calculator, we will create a program that long to write all the code to create the display. Start from the outside, forwarded screen, the button 1, button 2, button 3, etc, as well as key operators -, +, x and: = and a button that you create is larger than the others because it is often used.
Well, after you create quite sophisticated in the program, you certainly know that the key is making the process repeated that we can actually make a function with a variable input text will be displayed. (Remember this example is very simplified, so do not protest). So we will create a function key. Here we will make 2 types of key functions, namely small and large button (the button is of course great for the "same as" before that).
Then, after learning oop, then you will create a class called a key. This class is our design so that we can create objects with different key sizes, colors, and the event that occurred when we press the button. With oop, the class we will have a retroactive nature of programming, oop, of course, will help us to create a program based on PHP.
Explanation of the difference between the class with the function is simply the nature oop that we have ever been mentioned in the previous tutorial oop.
With such attributes, the making of the program will be much easier. For example, if you create a program and requires a specific function, you can create your own function or you will find it easier with the Internet. After you download, then you will need to learn the function and how to use it and if necessary modify the core program. This is different from the class in oop. With the class, we only need to know is just.
Explanation of this class will bring us to the explanation that uses everyday objects.
Ok, hopefully this compare with the explanation can help you understand a little oop. Next we will study the concept of thinking in the example object oop with day-to-day. This you need to connect an explanation about the nature of class earlier.
Subscribe to:
Post Comments (Atom)
0 comments
Post a Comment