+2 votes
131 views

I started learning oop about 6 months ago, although I stopped for a while because of studies.

The problem is that whenever I use oop in my project I usually try to just make every single thing a class… Whether intialization, displaying, looping and much more… to be precise, I haven’t gotten the concept of when to use to create classes.

Another problem is that I tend not to know the major benefit of a classes over a functions . Currently, I just mix them up.

I watch a youtube video that talks about classes and client code. In that video they said that classes are more of like developer codes while client codes are codes we write which uses the developer code to make things easier. So he advise we break our code to client/developer code. But I don’t know how to break my code into client code and developer code. Infact at a point I was creating classes for all my pages like index.php, about.php

?php class about{ $title = 'about page'; $page_color = 'red'; //more codes } After writing the above code I know I am not doing something right. I have tried to search google and have read many oop books but each time they use the car class example which I can not apply to my coding or just wouldn’t address the context were a class is or isn’t necessary.

Note: I am comfortable building website using procedural codes but I need to learn oop incase I need it someday.

by (1.7k points)   | 131 views

Please log in or register to answer this question.

Related questions

+2 votes
0 answers
+3 votes
0 answers
asked Jun 17 by noor (1.1k points) | 9 views
+1 vote
0 answers
+2 votes
0 answers
+1 vote
1 answer
asked Jun 27 by fatyma Nauman (555 points) | 41 views
+1 vote
1 answer
0 votes
0 answers




Welcome to Meansflow - Where Developers and Students Learn, Share, & Build Careers, where you can ask questions and receive answers from other members of the community.
117 questions
88 answers
42 comments
106 users