Designing PHP applications

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm planning on writing a PHP application (more specifically, an image
gallery application). How should I *design* this application? How would
installation be handled? Plugins?

How would the core be structured? I'd imagine that at least the frontend
would use some kind of MVC system.

Re: Designing PHP applications

On Tue, 10 Feb 2009 16:18:28 +0200, Sweetiecakes wrote:

Quoted text here. Click to load it

Your questions are far too general.

"All right, all right, if it will make you happy, I will overthrow society."
  - Philip J. Fry

Re: Designing PHP applications

Quoted text here. Click to load it

So give the OP a general answer:

"How should I design this application?"

"Very carefully"

Seriously, software methodology is your friend here.  Start with a
series of features and functions you want the software to do.  Fill out
how they'll do it from the end user's perspective.  Write it all up.  
This is called a Functional Specification.  

Then start figuring out _HOW_ you're going to implement the features.  
That's the design specification.  You've jumped to design without really
thinking (or at least saying to us) what the application will look like
or do.  An image gallery application can be implemented any number of
ways.  iPhoto's interface comes to mind.  Or Google's Photos.  Or
Shutterfly's browser.  Whatever.  And you might want to think about
capacity.  How many photos?  And don't say unlimited unless you REALLY
don't care what it costs.  Think of the cost coming out of your
bloodstream drop by drop rather than your wallet.

You've done what every beginning programmer has done--jumped to design
without throughly specifying and defining the problem.

DeeDee, don't press that button!  DeeDee!  NO!  Dee...
[I filter all Goggle Groups posts, so any reply may be automatically by ignored]

Re: Designing PHP applications

Quoted text here. Click to load it

This the traditional approach - but just because its oldest method
doesn't make it a bad thing.

Another approach is to write up a lot of little stories about how
users would interact with the system (use-cases). e.g. (this is a very
high-level and you should develop these much further before writing
any code).

Fred wants to store his photos on a remote site in case the hard disk
in his PC gets trashed. He takes about 100 hi-res photos a month.

Jane wants to share her photos with her friends - she wants to set up
seperate galleries for her work colleagues, her drinking buddies and
for her family - some photos will be uploaded to different galleries.
She wants to make it as simple as possible to allow people to see the
photos but wouldn't want her boss to see some of the photos of er

Regardless  of the approach you take, you should always start with
writing down what the system should do.

Quoted text here. Click to load it

You've got this back to front. Design patterns are teaching tools -
you write code to suit your purposes, and once written, it will
probably match an existing pattern - you don't start by making your
problem fit the pattern.


Re: Designing PHP applications

Sweetiecakes wrote:
Quoted text here. Click to load it

Er..write down what it is supposed to *do*, and what it is supposed to
*look* like, for a start?

Quoted text here. Click to load it

? what ?

Quoted text here. Click to load it

You've lost me there..core? MVC? have you been browsing the dictionary
of buzzwords?

Re: Designing PHP applications

Sweetiecakes wrote:
Quoted text here. Click to load it

The same way you design any other application - one step at a time.

