Search the Community
Showing results for tags 'oo'.
-
I currently have 3 big long PHP functions that correspond to 3 different product lines for which code is written for. Each function outputs certain sections of a PDF file for each of the 3 lines. A product line can have things like (Specs, Engine, Assembly, Job, etc). Each secion has slightly different computation to be done, and some product lines share certain secions, but not the others. i.e. all 3 have the need for the Specs section, but only 2 need Engine section, and so on. OO code says: create a general supporting class for all 3 product lines, then extend the class for each specific product line separate each section generation into its own function put them into the general class. Have extended classes take and customize what they need, probalby some more OO stuff, like separating each class into a separate file, doing some clean-up, maybe doing some dependency injection to initialize things, or the like. But I am thinking: here we have a big long function with everything for each of the product lines. Yes, there is some code duplication, and yes it is not OO, it is procedural right now, but the benefits of procedural here vs OO in this case is that I can leave these functions as-is, as they are written now - no need to rewrite code It is all right here in one file. I do not need to hunt for OO objects or methods spread out in different files if I need to change something with a product line, it is all right there! I can customize that product line as as needed. I do not see the need to often change all 3 product lines, but if I do, all the 3 functions are in the same file, I can search and modify code right there. I get the benefit of seeing all the details and all the steps for each product line in each file. There is no abstraction. It is a little tedious I confess, but it is all in one place. Why do we have OO paradigm now? Is it that in my case I do not need OO or am I missing something? I do not want to do OO just for the sake of it being OO. I am concerned that me reworking this code into OO will not really create me much benefit, but create "convert this to OO" work and the code will just sit there afterwards not really gathering much direct benefit from such conversion.
-
Well, I am not a programmer. I have a diploma in IT but not in computer science field. I am more like a designer but I know some server side stuffs like MySQL and PHP (Procedural). I am making a website where people will share texts. There will be registration and login, then the user account where the user can edit his/her account settings and delete his/her text uploaded if he/she wants. There will be a form to post the texts. There will be a pagination. Of course, all will be in database and with security. I know many will say OO is better etc...bla bla bla. But the website I will make is not huge or complex like Facebook, Amazon or even other bulky websites. So, I can go with Procedural? By the way, Procedural is not dead, in fact it is still used more on medium-sized application. It is not a matter I do not want to learn OO, but, the website I am doing is not huge at all! Some functions that's all, and I dont have an issue to update the codes. In fact, it will not be updated too much. Your opinion?