Legacy Code Nightmares

Over the last week I have been very busy at work. I have had no time to take my head out of the code to actually post here. I have been working on a legacy code base and all I can say is what a nightmare it has been.

I know most legacy systems are a nightmare to work with, but someone who was not a PHP developer developed this one. They were primarily a server administrator and this was thrown into their lap and they only had a 2-week deadline. I must say they pulled off a miracle with a 2 week deadline but some of the code is so difficult to work with.

SQL:
  1. INSERT INTO track(line_id, entered_by, shpstatus, tracking)
  2. SELECT l2.line_id, 'user' entered_by, 'S' shpstatus, '54524157425' tracking
  3. FROM line l1, line l2
  4. WHERE l1.invoice = l2.invoice
  5. AND (l2.prod = 'SA-GLASSESSHP' OR l2.prod = 'SA-JACKETSHP')
  6. AND l1.line_id = 45425245
  7. LIMIT 1

The statement above is the worst SQL query I have found in the system to date. I understand what they were trying to do with the sub-query but this is not a situation where a sub-query should have been used. They should have used 2 queries on this rather than making it overly complex and so intense.

Digging through this code has defiantly proven to be a challenge and I love challenges. Based on the query above you can just imagine the PHP code syntax I am finding everywhere.

I am glad that I have been given the opportunity to work on this code base. I am learning a lot about how things actually work in an enterprise level company. They have large expectations with short deadlines so they end up getting hacked together code that will prove to be difficult when expansion is necessary.

I look forward to seeing how things go after the holidays and what they task me on to next. I just hope it is as fun as this task.



Development, Work.

Have your say...

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

   

SEO Consultant SEO services