Tuesday , 23 May 2017
Home / Tag Archives: OOP

Tag Archives: OOP

Object Oriented Programming – Advanced JavaScript Tutorial

Object Oriented Programming

Object oriented programming in JavaScript is different than most programming languages. JavaScript has no acknowledgement of classes. All properties and methods inside an object are just name-value pairs. We’ve discussed object oriented programming before in the JavaScript beginner tutorial series. Now, we’ll go more in-depth of what OOP is. They way we’ve been writing code is what’s called procedural code. …

Read More »

Creating Properties and Methods – JavaScript Tutorial

Creating Properties and Methods

In this tutorial, we will be working with the Car class we created in the last tutorial. You’ll learn how to create properties and methods. Creating properties and methods in JavaScript is relatively simple. Creating A Property As previously discussed, a property is just a variable for an object. Creating a property in an object is different than creating a …

Read More »

String Object – JavaScript Tutorial

String Object

The string object is another object built in by JavaScript. Whenever you create a string, JavaScript will automatically give it the properties and methods of a string. To clarify a few things, you can sometimes access an object directly without having to create a variable. We saw how to do this with the number object, but with the string object …

Read More »

Number Object – JavaScript Tutorial

Number Object

So we’ve talked about objects in general and we discovered a new object called the document object. JavaScript comes with built in objects that you can use. In this tutorial, we take a look at the number object. Number Object Properties Just like other objects, you can access the properties and methods of the number object. Let’s take a look …

Read More »

Objects – JavaScript Tutorial

Objects

Object oriented programming is a topic for intermediate programmers. It can be a very confusing and discouraging topic. JavaScript utilizes objects often so learning about OOP (object oriented programming) early is important. I won’t be going in depth in OOP until later tutorials, but for now, I’ll be covering the basics and what you need to know. What are Objects? …

Read More »

Conclusion – PHP OOP Tutorial

Conclusion

This is the final tutorial. You now have a basic grasp on what object oriented programming is and how you can apply it to PHP. There’s more to it such as design. If you would like more information, then go here .http://php.net/manual/en/language.oop5.php One question, that I’ve been avoiding during this whole series is why use object oriented programming? Why use …

Read More »

Magic Methods – PHP OOP Tutorial

Magic Methods

PHP provides some magic methods that run when an event occurs. You’ve already seen an example of a magic method with the __construct() method. This method runs when a user creates an instance of the Pet class.  Let’s take a look at some of the other magic methods we can use in our classes. Using Magic Methods In your pet.class.php …

Read More »

Interfaces – PHP OOP Tutorial

Interfaces

In this tutorial, you’ll learn how to create interfaces and why you should use them. They are very similar to abstract classes. At the end of this tutorial, we’ll discuss the differences and the benefits of each one. We’ll be creating something similar to our recipe and cookie class in our abstraction tutorial. Creating Interfaces Create a file called index.php …

Read More »

Abstract Classes – PHP OOP Tutorial

Abstract Classes

Today, we’ll be discussing what abstract classes are and how we could use them. There will be times where you’ll create a class that you don’t want anyone to use directly, but instead extend it. Let’s take a closer look at this Creating Abstract Classes We’re going to deviate from our Pet class for a bit. Mostly because we don’t …

Read More »

Static Methods and Properties – PHP OOP Tutorial

Static Methods and Properties

Let’s learn how to create static methods and properties. Anything that’s static is basically something that can be accessed without needing an instantiation of the class. You also have the advantage of having a value that is consistent through each instance of the class. Let’s take a look at this. Creating Static Properties Inside our Pet Class, add this bit of …

Read More »