Wednesday, October 22, 2008

The Database

When re-writing a project that you've already done it sometimes gets difficult planning out the entire project in your head. This is easy to do with smaller projects, but when you are working on something that manages multiple sites, employees, users, products, orders, email, reports and accounting, things can get a little hectic at times.. especially when you've put hours into something and have to re-write it or hack it to death to implement an overlooked feature. Welcome to programming! Just like the first photoshop job you did, looking back on old work is hard and sometimes down right scary.

I believe the first thing to be considered when starting a project is your database. It most likely will containing every bit of data you will be outputting to the user and it only makes sense to satisfy the needs of correctly storing and handling it. Once you have thought out your database tables and fields, the next step is to fill your tables with test data.

One thing I have learned over the years is, NEVER EVER WRITE ADD/EDIT FORMS FIRST!! It is far easier to use phpmyadmin to load the database with values to test things than it is to have to keep going back and forth editing your form html and form logic pages. Once you have the data successfully stored, create a way to display/edit and then finally add your data. This has always saved me time, try it yourself.

I was just bored and thought I would write something

Sunday, October 19, 2008

Updating Old Code

The time has finally come. A custom CRM that I developed for a company about 5 years ago needs to be completely rewritten. You might say that at the time of writing version 1.0 I was a bit of a newbie. I didn't understand Objects, I was still designing in tables and my CSS abilities were limited to in-line font modifications.

When I first opened up my code, I was immediately frustrated. I decided that as I go about writing version 2.0 I should share the experience.

The CRM has a couple basic sections:
  • Today Page
  • Orders Page
  • Address Book
  • Messages / Notes
  • Sample Requests
  • Mass Mailer
  • Report Generator
With new features planned for v2, I need to get v1 code ported to prettier code that I will feel good about calling v2. This requires re-writing all the MySQL tables and updating all the old MySQL queries to take advantage of join optimization, separating the logic from the presentation and from the data, re-designing the CRM with divs and smarty, and writing scripts to convert the old db to the new db.

I will be doing lots of posts as there is a lot to do. I will report in daily.