Although I've always believed in the philosophy behind Object Oriented Programming (OOP), I have to admit that in most cases, I still program in traditional, structured, procedural style. This even though languages like C# or Java treats everything as classes, even the main program itself.
The most OOP-heavy program I've ever written is our *ahem* best-selling NetSecure biometric time and attendance system. Since NetSecure aims to support as many devices as possible for identification and verification purposes, early on, I designed it to use OOP heavily. All devices I support (fingerprint scanners, RFID readers, magstripe readers, pinpads, etc.) are derived and implemented from two other layers of abstract classes. At the bottom is a generic InputDevice abstract class. Then a generic ProximityReader abstract class is derived from it. Then finally, an RFID-specific implementation like the GigaTMS' GP20/30 RFID reader is implemented.
Recently, a big client requested for support of Philips Mifare cards. I've been twiddling with the ACR120 Mifare reader for some time. I've written small programs to test its capabilities, but have never actually written a full-blown program to make use of it. I was estimating it could take me a couple of weeks to write all the code to integrate it to NetSecure.
When I finally got down to coding and followed my object models, I realized that the ACR120 reader is just like a GPxx RFID reader. So I created an ACR120MifareReader class that is derived from ProximityReader; implemented the abstract interfaces to allow the main program to connect/disconnect to it and retrieve inputs; and voila -- I was done in about an hour! Turns out that very little changes were needed on the main NetSecure code itself as most access to devices go through the class abstraction interfaces.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment