Dependency Injection with PHP

Found this article while looking for an open source Dependency Injection engine for PHP.  The grammar needs a little work but otherwise it is a really good summary of what Dependency Injection is and why programmers should use it.

In ColdFusion we use ColdSpring which is based on the Spring Framework for Java.  It actually does a lot more than just DI but I am not concerned about that.  What I really want is something that can handle the same kind of DI situations that ColdSpring does for PHP.  I am currently working on a WordPress plugin for a freelance client which has turned out to be the most heavily object oriented PHP project I have done so far.  I have been trying to translate a lot the best practices I have learned while working with ColdFusion over to PHP and came across a need for DI.  What I ended up doing is creating a Factory that handles all of my object creation just like what is mentioned in the article by Ryan on PotStuck.  I pass an array with all of my classes, their paths, and their dependencies, like so:

$classes = array (
	'EventBean' => array (
		'path' => 'model/Event.php',
		'dependency' => array (
			'Venue' => 'VenueBean'
		)
	),
	'VenueBean' => array (
		'path' => 'model/Venue.php'
	)
);

So far it is working pretty well but I am thinking about making a more substantial DI framework that I can use on many projects to come.

Retweet

Web Programming Presentation

I gave a talk at St. Cathrine University in St. Paul on the basics of web programming.  Really the basics of web servers.  The presentation is attached.

Web Programming Introduction

Retweet

Time for Something New

I new it was on it’s way out, but my Compaq Prisario v2000 finally died.  Just short of 6 years and showing the wear for it.  So I have moved on.

Meet the Dell Latitude e6400.  Not as stylistic as the XPS series but much more practical.  After having a laptop for so long I have discovered that the power of a desktop is no match for the convenience of a laptop.  But what to do with the quality peripherals I have acquired over time like my 22 in Samsung monitors.  Well… I have always wanted a docking station, hence the business class Latitude equipped with a docking port.

  • Intel Core 2 Duo T9900 3.06GHz
  • 4Gb RAM
  • Windows 7 Professional 64bit
  • 250Gb 7200rpm HDD
  • Nvidia Quadro NVS 160m, 256Mb

Now I can use my laptop as my primary machine while still getting the high productivity of having two monitors a full sized Keyboard and Mouse.

Retweet

Mass Effect 2

Mass Effect was a great game.  The game-play was good but the story was excellent.  Being a huge Sci-fi fan I have to say it had an incredibly compelling story.  So much so that it was often difficult to maintain the ‘completionist’ style game-play I usually undertake.  I was even able to see how the story took root from some other great Sci-fi novels and short stories.  Combine that with beautiful imagery and an extensive space travel simulation, it was hard to put the controller down.

A Sequel

I wasn’t exactly jumping on the opportunity to play Mass Effect 2.  Surprising as that my be given how satisfied I was with the first installment I just didn’t feel compelled to go out and get it.  Maybe I didn’t feel like I could justify the time commitment with all of the other things going on in my life.  Though after listening to so many people get excited about playing it (including my cousin who pre-ordered it for his PC) I decided buy it for my Xbox.

Advancement or Regression

So far the game has been… Ok.  There is no question that BioWare has made improvements.  However, there are a number of changes they have made that seem to be steps backwards not only in game-play but also from a Sci-fi tech standpoint.  My first example of this would be the weaponry.  In Mass Effect the weapons seem to be a very sophisticated technology that do not use ammunition but a kind of energy.  Firing the weapon causes it to heat up, and after firing many shots in succession the gun can overheat and requires cool down time.  This eliminated the need to practice ammunition conservation and allowed you to play the game however you wanted.  It also created balance with the biotic abilities which also required time to recharge.  Completely shifting game-play and making the soldier class a slave to ammunition availability, they have changed this in ME2.  Now the weapons still use energy based projectiles but rather than building up heat and needing to cool down they expend the capacity of their ‘heat sink’ which then needs to be replaced.  So in the two years (game time) between the first and second games tech has changed in such a way that it is less efficient.  You now have to collect ‘heat sinks’ which for some reason fall out of enemy gun’s when they are killed.

to be continued…

Retweet

Giving In

For too long I have been telling myself I will create a website to promote my work and everything else important to me.  I have started so many site only to get distracted by real work.  After playing around with Word Press for work I am doing for a freelance client I discovered how powerful and well written it is.  Therefore I have given in and decided to start with Word Press rather than aspire to end with something like Word Press written on my own.

I think a big part of my failure to create a site was I kept getting hung up on the big picture.  I wanted to develop something that I could build upon over time.  I would start with a simple design and a few pages and never really get much farther than that.  A few months later I would give it another go.  Now I am going to start with Word Press as a base and build upon it with my own Themes and Plugins.

Retweet