1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need some advice with web interfaces and databases

Discussion in 'PHP & Perl' started by sfidirectory, Sep 16, 2011.

Tags:
  1. sfidirectory

    sfidirectory Senior Member

    Joined:
    Mar 29, 2010
    Messages:
    899
    Likes Received:
    483
    Occupation:
    Web developer/BTC enthusiast
    Location:
    php artisan make:migration
    Home Page:
    Hi everyone,

    I have been studying relational databases for a few months now (have learned components like E.R.D diagrams, cardinality, optionality, primary and foreign keys etc) and am wondering is it best to create the database first or the web interface first? I am in stage 2 of creating an auction site and am wanting to create a form where the user can create an auction.

    Note: by "web interface" here I am referring to the form that will be gathering the information to be inserted into the database. I am working with MySQL...

    Thanks in advance!
     
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    Assuming you know exactly what you need to do in terms of functionality, it does not matter either way.

    For convenience, I prefer creating the db first.
     
  3. xpwizard

    xpwizard Junior Member

    Joined:
    Nov 6, 2010
    Messages:
    198
    Likes Received:
    122
    I agree with jazzc. I prefer to map the DB first so you get a feel for the project before you start.
    Also, when it comes time to add a new function, it's always easier to add a new column/table vs changing the front end code;)
     
  4. xenon2010

    xenon2010 Regular Member

    Joined:
    Apr 27, 2010
    Messages:
    231
    Likes Received:
    48
    Occupation:
    web and desktop apps programmer
    Location:
    prison
    Home Page:
    its by logic... you must design the database first then connect it with the application later.. that's how I always do it..
     
  5. fimms

    fimms Junior Member

    Joined:
    Apr 30, 2009
    Messages:
    178
    Likes Received:
    59
    Location:
    Fineland
    Home Page:
    If I have an idea of app already, my first step would be to write basic functionality to the paper/notepad, use cases, sequences, actions and views I need. Sometimes its very freestyle writing, just putting things on groups. Then I'm going to models and once basic models are done, then design database. At this point there is interexchange between designing models and database if you are using relational database compared to key-values stores, that gives you more freedom. But it really depends of the hierarchy, links between objects and especially type of data you deal, what kind of database you choose. Are you sure you are pro relational databases like mysql? ;)

    But after this is done, I try to jump on interface designing (browse themes, connect screenshots to the hard drive). I try to do mockups & layouts as soon as possible so I can see some progress on the project, have flesh over the bones so to say. Usually all three parts are going hand in hand here: UI, model and database.

    Its also good idea to have a solid plan for testing procedures on site. You want forms, navigation and links work and tested all the time.

    After this said I have to say, sometimes I still start doing layout first because it gives you clearer vision of the future and may inspire you doing great functionality that supports sleek user experience. It may depend on your own preference and of course team, if you are not working by yourself.
     
    Last edited: Sep 18, 2011
  6. simpledev

    simpledev Newbie

    Joined:
    Nov 10, 2009
    Messages:
    3
    Likes Received:
    0
    Occupation:
    web developer
    Location:
    Portugal
    Well, first of all let me say that I don't use MySQL anymore. I've completely moved over to MongoDB and addopted a noSQL way of work. But! I've used MySQL a lot. It actually doesn't matter if you're working with a relational database, this or that language or building a wood bed with saw, hammer and nails. You HAVE to plan ahead. You need to invest time in planing. It's mandatory! You have to think your app and plan. And the base of all applications is your data. Data management and storage are the heart and the fail point of every app. Write your db layout first. Don't think on every field possible. Just write the table names. Then think about yout app. eash screen. And whenever you feel the need to an extra field, add it to your table and write a comment about it. You should take a day or two (or a lot more, depending on the app size) developing you database offline. Don't be affraid of paper and pencil. They are your friends. Then rewrite it to the computer screen thinking about what your typing. It gives you fresh eyes on your design. If you code with someone else, let him type your part of the db and type his(hers) part of the db. argue about the design. correct mistakes and dups. argue some more (it's more productive if you do pair coding). clean up. read it again. Argue some more. and THEN start coding. Although you spend more time arguing and writind a db design, you'll create the app in a lot less time. been there, done that :)
     
  7. jascoken

    jascoken Senior Member

    Joined:
    Nov 1, 2010
    Messages:
    1,135
    Likes Received:
    751
    Gender:
    Male
    Occupation:
    IT/Web Systems & Development...
    Location:
    Sussex:UK
    Logic dictates that you rationalise your data model first and then design your database.

    You may find you make some changes to the DB afterwards, but having put in the thought on how you're gogin to organise your data first, you'll find layout and interface design a lot easier.
     
  8. madoctopus

    madoctopus Supreme Member

    Joined:
    Apr 4, 2010
    Messages:
    1,249
    Likes Received:
    3,498
    Occupation:
    Full time IM
    ALWAYS architect the database first. A well designed DB is like having your app 50% completed. Starting with a well designed DB you know very clear what you have to do next in terms of interface and business logic.
     
  9. fimms

    fimms Junior Member

    Joined:
    Apr 30, 2009
    Messages:
    178
    Likes Received:
    59
    Location:
    Fineland
    Home Page:
    Nice to hear your workflows guys.
     
  10. criticalmess

    criticalmess Regular Member

    Joined:
    Feb 7, 2009
    Messages:
    237
    Likes Received:
    210
    Hey sfidirectory,

    Here are the steps in building a product (especially web based):

    1. General idea + detect the "killer app" (i.e. what is the key feature)
    2. Search the web for similar products, detect problems, features
    3. Flowchart(s), screens and features - use a wireframe program (example, balsamiq mockups) to create a mockup
    4. Come up with a wireframe document, something you can use as anchor (if you decide to outsource the project and/or if you want to remember "what the hell was I thinking" 2 months later...)
    5. Based on #4 - design DB architecture

    You can start with step #2 and I would suggest to create a mockup so you can test with friends (this is a valuable input that can save hours of work later on)

    Good luck

    critical




     
  11. EdgarFoX

    EdgarFoX Newbie

    Joined:
    Nov 18, 2011
    Messages:
    16
    Likes Received:
    2
    Personally agree with the biggest part of replies.
    Firstly, i format database on paper, so i can see the structure of the web.
     
  12. Lucacri

    Lucacri Newbie

    Joined:
    Aug 3, 2011
    Messages:
    37
    Likes Received:
    2
    Yeah, definitely create the DB first. In that way you'll actually find out of additional steps your application will need to have
     
  13. upl8t

    upl8t Regular Member

    Joined:
    Apr 9, 2008
    Messages:
    475
    Likes Received:
    84
    Location:
    New Scotland
    I always create the database first. With query tools you can test all your inserts and queries before you build a single page.
     
  14. truelight

    truelight Newbie

    Joined:
    Dec 1, 2011
    Messages:
    1
    Likes Received:
    0
    Occupation:
    Programmer, Video Photographer
    Location:
    Dhaka, Bangladesh
    Home Page:
    Measure first how many types of information you need to store in db and design database based on that. You may need different tables for different types of information. (simply you need tables: users, auctions, bids, etc.)

    Make forms and scripts to save info to related tables.

    Then the final part is to make some reports based on your plan to show info to different types of user. You will need session variables to manage security.

    If you need help to design the db, please share some more info of your application.