GhostMVC

From Adam Colton
Revision as of 19:53, 14 March 2012 by Adamcolton (talk | contribs) (→Core)
Jump to navigation Jump to search

GhostMVC IDE

Core

Use a profiler on some basic pages to see what takes the most time. Any improvements to the core could be substantial.

Add subdomains to usable data

change print to echo, change double quotes to single

look for variables that can be passed by reference

Add a wildcard character to routes to limit to exact match (no trailing data). Use case: if I want to route all traffic of a certain type from [SiteRoot]/[Model] to a specific function (other than index) I cannot because it will still match [SiteRoot]/[Model]/[Method].

Hook for libraries to call when they are loaded and when the call is closing (after the "after" hook).

Move Home_Controller, Defualt_controller and Default_method to hooks

Add useful errors:

  • When including anything, do a try

After the route has been determined, clear out the route object to clear up memory.

For routes add a PostArgs and a GetArgs which validate and map together. Combine the method and controller calls. If method and controller are left out default to controller->_method

Libraries

Look into memcache, output buffering

Database

  • Finish 'having' functions in database library
  • Update database library to throw useful errors
    • data array is not included in update
  • Database to support limits
  • Multiple inserts
  • Database row and row_array (only returns one and auto-adds "limit 1")
  • Find a way to make database connections persistent in such a way that the user can have several, they will open as needed, close (via hooks) and can be used for mysql_real_escape_string.
  • Database Where to accept associative array or key value pairs
  • Allow subqueries using Database library objects.
  • Store all the values and run mysql_escape against them right before the query is run.

(this requires the the library hook in core) Have the constants defined with tails so that MYSQL_HOST becomes MYSQL_HOST_DEFAULT allow a range such as MYSQL_HOST_QUIZ, MYSQL_HOST_JOURNAL (using Moon-Jumper as an example). User the constant function (http://dk.php.net/manual/en/function.constant.php) to dynamically access them. Store each connection persistently in an array indexed by host and user, then close all the connections when the request finishes (or allow the user to manually close the connections early).

Parameterized SQL

Use PDO. Seems simple enough, put ? where user data goes then bind data to position. The important (and tricky) part is keeping the data in order so that it will line up with the correct position. http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/

http://projects.adamcolton.net/pdo/

Layout

Need to finish (and touch up) the html class.

I've considered using Regex for php templating (preg_replace or pret_match_all) "/{(\w+)}/". The problem with this is that we have to move linearly through the template string. This would be a lot easier (and cooler) if I could capture std_out as a string, then I would not have to guarantee linearity.

Resolve in views how to display many one-to-many relationships (or deeper). Some sort of nest array thing might work; instead of passing in a view, pass in an array of view, but then I need some way to package the data so that it's still usable. It should also map easily to the database utility.

Look into strtok for templates

BUG: if the very first thing is a token, layout doesn't detect it

Validation

Add phone numbers, sql-scrubbing... Look up common regex patterns and add those in. Some sort of a mass form validator would be nice, with the ability to pass back an array of errors.

Utilities

Edit

Add 'New' buttons to model, view, controller and resources in Edit utility.

Move this into a more IDE like environment with the files in an UL on the left and the editor being tabbed (possibly split-able).

Test Framework

Good base class, need to rename a lot of the methods to follow the camel casing that I choose. I also want to finish turning this into a real test interface where I can run a subset of tests.

For a first step, I would like to detect anytime a model or test is updated (by last modified date) and automatically re-run the tests when it changes. This way, every time I upload code, the unit tests will be run automatically. This could be very cool because I could set up the page on another computer or a tablet and it will provide feedback while I work.

Form Utility

Form builder utility. Select the controller, name the form (used as function name, view name and form id), add inputs and select their type. The utility automatically stubs out the view, both controller methods (name and _name) and the submit hook so that the post variables are passed as arguments.

Publish Utility

Use FTP to publish to another destination. Needs a process for 'popping' configs off a stack. Allow user to show all files, different by date, different by size and both. Use this (http://scrivna.com/blog/php-file-diff) to show the file differences.

Database

Add modify table to database utility

Move the whole thing into more of a tabbed view (rather than modal). So that you can see each table, keep queries that you've run around. A query builder would be nice.

Allow Database::select to be used for where_in.

For debugging, create a logging option that will store all queries in a log.

Installer

This needs to be updated and I really need to give some more thought to the user module. Also, might be nice to include some other modules (though I don't know what).

Module Names

One principle I like is to give things gibberish or unrelated names rather than meaningful but generic names (think about Access, it makes searching and naming difficult). For that reason I want to pull in names of ghosts and ghost-like things to name them.

  • Test Framework - Osiris (Egyptian god that tests spirits for the afterlife)
  • Jacob Marley (ghost from A Christmas Carol)
  • Casper
  • Banshee (wails when someone is about to die, maybe an error catching framework)