Hello,
I’ve been reading a lot of books lately and trying to get my head around oop. I have some questions though that i just can’t seem to find the answers to, am i just missing the point?
Firstly people keep saying to me if i learn java, oop will be easier, but surely even in a language like java where you're confined to classes you can write procedural code? This leads me on to my question. Lets say for example i have created some objects for getting and displaying a news page on my site. On the news page i would instantiate my classes (and possibly use a loop like wordpress?). Is this the correct way of doing this? It seems to me that im still writing procedurally on these pages, whereas in java this would be done differently?
My second question is regarding exceptions. Im not really clear on when to throw rather than echo an error and where should my try/catch blocks be, in the class or on the page instantiating the class? I believe i should always throw an exception from a class error, is this right?
Finally should SQL be mixed with other class code? If not how should i access the database with other classes or objects?
Thanks for your time and sorry if i don’t make sense
George




Bookmarks