Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualLorenzoGatti

Posted 25 December 2012 - 02:05 AM

What exactly is ugly and cluttered? Can you point out some part of your code that could be rewritten in a better style? What would you need to change to make that better style possible?

The only generic advice that applies to your high-level and fairly vague description is that using functions to display different page bodies in a single PHP file is unnatural; you can use different URLs for separate PHP pages and use templates, inclusion of page parts etc. to minimize duplication. A natural page-oriented structure lets you write more reusable functions: for example, not a presumably large and brittle displayInn function that builds most of the page but many small single-responsibility data accessors and modifiers like listInnGuestNames or getInnBeerPrice or reserveRoom that can be easily used in forms and templates.

#1LorenzoGatti

Posted 21 December 2012 - 03:16 AM

What exactly is ugly and cluttered? Can you point out some part of your code that could be rewritten in a better style? What would you need to change to make that better style possible? The only generic advice that applies to your high-level and fairly vague description is that using functions to display different page bodies in a single PHP file is unnatural; you can use different URLs for separate PHP pages and use templates, inclusion of page parts etc. to minimize duplication. A natural page-oriented structure lets you write more reusable functions: for example, not a presumably large and brittle displayInn function that builds most of the page but many small single-responsibility data accessors and modifiers like listInnGuestNames or getInnBeerPrice or reserveRoom that can be easily used in forms and templates.

PARTNERS