Okay, I've started to hack my way through my last known frontier, software-development-wise. Database work. I don't particularly like it, but I need to get used to it.

My goal is to develop a straightforward web-based application.

I am finding a lack of suitable examples from which I can learn "best practices" beyond the barest fundamentals. I understand CGI. I have already set up my database. I know how SELECT and INSERT work. I understand one-to-one, one-to-many and many-to-many relations. I know what placeholders are, and how to use them.

What I don't know is how to architect the application which allows users to manipulate their own records and view others. What kinds of designs contribute to a hard-to-maintain soup of code. What kinds of designs end up hitting the bottlenecks by joining too many tables into queries. What kinds of architecture makes it tough to refactor the data design or the functionality without completely razing the database and starting over.

A brief outline of my desired project application's schema:

-- -- A database of "events" to which a community can contribute. -- -- There are three basic entities: events, agents, and blurbs. -- -- > An event is a unique point of data with a complex structure. -- > An agent is essentially a user who can log into the application. -- > A blurb is a text comment which can be attached to an event. -- > Blurbs know which agent added them. Blurbs can be edited later. -- CREATE TABLE agents ( agentid SERIAL UNIQUE, agent TEXT NOT NULL, biography TEXT, PRIMARY KEY agentid ) ; CREATE TABLE blurbs ( blurbid SERIAL UNIQUE, blurb TEXT NOT NULL, agentid INTEGER NOT NULL REFERENCES agents (agentid), PRIMARY KEY blurbid ) ; CREATE TABLE events ( eventid SERIAL UNIQUE, event TEXT NOT NULL, -- other fields of interest PRIMARY KEY eventid ) ; CREATE TABLE event-blurbs ( eventid INTEGER NOT NULL REFERENCES events (eventid), blurbid INTEGER NOT NULL REFERENCES blurbs (blurbid) ) ;
At root, it should not be that much different from other content management systems like Slash or Everything or even iStockPhoto: users can view all existing entries, add new entries, and edit the entries they added. Each of those examples are crufty and incompatible, though. I want to implement my own for the sake of learning what architecture is effective and what is not, and I'm looking for clean implementations from which I could learn by example.

Most of the examples I have found focus on the basics which I already understand. I would like to find good standalone examples which are between 1000 and 5000 lines of Perl; meaty enough to get something useful about the architecture, not just the syntax to use the primitives. Examples which aren't based on editing purchase orders would be a plus, but maybe I'm asking too much.

I've selected PostgreSQL and Perl (DBI/DBD::Pg and CGI) and Linux, as they're the most friendly to my way of working at home. I know there are alternatives to these but that's not particularly pursuant to my question. I especially don't want to entertain arguments about the superiority or completeness of mySQL or PHP-Nuke or Zope or Java, thanks. ;)

--
[ e d @ h a l l e y . c c ]


In reply to PostgreSQL web application examples? by halley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.