Career Home Lance Sander Portfolio
Lance Sander !Blog This

Welcome to Lance's blog!

[Login]
Recent Comment Activity
· Welcome! with a comment by Stranger 2008-06-26 09:12:26

<<-- <- Viewing 1 to 3 of 3 -> -->>
Syntactical Candy 2005-08-19 12:19:33
Alot of people don't like "Syntactial Candy" but I think it's a good thing. I like Syntactical Candy because it creates self-documenting code. For example let's say I want allow a block of code to execute that processes a form if the variable $name is complete, $address is complete and $phone is complete.

That might go something like....
if ($name && $address && $phone) {
//----->process form
}

Using Syntactial Candy we can clean our code up and make it more readable. Here's my example using Syntactical Candy...

$isFormComplete = $name && $address && $phone;
if ($isFormComplete) {
//----->process form
}

Voila! See what I mean? This is a very simple example but when dealing with large blocks of code that have huge logical consquences it's very helpful. If you're really fancy, you can use functions instead of variable-flags.
0 Total Comments
Last 0 Recent Comments!

OOD vs. The Web 2005-06-16 18:50:41
This is a classic problem that I encounter time and time again. It's a problem of good theory versus practical use. Everything I'm referring to is in a PHP/MySQL environment.

Let's take a look at the basic parts and assemblies problem. A particular master part has a bunch of child parts, which in turn those child parts can have more child parts.

Now, let's say you wanted to tell a part to get ALL of it's child parts and each child part needed to get all data pertaining to itself. That might go something like this.... 1) Master Part (Get all child parts) 2) Child Part (Gather all information about thyself) 3) Child Part (Get All Child-Parts) 4) Repeat 1,2,3 if necessary. Here's the dilemma, you want the parts to perform the operations themselves, you don't want some rogue function to *reach* into a part's data and pull it without the part getting the data itself. Ideally, each part would get the data itself.

Now suppose if the master part has 50 child parts, and 20 of those child parts have 10 more additional child parts, you're now running ALOT of queries which can be disastarous on a database.

In theory it's the right way to solve the problem... but then you start looking at the problem and realize... I can get ALL of this data with 1 QUERY!!!. Great, so now you've found a practical solution that works great but violates every object it touches.

What to do!?!??! *sigh* I usually write this violating query 1 time and build as many interfaces to it as I possibly can. This minimizes the violation of the objects, but still allows you to take advantage of the brute force you need.
0 Total Comments
Last 0 Recent Comments!

Welcome! 2005-05-25 17:26:00
This is an example of my Blog Project.
3 Total Comments
Last 3 Recent Comments!
· A third.
· A second sample.
· A sample comment.

<<-- <- Viewing 1 to 3 of 3 -> -->>
Trace - Blog Application has a Valid Blog Request