Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it some bizarre heresy to use classes without objects?

Tags:

php

class

This may be a silly question, but it's been bugging me.

I've been writing what I believe to be procedural code, but I'm using classes which group together related public and private functions according to purpose. Instead of using objects and methods, I call the functions when needed with a scope resolution operator. ie: db::execute($sql)

I know it's ridiculous, but I just now realized everyone immediately associates classes with OOP. Am I committing some perverted heresy?

like image 792
Greg Avatar asked Dec 13 '22 20:12

Greg


1 Answers

you're basically abusing one language construct (class) to emulate another one (namespace). This is totally normal, as long as you use a language that doesn't support the latter (php 5.2-).

like image 79
user187291 Avatar answered Jan 25 '23 22:01

user187291