AnyLang Programming Language Comparison/Object Oriented Programming
Jargon-free introduction to OOP edit
Procedural vs OOP is one of the topics that no two people will answer exactly the same way, and it can be confusing.
Here is a no-jargon explanation. Procedural vs OOP just deals with how you can write code in such a way that the different pieces are easy to understand and maintain. You can actually write "Procedural" code that follows some of the principles of OOP, so the two are not necessarily opposites.
You really will not get a usable understanding until you actually start digging in, because the terminology and "jargon" is just too thick in this particular forest.
Quick overview edit
- You can write PHP that does useful tasks
- You can organize useful tasks into "chunks" of code
- Sometimes those "chunks" of code will behave differently based on parameters you pass in
- Chunks of code that accept parameters are called "Functions"
- Functions can also be "chunked" together, and there are different ways of doing this:
- (( you could have just one big PHP file with all the functions you have ever written listed in alphabetical order ))
- (( you could have multiple PHP files with functions that are chunked together by subject matter [e.g., functions for doing math, functions for checking spelling, etc] ))
- OOP is a special way of "chunking" Functions together into a "Class"
- A Class is just another level of "chunking" code together so that you can treat it as a unified whole
- A Class is useful because it allows you to organize your code at a very high level in a way that makes it easy for you to understand, use, and maintain
Web frameworks edit
- When someone has written a lot of functions, and organized them into a lot of Classes, and gotten those to work together in some cool way, they package the whole thing together and call it a "Framework"
- A Framework is just a system of coding style and practices that one or more people agree on because they like the way the code is organized and it suits their working style, preferences, values, or whatever.