One way: determine your requirements - what you want it to do.  Lay out
some pages (don't necessarily use HTML - just pencil and paper can
work).  Go back and refine your requirements based on your layouts.
Code your user interface as static pages to get your presentation layer
down (be sure to comment heavily as to where you'll need to insert code!).

Now design your database (or other file storage).  Code the back end
based of your app based on the database and pages.  Finally, add your
code to the static pages you wrote above.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Designing PHP applications

On Tue, 10 Feb 2009 16:18:28 +0200, Sweetiecakes wrote:

Quoted text here. Click to load it

Take a look at the project Symfony:

This is an excellent MVC framework with an excellent application


Re: Designing PHP applications

Sweetiecakes wrote:
Quoted text here. Click to load it

Your questions , while valid , are too generic to be given a simple answer.

I'm not an expert , However i have been through this myself.

About a 2 years ago I suddenly decided that I wanted to make a phpbb
like forum with blog and wiki elements in it. I never made anything
bigger then a simple posting / email form before.

  I went and got some books  for reference , php cookbook, teach your
self mysql , learning xml, mastering regular expressions , etc.

Since I wanted to make something like phpbb ( version 2  at that time )
i spent almost 6 months pulling phpbb apart ,making database
relationship charts , so i can understand how the data was being stored
and the complex ( to me at the time ) relationships between tables etc.

I then spent most of my time writing code that mimics phpbb smaller
operations, since i couldn't follow most of the code in phpbb.But in the
end I had a good idea how forums worked.

I did the same thing for some wiki systems and the php cookbook even had
an example of a flattext wiki for me to draw apon

So now after all this time I have a alpha system that almost does
everything I want but it still hasn't been all tied together yet.

So my advise to you is
1. write down a short list of features that you want you app to do , and
i mean short. ( Setting goals )
2, look around to see how other people have done each of your features,
and get a idea how its done ( education )
3. start a BASIC version from there. ( development )
4. don't give up , if something you've done doesn't work , ask for help.

programming a application is a dynamic process and you can fail many
times before something emerges that looks like a working app.

I suggest you get some books ,there are some good books out there for
project design and planning ( generic not programming related ) that
will give you the tools you need for planing.Programming reference books
also are priceless , as they can often provide glimpses of the smaller
requirements for your application.

regards trookat

Re: Designing PHP applications

Quoted text here. Click to load it

The type of advice would depend much on your programming background.
For example, if you're new to PHP, but have been a C++ and C# software
engineer for years and years, then the advice would be PHP-specific.
Since that's the least likely scenario, let me start at the other end
of the spectrum.

Start by FORGETTING about PHP and learn about software development in
general. Two areas for immediate study...

1) Unit testing. This will save the life of your project, and once
you've learned how to do it, you won't want to program without it. One
of the best unit testing tools for PHP is NOT the one built into the
PEAR library, but this one (it's free)...

2) Learn to document your code... HEAVILY, with clear reference to
what each function and each variable is supposed to do. As things get
more complex, you'll be grateful for the notes when you're trying to
figure out what your own code was supposed to do in a certain section
(not to mention trying to understand the code of others). As an added
bonus, when your documentation is structured and organized, the better
editing tools can read your descriptions and use them as pop-up "code
helper" when writing new code using that function, object, etc. Have a
look at...

And an IDE that makes good use of PHPDoc-style code syntax (also
free)... /

Use a version control system. If you're on a Windows box, then
Microsoft Visual Sourcesafe is probably the easiest to learn to use...
it's also the priciest solution, though. Again, open-source comes to
the rescue. Have a look at CVS. CVS is a two-fold procedure, client/
server, which may or may not be on the same machine. For personal
development you'll want both. For Windows, you'll want a CVS
interface. These links are a good start... / /

With all of the above tools at your disposal, it's time to look at a
framework. Not only to investigate the basic needs of a web
application, but you may very well decide to actually USE a framework
rather than re-inventing the wheel. For instance, at the very least,
it sounds like you're going to need a system that allows people to log
in. For that alone you'll need to consider all sorts of things like
(1) how to determine if a visitor is logged in, (2) how to keep the
log-in information relatively secure and difficult to hijack, (3) a
sign-up/registration prodecure for new users, (4) a password-recovery
method, (5) an email system for sending out the notifications (at a
minimum), with some type of throttle and queuing in place so that you
don't exceed the maximum email sends per your web hosting contract and
end up getting on all the anti-spam lists as well as possibly having
your account blocked by your server. Not likely until you get LOTS of
traffic, it's true, but better to plan for success than plan for
failure, right?

Here are some frameworks... (my favorite, mainly because it's lightweight
and has great documentation) /

You might even want to have a look at the code of an open-source
content management system, expecially one that has a gallery module...

Once you've got all of THAT down, you might want to have a look at
programming methodologies (the word alone is scary) that make a use of
theme. Something like Agile Development or Extreme Programming (the
latter is most useful when working with a team).

Just my 3 cents (inflation, you know)

Re: Designing PHP applications

Quoted text here. Click to load it

Thanks for the links.  I found them all informational.  CodeIgniter's
documentation is not only good but the web app that displays it is one
of the best interfaces I've ever seen.  Which, unfortunately, is quite
misleading if you believe that it was written entirely using
CodeIgniter.  Most of it is javascript, using several third party
libraries.  CodeIgniter itself has no javascript, going so far as to
do form validation on the server!  Now, as a fairly advanced PHP and
javascript programmer, I can definitely see the value in having a
lightweight PHP framework that generates no javascript but it is
definitely not something I would recommend to newbies.  All you have
to do is click on the links to sites that have been constructed with
CodeIgniter to see how little can be done with it out of the box.

Quoted text here. Click to load it

Yuck, yuck, yuck.  A php clone of Ruby on Rails and we all know where
that will get you.  That and $2 will get you subway ride (inflation
you know.)

I know nothing about drupal but I will be following that up.  I can
attest to Komodo and Tortoise as both being excellent products.  As
far as unit testing, I find that I don't have the temperament for it.
I am going to have to force myself to use it but since most of the
truly bug-free, complex software I have seen written has made use of
unit testing, I will undertake to use it myself.


Site Timeline