The Way to Programming
The Way to Programming
I am a beginner at writing PHP and I’m currently trying to master OOP. On a small scale I understand it pretty well, but when I try to wrap my head around a larger scale project it just gets confusing on what ways are the best to design the code to be effective. Syntax is one thing, but the book I’m reading doesn’t really touch base on how I should write my code to be more efficient and scalable. Looks like I will need to get into another book very soon.
On a side note, I’m having a lot of fun developing little projects on my own to learn the language better. Are there any challenges that someone could suggest for me? I love challenges and I believe it helps me learn better when I run into problems.
For OOP, it’s important to identify the objects. In any problem domain, there are specific items that you’ll refer to in conversations, and these often map onto objects. For example, when talking about payroll, you’ll talk about payslips, employees, raises, deductions, taxes, etc.: these may all be objects, including “payroll”. To better understand how they hang together, you have to talk about whether an object “is a” another object or “has a” another object.
OOP can be confusing at first. The best way to understand it is to try it. Make sure you do the examples in the book and then do some of your own examples using OOP. There will be a lightbulb moment when you get it.
Sign in to your account