Archive for April, 2009


Apr

28

MySpace PHP REST Library

Over the last few days I have been digging deep into the concepts of REST. I have been reading through my copy of RESTful Web Services. Out of curiosity I searched Google for a "php REST library" and it turned up the Official MySpace PHP REST Library.

I started to look through the code and noticed something really weird about how the code is structured. It looks like they are trying to use an Object Oriented approach however I think they are going about things improperly. The code looks a lot like the following.

PHP:
  1. class Configs {
  2.           public static $APPLICATION_KEY = "api_oauth_consumer_key";
  3.           public static $APPLICATION_SECRET = "api_oauth_consumer_secret";
  4.       }
  5.  
  6.       class SelectorType {
  7.           public static $ME = "@me";
  8.           public static $ALL = "@all";
  9.           public static $SELF = "@self";
  10.           public static $FRIENDS = "@friends";
  11.       }

Now the structure of these classes is fine, but it does bring out the question as to why they are using classes for this type of stuff. The classes have no methods, they have only provided public static properties. I am not sure why they took this approach. I am not sure if they are trying to remain backwards compatible with PHP 4 or not. If they are however I think they would be better off using constants for these values in the Common.php file, also I am pretty sure they are not trying to support PHP 4 because they are using the static keyword in the classes and I believe PHP 4 would FAIL with that being there. I am unsure why they are not using class constants. I would suggest a better way of doing things.

PHP:
  1. // PHP 4 Backwards Compatability
  2. define('APPLICATION_KEY', 'api_oauth_consumer_key');
  3. define('APPLICATION_SECRET', 'api_oauth_consumer_secret');
  4. define('SELECTOR_TYPE_ME', '@me');
  5. define('SELECTOR_TYPE_ALL', '@all');
  6. define('SELECTOR_TYPE_SELF', '@self');
  7. define('SELECTOR_TYPE_FRIENDS', '@friends');
  8. // PHP 5 Compatability
  9. class Configs
  10. {
  11.      const APPLICATION_KEY = 'api_oauth_consumer_key';
  12.      const APPLICATION_SECRET = 'api_oauth_consumer_secret';
  13. }
  14. class SelectorType
  15. {
  16.      const SELECTOR_TYPE_ME = '@me';
  17.      const SELECTOR_TYPE_ALL = '@all';
  18.      const SELECTOR_TYPE_SELF = '@self';
  19.      const SELECTOR_TYPE_FRIENDS = '@friends';
  20. }

Even if they were to choose to go the PHP 5 way I would highly suggest that they do not use classes as containers for constants, there is no need to do this. It is not using proper OOP methodologies. Why create an object that just holds 2 - 4 constant variables, these would be better suited for define() calls in my opinion.

I am not trying to flame the work of others, I would just like an idea of why they are using these methods. Anyone reading this that knows the developers on the team feel free to have them explain what they were thinking when creating this code base.

Development, Entertainment, Internet, News, PHP, Rants, Reviews, Software, Useful.

Apr

26

R.I.P Elmer Huntoon

Yesterday we found out that a friend of ours passed away. We were unclear on what exactly took place yesterday but we have more of a picture now. We have been told that he was out fishing at a lake in NY when he had a seizure and fell into the water. He will be missed a lot by all of the kids he was around. He loved playing with the kids when we would stay up in North Adams. We are still unclear on all of the details of how it happened, information is still trickling in.

Our prayers go out to his family and friends that he has left behind. Rest in Peace Elmer, you will be missed.

I have updated this post to include Matt & Christina’s Video right on the page so that you don’t have to leave to watch it. Thanks to Matt & Christina for the video.

Local, News.

Apr

18

Happy 4th Birthday Liam

Today is my son Liam’s 4th Birthday! Happy Birthday Liam!!!

Entertainment, Family, Local, News.

Apr

03

Only In Vermont

Tonight when we were on our way home from picking up the boys, we stopped in Montpelier Vermont. We could not stop laughing long enough to take a picture of the sticker silhouette people on the windows. Funny though it looks to be registered in New York State. Even Better!!!

Read the rest of this entry »

Entertainment, Family, Local, News, Raves, Useful.

Apr

02

iPhone Games on OS X

One thing I have never understood is the fact that there is a huge lack of games out there for OS X. Even the small games like Tetris, Trism, Fastlane, are great games but where is the OS X version? I know that you will lose all of the accelerometer features but you could still have nice keyboard commands. I wonder just how hard it would be to port these games over to OS X. I wonder if this will ever happen? I know there are a handful of games and even less gamers on the mac but some of these nice small games would be good for me to put on the laptop for the kids to play.

I remember back in the day (4th – 5th grade) I would play “Where in the World is Carmen Sandiego” and “The Oregon Trail” and used to love these games. Trying to find something like that for kids today on OS X seems to be almost impossible. I did find one game that I know the kids will like and that is Wall-E. What happened to all the small games for kids though?

Entertainment, Internet, Mac, News, Rants, Software.


Technology Blogs Add to Technorati Favorites Page Rank Tool NYPHP Users Group View Joseph Crawford's profile on LinkedIn

   

SEO Consultant SEO services