Author: Dave Smith
Updated on: 2015-05-13
Posted on: 2015-05-13
Package: PHP Deprecated Function Checker
The positive side of deprecation
We all have to deal with change in our lives, it is what we learn growing up... right? It is no different in programming, some things are going to change. Before PHP I used PERL, and let me tell you, PHP was a real relief, other PERL programmers know what I am talking about.
One of the great things about PHP, and compared to PERL there are many, was how they really tried to be backward compatible. I have written code with PHP for many, many years and each new release didn't bring with it many headaches. Sure, there where the occasional deprecated functions, usually something obscure that I never used much anyway. A small fix, a little tweak, and everything kept on working just fine. Until...
Hang on, PHP is deprecating an entire extension, and not some obscure extension either. The MYSQL extensions which happens to be the one this old dog has always used. I know, MYSQLi (i for improved) has been out forever, but who has really been using it since MYSQL does the work just fine and I don't even have to specify the connection unless I needed to for some reason. Come on, be honest, did you really start using the new improved extension, we all know by now that I didn't.
Okay, after my initial shock that I was probably going to have to rewrite everything I had ever written that communicated with a database, and after a good stiff drink, I had to admit that change is good. I am only being asked to write better code using a better extension, learn new tricks, out with the old and in with the new... yada yada yada. Good or bad, old dogs can be resistant to new tricks and sometimes we just have to be forced.
The deprecation notice is a warning that something may no longer be available in future versions, breathe, everything is still going to work for now. It is a good idea to migrate your code away from them and use the suggested replacement functions instead. In the bigger picture, deprecation allows forward momentum in a programming language since they are no longer have to support backward compatibility to functions that have outlived their usefulness. This helps the language remain relevant, speaking of which, does anybody really still code in PERL?
Deprecation helps us old dogs stay relevant too.
The deprecated function checker class is not a complicated class, but it is there to help save a lot of time by finding and reporting what needs to be changed. There are certain classes from other authors that I use, which may never be updated and the deprecated function checker helps me keep those classes relevant as well.
You need to be a registered user or login to post a comment
Login Immediately with your account on:
Comments:
2. Suggested change to depcheck_class.php - Tony Russo (2015-07-01 18:30)
issue with when function is first on the line... - 6 replies
Read the whole comment and replies
1. Old Dogs... - Gerry Danen (2015-05-13 17:33)
Very useful script... - 0 replies
Read the whole comment and replies