Random user generation - optimized
June 27th, 2007 by Aaron
I came across this blog posting about optimizing order by rand() and decided to make my queries better. Here is my real life example on how to optimize this query:
Continue reading Random user generation - optimized
AJAX Security Research and Findings - Round 1
June 27th, 2007 by Aaron
(”the triangle”) wants to keep implementing more and more AJAX based systems - but no one ever took time to research into the security issues with this. I did a proof of concept one time with a zip-code function when Big Boy was working there, and from there, they just thought it was amazing. Most recently, some AJAX functionality was proposed for our LIVE public web servers… but I was very hesitant. I don’t know enough about the security and best practices for AJAX requests to be able to securely design and code something for the internet - especially when the end result is connecting to the iSeries and HIPAA data. I requested a research project - and its finally been approved. I’ve spent a few hours and come up with a few ideas and best practices so far. Ok, I’ll be honest, one best practice and 2 ideas - of which I’ll prove/disprove here:
Continue reading AJAX Security Research and Findings - Round 1
Emulation of Collections - true stories of data object handling
June 26th, 2007 by Aaron
Today, Big Boy sent me an e-mail at work talking about emulation of collections in his .net programming. He included a code sample (after the break). This got me thinking about how I am planning on handling data going forward. Do I want to handle data as keyed arrays, objects, complex objects, or… ? Additionally, I started thinking about the Null Object programming pattern, and how this can fit into my data handling pattern. I’ve made an interesting discovery - and am going to set my paradigm going forward using these complex objects. Heres how…
Continue reading Emulation of Collections - true stories of data object handling
When to be OOP - and how much… Lesson Learned!
June 25th, 2007 by Aaron
I just finished reading a snippet of a book about design patterns - of which Strategy, Adapter, Decorator and others were discussed. It got me to thinking about my design patterns that I used in JEMDiary - and what I’ll be using in this project.
The trouble comes when you start trying to figure out how implicit and explicit your OO design should become - for example, do you create a new object and rely on it to bring in its own db connection (and tightly couple it) or provide more public methods for it to explicitly create itself, passing in a db connection that hits an interfaced class instead. Do you use the many strategy type patterns and keep a more loose architecture, or be more specific to yoru project and make it possibly more private (and more efficient)?
Well here is what I’m going to do…
Continue reading When to be OOP - and how much… Lesson Learned!
Load Time Analyzer for Firefox
June 24th, 2007 by Aaron
So, I started looking at a few load time analyzers for my sites - and I found an interesting plugin for firefox. I wasn’t too entirely sure what I was going to find - but I figured I’d try it out and figure out if it was useful.
My test site will be JEMDiary - mainly because I know ALOT about it.
I could have used a local website, I’m sure - but a remote site was going to give a better load time analysis. JEMDiary’s homepage is a static HTML file (generated periodically behind the scenes). It loads a few external js and css files, and a set of images as well. The images in the images directory send headers to cache themselves, and so do the css and js files (interestingly, if the front page had specific profile images, they would not be cached…) At any rate, I wanted to test a fresh load on the site, and then a cached one - and see what I can determine from these load times.
Lets go…
Continue reading Load Time Analyzer for Firefox
I am a Zend Certified Engineer
June 22nd, 2007 by Aaron
I just wanted to point out that I am the worlds newest Zend Certified Engineer - as of this morning at 10:00a.m. CST. PHP 5 ZCE ![]()
PHP5 Object Oriented Properties - Tested!
June 21st, 2007 by Aaron
I was recently reading an article (while researching for my website monitoring project), and there was a comment about PHP5’s lack of flexibility in its Object Oriented usage. Some people were arguing for it - and some against, the typical ranting that goes on in blog comments, etc. Instead of joining the argument, I wanted to do my proof of concepts myself. I’m going to explore (well I already know some of the answers - but it’ll be exploration to YOU reader ;)) public/private constructors, magic methods, and maybe a few extras (we’ll see when we get to the end!)
I’m using PHP 5.2.0 on Windows XP for these tests.
var_dump() will be our friend
We’re going to use var_dump() to demonstrate all of our properties - its the best printable version of testing I’ve found so far.
So without further rambling, lets get started with … private constructors
Continue reading PHP5 Object Oriented Properties - Tested!
Make interfaces Useful, not featureful
June 19th, 2007 by Aaron
There seem to be two schools of design lately: Feature rich, RIA designs and simplicity.
There seems to be confusion over what is the right way to design a website or… for that fact, a user interface. With the technological abilities we have for interface design, more options are available. Because of this, we tend to think that more is better. There are others who ignore the fact that we have these advances, and go as simplistic as possible: two buttons and a form. I advocate for a compromise… let me give examples:
Continue reading Make interfaces Useful, not featureful
Planning for application development
June 17th, 2007 by Aaron
In my “younger years” in the coding world, I’d have an idea like I have right now with the website monitoring project - and immediately start coding. I’d get the framework done, implement a feature or two, and then finally start thinking about my requirements. Predictably, the code would turn into an unmaintainable mountain of crap - and I’d be wasting more time rewriting and refactoring than I wanted. For this project, I decided to take steps against this happening.
Continue reading Planning for application development
Test Driven Development Book Review
June 16th, 2007 by Aaron
(”the triangle”) just recently purchased a book for the library at my request, Test-Driven Development by example by Kent Beck. The current Amazon price for this book is $35. The book took me about 2 weeks of sporadic reading to finish. The first section took the first week, the remaining 2 sections and appendix flew by.
This book is an easy reader.
While it is a technical concept, the author writes in a conversational way - which is helpful when you’re learning new concepts. He also makes jokes from time to time, and relates his writing to his previous development experiences. Since the ideas were new to me, this type of writing had more of a personal test and was able to ease along that “horrible” process of learning something new.
After reading this book, I have a handle on test driven development.
I’ve heard of it before, specifically with PHPUnit and JUnit (Somehow, that makes me wanna scream like a fiddy cent lover, G-UNIT!). I had, however, never used any of those frameworks. A few open source projects I’ve come across had their testing suites online with progress indicators (ie: 90% of our tests are green in this development branch), but I never knew what they were actually talking about. After the first section of this book which is littered with examples, I was able to get a handle on the value of this. I still had questions about practical implementation, but I was actually looking forward (I KNOW!! what???) to reading the next sections for some practical advice and design patterns.
Practical Advice and Design Patterns were lacking in this book.
I was looking forward to the practical implementation - but those examples were between Python and Java - which maybe I missed something in the reading - but he seemed to switch back and forth between those two languages without a hint. That made the thought process a bit more convoluted. Additionally, the design patterns seemed more programmer-school-college-boy and not real life descriptions. For example, talking about a value or null object just didn’t seem to have alot of real world implementation in what I do… but that brings me to my next point:
This book was more valuable to native java programmers, and maybe less to languages with their roots in scripting.
I’m a PHP programmer by trade - but I use both the top down and object oriented development features. However, being a PHP programmer for so long, before they had object support, alot of the concepts of simplification, removing duplication, etc, were already notions I had deep within my programming techniques already. I noticed alot of patterns from normal java programmers being modified in this book - so as to simple down some of the object usage … and make a more testing compatible flow. The last few sections of the last part of the book were pretty much useless for me - they were very abstract theoretical thoughts on patterns. While this may be valuable for some people, I’m more of a by-example and hands on learner.
My final verdict:
How often I finish a book or article and think: “Boy, if I could just get that time back… what a waste.” This was NOT the case with Test-Driven Development by Example by Kent Beck. Two things really are notable about my experience: The first section’s examples and simpler look at the concept were extremely valuable into whetting my appetite for Test Driven Development and I’d have gained more value from a book based around PHP with the same concepts emphasized. I don’t know if I would have bought the book personally, but (”the triangle”)’s purchase of this was totally warranted (with their programming staff of about 25…).
As a side note: I plan to attempt test driven development with my website monitoring project - so watch for more real life examples and updates with PHP!
