310 likes | 322 Views
Enhance your meta coding skills with tips on reducing code, avoiding common mistakes, and debug techniques. Perfect for meta coders and library builders. Learn how to optimize your code efficiently.
E N D
Adrian Slade Principal Pattern Engineer aslade@synon.com Do Meta Better
Schedule • Too much code • Too little code • Code you didn’t expect • Good practices • Common mistakes & gotcha’s • Meta ‘Debugging’ techniques
A quick re-cap • ‘+’ - meta conditions & loops • ‘++’ - results in code • ‘+++’ - concerned with meta variables • For current or budding meta coders & library builders
Too Much Code Call a date validation function to check for errors
Too Much Code Line moved
Too Much Code • First subroutine • 63 lines of executable code • Second subroutine • 33 lines of executable code • Nearly 50% reduction • Warning : Loops in Loops
Too Little Code Set an error flag if mandatory fields are empty
Code You Didn’t Expect Call a relation validation function and get its name if its call fails
Good Practice • Use conditioning where possible • Test for a verb before using it
Good Practice • Use conditioning where possible • Test for a verb • Try to exclude unwanted iterations • An example from the User Guide
Unnecessary iterations Retain the last field with focus - could be used to get virtuals on lost focus
Common Mistakes & Gotcha’s • Checking for view keys
Common Mistakes & Gotcha’s • Checking for view keys • The missing loop • +For each attribute • A missing +++Define • Code sequence
Meta ‘Debugging’ Techniques • Using ++Name • ++Name <meta variable>,Environment<*Object name> • Comments • Gen & View • Iterate • Make Real • Read User Guide - Chapter 8
Enhancement queue • Inline expansion of AD • Meta instructions generated as comments • +For Each Variable <variable> • ++If Lost Focus
And Finally Everyday In Every Way My Meta Will Get Betta!
Adrian Slade Principal Pattern Engineer aslade@synon.com Do Meta Better