Code Igniter truly rocks

Its been a couple years since I moved away from Classic ASP development and it’s code snippets like this that truly showcase the beauty of using a well designed framework to code with.  Check out this wicked query in Code Igniter:

function get_popular_songs() {   $this->db->select(‘listens.total_listens’); $this->db->select(‘albums.slug AS album_slug’); $this->db->select(‘artists.slug’); $this->db->select(‘songs.*’); $this->db->from(‘listens’);
$this->db->join(‘songs’, ‘ = listens.song_id’, ‘left’); $this->db->join(‘albums’, ‘songs.album_id =’, ‘left’); $this->db->join(‘artists’, ‘songs.artist_id =’, ‘left’); $this->db->orderby(‘listens.total_listens’, ‘desc’); $this->db->limit(10);
$return = $this->db->get(); }

I’d hate to imagine how confusing writing this SQL statement by hand would be in Classic ASP. Ouch!


About Joseph R. B. Taylor

Joseph R. B. Taylor is a humble designer/developer who makes stuff for screens of all shapes and sizes. He is currently the lead UI/UX Architect at MScience, LLC, where he works to create simple experiences on top of large rich datasets for their customers and clients.