anatak Posted December 25, 2007 Share Posted December 25, 2007 Here is my situation. I built a website I used a lot of functions. started messing with objects Remembered my OO course (Java) read the OOP tutorial (learned some new stuff since I learned Java way way back ) Now I am confused as how to design a website with OO. I just can't seem to get my head around how to start. I was thinking about making a class called webpage or website in webpage would be two classes header and body header has some functions to get the HTML out body has three classes left, middle and right left will become a navigation menu middle will be the main content right will be a bar with sponsors, language selector, ... And then I realised that this did not look OO to me. I am sorry to make you all read this much but I am totally confused about how to start building a OO website Any hints as to how to start the OO design will be very much appreciated. anatak Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted December 25, 2007 Share Posted December 25, 2007 Have you tried taking a look at the MVC, model-view-controller, pattern? The controller processes user actions, the model handles the data and the view handles the view/template. You can check it out on Wikipedia and there are a couple of links in the resources topic regarding the MVC pattern. Personally I found that the easiest way to grasp this pattern is by taking a look at frameworks which utilize it. Examples of such could be CakePHP or CodeIgniter. Quote Link to comment Share on other sites More sharing options...
awpti Posted January 3, 2008 Share Posted January 3, 2008 If you can't wrap your head around the concept of OOP, you probably shouldn't even consider using it. The real question is: Will I benefit from Object Oriented Methodologies? If your answer is "???" or "No" or "I don't know", then don't bother. If your answer is yes.. Definately take a look at CodeIgniter. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted January 3, 2008 Share Posted January 3, 2008 How can you possibly answer that question if you don't know what OOP is all about? Quote Link to comment Share on other sites More sharing options...
teng84 Posted January 4, 2008 Share Posted January 4, 2008 How can you possibly answer that question if you don't know what OOP is all about? Quote Link to comment Share on other sites More sharing options...
stelthius Posted January 4, 2008 Share Posted January 4, 2008 only one way to learn dont fault a man for trying good luck with it mate! Quote Link to comment Share on other sites More sharing options...
anatak Posted January 6, 2008 Author Share Posted January 6, 2008 will I benefit from an OO approach yes I think I will since I found out that a lot of my code is very similar to each other. rewriting that into OO will be more efficient since I can extend classes. the way I will go about this is that I will adopt a mixed approach. most of my functions will be rewritten in classes the reason is that a class is much easier to modify later than a function (IMO) and that I can extend classes and thus reuse code easily and that the changes (hopefully improvements) made in the parent class propagate into the child classes. If you can't wrap your head around the concept of OOP, you probably shouldn't even consider using it. No I still don t see why it should be fully OO since that is not more efficient. Yes I can wrap my head around OO it is not that difficult I think. It is just a different way of working / thinking. I worked on some OO projects and I see the benefits for large programs. I just don t see the benefit of using a class to write say your header of your webpage unless you are making a lot of websites for people and then of course you can have a benefit. (not my situation) thanks for the reactions so far and I will look at the frameworks soon to get a better idea. anatak Quote Link to comment Share on other sites More sharing options...
DyslexicDog Posted January 6, 2008 Share Posted January 6, 2008 No I still don t see why it should be fully OO since that is not more efficient. Yes I can wrap my head around OO it is not that difficult I think. It is just a different way of working / thinking. I worked on some OO projects and I see the benefits for large programs. I just don t see the benefit of using a class to write say your header of your webpage unless you are making a lot of websites for people and then of course you can have a benefit. (not my situation) I think you answered your own question right there. One of the reasons for using Object based programming is code reuse ability. Not only in a single program but also in other programs. While Object programming can be helpful in one website / program it really shines when used for a base of several programs. i.e. CakePHP, Code Igniter, ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.