Highly Trained and Best Practice Coding
April 22, 2018 08:55:15 PM
|forgotPassword | register Welcome back! login|
Web Software: Architect / DBA / Designer / Developer
In regards to how I code in any language, I think it's a good idea to think through the process, whiteboard it as needed, then layout your file with comments identifying all the forks in the road as they say. The things going through my head as I code are: consistent, specific, native, KISS (Keep It Simple Stupid), DRY (Don't Repeat Yourself) so nothing twice, never ask a question you already know the answer to, everything has a natural home, just because you can doesn't mean you should, less is more. I tend to think very OO. Is a, has a. A Registrant is a User ya da ya da ya da. Implements. Extends. Abstract. Everything is a component or module, basically a little black box, and all that matters is what does it expect in, and what is it returning... and most importantly that it NEVER EVER breaks. There is no such thing as user error. It is always our fault. A file of code should essentially reflect a sheet of music. There should be no question what it is meant to do, so well commented for the next person reading it. As for variable naming syntax, call it what it IS lower camel case: aSomething, bSomething, oSomething, qSomething, xSomething and scope it! Classes (blueprints) start with an UPPER case, static constants all UPPER case, etc. etc. in an overall effort to avoid spaghetti code, encouraging some form of team wide homogenized uniform coding syntax that in the end will inevitably increase ROI. I tend to also alphabetize my methods in objects such as application.oController, and the method verbs for basic CRUD operations would be add, edit, get, remove emulating the SQL actions INSERT, UPDATE, SELECT, DELETE and the arguments would also be in alpha within 2 groups - required and not required, hence parammed with a default value. Even if something is loosely typed like CF or PHP, one should treat it as if it is strongly typed like java or actionscript. Similarly, even if a language is not case sensitive, one should treat it as if it is. SOMEVAR vs somevar to me is not acceptable. Ultra bad actually. While some languages would accept that, some obviously would not. Everytime, one is too lazy to be specific, you are essentially asking the server to do more work.... in my humble opinion.
The impossible takes a little longer...
Here's a few random code examples of my work:
LeeMVC 4.1 KISS Framework For ColdFusion 11+ to 20170508
LeeMVC 5.0 KISS Framework for ColdFusion 11+ (inc bootstrap & jQuery)
LeeMVC 6.0 KISS Framework for ColdFusion 11+ (inc React)
When it has to be perfect... and robust... consider Brad Lee. You'll be glad you did.