Question

I have some problems and I hope you will understand me and what I want and I hope you can help me. So, I started to program a project for many moths ago. I want to start a little gaming community. I read many tutorials, wrote many snippets and learned programming since I was 12. At the moment I'm 16 and I think there are so many things to learn. I don't want to say I'm a Noob and I'm not a Pro in Programming. But I programmed on this project more than 200 hours and I'm going to

If you are looking on stackoverflow, google, facebook, pastebin, and every other big site - You get mad about your own homepage. Im not happy with my own homepage because its NOT structured and good programmed. Maybe I should learn OOP and use mysqli. But the problem is, I don't want to learn OOP because I don't understand it.

I just want to finish a project, because I never did it.

SO MY QUESTION IS: What should I do? What should I do for getting a good code structure? Is it useful to write a template with placeholders and replace them later by a rendering function? I want to work with GET params, I want to change the content dynamicly. Functions like a PM system, comment system, posting system - Useful to write them in functions() or maybe its better to write them in files? And - How to call them right in the template and how to load the template right? (file_get_contents() / require() ).

There are so many questions but I still learned this with tutorials.

HOW I SHOULD START NOW?

I think its useful to write a template engine but how to write them write? Any ideas of what I should to now? And how to write secure functions and call them write with your own functions?

regards

Was it helpful?

Solution

It seems you want to write your own framework/engine. Ok, there will be purists here who say you should use an established one (off the shelf) but actually the practice of doing this helps you learn a lot about the process and the work involved.

So what should you do? I would you start by identifying the common components, breaking these out to modules you can then include across all parts. OO teaches us the building blocks of code and how to do this approach, so if you do not study this methodology you may get a bit stuck.

Maybe your page/site uses a top/middle/bottom (Header, content, Footer) and these can be broken out to a common file to be called back as objects?

class common
{
    public header()
    {
      print "<html><head><title>My Site</title></head>";
    }

    public content( string )
    {
        print string;
    }

    public footer()
    {
        print "<p>The footer of the page</p></html>";
    }
}

So considering my pseudo code above, you could use:

my $page = new common();
echo $page->header();

my $copy = "The quick brown fox jumped over the lazy cat";
echo $page->content( $copy );

echo $page->footer();

Yes this is PHP notation :) a simple framework like this will lead to more complicated issues to resolve, but the core to completing the MVP (Minimum Viable Product) is your discipline.

Try not to get it perfect, get it functional. Once functional, no matter how hacked/bodged, you can evaluate the bad bits and refine. By the sounds of it you are trying to rework existing code and remodel the code and implement best practices, do one - not all.

Purists would argue with me that you should plan your layout and functionality and start from this plan. But you are half way through already right?

Just break it down into small steps, you can do it, I think all the coders here have faced a pet project like this at some stage :)

Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top