Coding Principles And How They Apply In FileMaker
Coding Principles in general
When I dabbled in development first time I had no idea I actually was developing. I was just adding a few fields here and there. Mostly I just wanted a way to record information on tracking film materials, dubbing, etc. And for the next decade I did the same: I hacked my way to getting things done for the boss. And while I tried to protest, the boss always won and said âbut I need it now.â That leaves zero time for planning or building architecture. So I was more of a firefighter than developer. The next decade I spent learning development from scratch and I keep learning.
Simplicity is the most important consideration in a design
Whether youâre a hard core coder who eats, sleeps and breathes code or a school teacher turned FileMaker developer, you sure have some principles that you abide by (and if you donât you should). We live by principles, so why shouldnât we code by principles? And when you code, you often ask yourself âis this the best possible way to solve the problem?â In FileMaker there are at least three ways to do the same things. And thereâs a different
Since this blog is mostly dedicated to FileMaker development (at this point), Iâll just take a stab at some coding principles and see how they apply to us, FileMaker developers.
YAGNI (You Ainât Gonna Need It)
The idea is that you should code with the goal in mind to program for what you need not what you might need. XP co-founder Ron Jeffries has written:
âAlways implement things when you actually need them, never when you just foresee that you need them.â
The temptationâto create somethingâis large for a developer. It is like putting a knife in a surgeonâs hand or giving a pencil to the architect; they will want to do what they do best. We want to add bells and whistles and we want to blow the client away. But just like furniture shopping at IKEA, we can end up with a lot more than we can take home. Itâs better to code for what the client needs than what the client wants. Personally, Iâm an advocate for this and I always tell my clients: âI will give you what you need but not what you want.â
Aptly, also called also called âNew Jersey styleâ. [And if anyone ever wants to mock Jersey, again, they will meet my fist.] The idea behind it is that âquality does not necessarily increase with functionalityâ.  So what this does is it uses a scale to measure which one is heavier and says simple is heavier than correct. So to me this boils down to getting a solution off the ground and into the usersâs hand rather than making it perfect.  You need to cover as many aspects as you can to make it practical. Your design needs to be consistent but simple. So, buttons, element placement and font sizing should be consistent from layout to layout. Luckily we have FileMaker 13 now so if you use a built-in template (or build your own)itâs hard to go wrong.
KISS (Keep It Simple Stupid) principle
This acronym is a design principle noted by the U.S. Navy. Achieving simplicity should be the goal at all times, and avoid unnecessary complexity. Design your layouts with fewer buttons and make sure they do the most important functions. Then you can take the user to a different tab or layout to give them further info. Give them a drop-down menu with further options if you must.
Donât repeat yourself (DRY)
When FileMaker gave us variables, it became possible to start writing universal scripts. If youâre still not using variables youâre missing out on something great! They allow you to compact your code. You can write one script to create, delete, modify a record and give parameters to tell what layout you are coming from, what your table is, where you need to end up when youâre done. Of course, there will be variations which you can put in an if statement if you need it. But if you can create something once and reuse it, youâre golden. Below is a script we use to strip fields (after a user adds data that) from unnecessary garbage.
Clean Field Universal Script
      More useful coding principles: Wikipedia
Coding Principles And How They Apply In FileMaker was originally published on