SlideShare a Scribd company logo
1 of 12
Fofo’s
 2011-08-19
What? Why? Huh?
‣   Fork Forms
‣   Ge kunt er “Phopho” van maken, c’est très PHP.
‣   Veel dichter bij “foef” dan menig mannelijke developer.
Slides suck, show code
Backend forms in Fork
Backend forms in Fork
‣   Known way of doing things
‣   $this->frm->addText() ... etc typing is a drag, so we
    copypaste... (kind of a naive passive code generation)
‣   Maintainability/DRY violation (adding/changing fields)
‣   Not that oopie...
‣   SOC: too much responsibility in action (ie. controller)
Add field (solely in action / template edits):
‣  add.php (in loadForm() and validateForm())
‣  edit.php (in loadForm() and validateForm())
‣  add.tpl
‣  edit.tpl
  => 6 different code units
Extract form from action
Extract form from action
‣   Introduce class hierarchy: add > base (BEForm) < edit
‣   Initial SLOC increase (sloccount counts ‘{‘ and ‘}’), but
    SLOC in actions shrinks (“thin controller”)
‣   SOC/modularity: Action does action things, Form does
    form things: brain likes, testability increases.
‣   More DRY => less pain
Add field (solely in action / template edits):
‣  forms.php (in loadFields())
‣  form_fields.tpl
  => in 2 different code units, but it should be 1, so ...
What’s next?
What’s next?
‣   Move stuff to the model (“thin controller, fat model”),
    actions will become parametrizable thin.
‣   More DRY/SPOT, see django models.py fi.
‣   BackendForm::__toString(), no field prefix in tpl.
‣   ORM (not a light step)
‣   ... ?
@dubgeiser
(No warranty intended or implied)
     github.com/dubgeiser

More Related Content

Similar to Fofos

When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneDavid Glick
 
Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]Benny Siegert
 
Swift 2.0: Apple’s Advanced Programming Platform for Developers
Swift 2.0: Apple’s Advanced Programming Platform for DevelopersSwift 2.0: Apple’s Advanced Programming Platform for Developers
Swift 2.0: Apple’s Advanced Programming Platform for DevelopersAzilen Technologies Pvt. Ltd.
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappearedLuc Bors
 
Flask Introduction - Python Meetup
Flask Introduction - Python MeetupFlask Introduction - Python Meetup
Flask Introduction - Python MeetupAreski Belaid
 
Less-Dumb Fuzzing and Ruby Metaprogramming
Less-Dumb Fuzzing and Ruby MetaprogrammingLess-Dumb Fuzzing and Ruby Metaprogramming
Less-Dumb Fuzzing and Ruby MetaprogrammingNephi Johnson
 
Francesco abeni joomla_extensions_best_practices
Francesco abeni joomla_extensions_best_practicesFrancesco abeni joomla_extensions_best_practices
Francesco abeni joomla_extensions_best_practicesFrancesco Abeni
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPtutorialsruby
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPtutorialsruby
 
Oracle DBA interview_questions
Oracle DBA interview_questionsOracle DBA interview_questions
Oracle DBA interview_questionsNaveen P
 
Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programmingsamthemonad
 
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF systemz/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF systemMarna Walle
 
Repetition Control and IO ErrorsPlease note that the mate.docx
Repetition Control and IO ErrorsPlease note that the mate.docxRepetition Control and IO ErrorsPlease note that the mate.docx
Repetition Control and IO ErrorsPlease note that the mate.docxsodhi3
 
Developing a Joomla 3.x Component using RAD FOF- Part 1: Back-end - Joomladay...
Developing a Joomla 3.x Component using RAD FOF- Part 1: Back-end - Joomladay...Developing a Joomla 3.x Component using RAD FOF- Part 1: Back-end - Joomladay...
Developing a Joomla 3.x Component using RAD FOF- Part 1: Back-end - Joomladay...Peter Martin
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8Wim Godden
 
Analyzing FreeCAD's Source Code and Its "Sick" Dependencies
Analyzing FreeCAD's Source Code and Its "Sick" DependenciesAnalyzing FreeCAD's Source Code and Its "Sick" Dependencies
Analyzing FreeCAD's Source Code and Its "Sick" DependenciesPVS-Studio
 
The why and how of moving to php 5.4
The why and how of moving to php 5.4The why and how of moving to php 5.4
The why and how of moving to php 5.4Wim Godden
 

Similar to Fofos (20)

When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
 
Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]
 
Magento++
Magento++Magento++
Magento++
 
Swift 2.0: Apple’s Advanced Programming Platform for Developers
Swift 2.0: Apple’s Advanced Programming Platform for DevelopersSwift 2.0: Apple’s Advanced Programming Platform for Developers
Swift 2.0: Apple’s Advanced Programming Platform for Developers
 
Old Dogs and New Tricks
Old Dogs and New TricksOld Dogs and New Tricks
Old Dogs and New Tricks
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappeared
 
Flask Introduction - Python Meetup
Flask Introduction - Python MeetupFlask Introduction - Python Meetup
Flask Introduction - Python Meetup
 
Less-Dumb Fuzzing and Ruby Metaprogramming
Less-Dumb Fuzzing and Ruby MetaprogrammingLess-Dumb Fuzzing and Ruby Metaprogramming
Less-Dumb Fuzzing and Ruby Metaprogramming
 
Francesco abeni joomla_extensions_best_practices
Francesco abeni joomla_extensions_best_practicesFrancesco abeni joomla_extensions_best_practices
Francesco abeni joomla_extensions_best_practices
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Oracle DBA interview_questions
Oracle DBA interview_questionsOracle DBA interview_questions
Oracle DBA interview_questions
 
Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programming
 
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF systemz/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
 
Repetition Control and IO ErrorsPlease note that the mate.docx
Repetition Control and IO ErrorsPlease note that the mate.docxRepetition Control and IO ErrorsPlease note that the mate.docx
Repetition Control and IO ErrorsPlease note that the mate.docx
 
Developing a Joomla 3.x Component using RAD FOF- Part 1: Back-end - Joomladay...
Developing a Joomla 3.x Component using RAD FOF- Part 1: Back-end - Joomladay...Developing a Joomla 3.x Component using RAD FOF- Part 1: Back-end - Joomladay...
Developing a Joomla 3.x Component using RAD FOF- Part 1: Back-end - Joomladay...
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8
 
groovy & grails - lecture 5
groovy & grails - lecture 5groovy & grails - lecture 5
groovy & grails - lecture 5
 
Analyzing FreeCAD's Source Code and Its "Sick" Dependencies
Analyzing FreeCAD's Source Code and Its "Sick" DependenciesAnalyzing FreeCAD's Source Code and Its "Sick" Dependencies
Analyzing FreeCAD's Source Code and Its "Sick" Dependencies
 
The why and how of moving to php 5.4
The why and how of moving to php 5.4The why and how of moving to php 5.4
The why and how of moving to php 5.4
 

Recently uploaded

Flores de Mayo-history and origin we need to understand
Flores de Mayo-history and origin we need to understandFlores de Mayo-history and origin we need to understand
Flores de Mayo-history and origin we need to understandvillamilcecil909
 
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UKNo 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UKAmil Baba Naveed Bangali
 
CALL ON ➥8923113531 🔝Call Girls Balaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Balaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Balaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Balaganj Lucknow best sexual serviceanilsa9823
 
call girls in rohini sector 22 Delhi 8264348440 ✅ call girls ❤️
call girls in rohini sector 22 Delhi 8264348440 ✅ call girls ❤️call girls in rohini sector 22 Delhi 8264348440 ✅ call girls ❤️
call girls in rohini sector 22 Delhi 8264348440 ✅ call girls ❤️soniya singh
 
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...Amil Baba Mangal Maseeh
 
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️soniya singh
 
St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024Chris Lyne
 
Part 1 of the Holy Quran- Alif Laam Meem
Part 1 of the Holy Quran- Alif Laam MeemPart 1 of the Holy Quran- Alif Laam Meem
Part 1 of the Holy Quran- Alif Laam MeemAbdullahMohammed282920
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service 🕶
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service  🕶CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service  🕶
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service 🕶anilsa9823
 
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UKVashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UKAmil Baba Naveed Bangali
 
The King Great Goodness Part 2 ~ Mahasilava Jataka (Eng. & Chi.).pptx
The King Great Goodness Part 2 ~ Mahasilava Jataka (Eng. & Chi.).pptxThe King Great Goodness Part 2 ~ Mahasilava Jataka (Eng. & Chi.).pptx
The King Great Goodness Part 2 ~ Mahasilava Jataka (Eng. & Chi.).pptxOH TEIK BIN
 
Pradeep Bhanot - Friend, Philosopher Guide And The Brand By Arjun Jani
Pradeep Bhanot - Friend, Philosopher Guide And The Brand By Arjun JaniPradeep Bhanot - Friend, Philosopher Guide And The Brand By Arjun Jani
Pradeep Bhanot - Friend, Philosopher Guide And The Brand By Arjun JaniPradeep Bhanot
 
VADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call meVADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call meshivanisharma5244
 
The_Chronological_Life_of_Christ_Part_98_Jesus_Frees_Us
The_Chronological_Life_of_Christ_Part_98_Jesus_Frees_UsThe_Chronological_Life_of_Christ_Part_98_Jesus_Frees_Us
The_Chronological_Life_of_Christ_Part_98_Jesus_Frees_UsNetwork Bible Fellowship
 
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...Amil Baba Naveed Bangali
 
St. John's Church Parish Magazine - May 2024
St. John's Church Parish Magazine - May 2024St. John's Church Parish Magazine - May 2024
St. John's Church Parish Magazine - May 2024Chris Lyne
 
Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24deerfootcoc
 

Recently uploaded (20)

Flores de Mayo-history and origin we need to understand
Flores de Mayo-history and origin we need to understandFlores de Mayo-history and origin we need to understand
Flores de Mayo-history and origin we need to understand
 
English - The Story of Ahikar, Grand Vizier of Assyria.pdf
English - The Story of Ahikar, Grand Vizier of Assyria.pdfEnglish - The Story of Ahikar, Grand Vizier of Assyria.pdf
English - The Story of Ahikar, Grand Vizier of Assyria.pdf
 
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UKNo 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
 
CALL ON ➥8923113531 🔝Call Girls Balaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Balaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Balaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Balaganj Lucknow best sexual service
 
call girls in rohini sector 22 Delhi 8264348440 ✅ call girls ❤️
call girls in rohini sector 22 Delhi 8264348440 ✅ call girls ❤️call girls in rohini sector 22 Delhi 8264348440 ✅ call girls ❤️
call girls in rohini sector 22 Delhi 8264348440 ✅ call girls ❤️
 
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
 
English - The Forgotten Books of Eden.pdf
English - The Forgotten Books of Eden.pdfEnglish - The Forgotten Books of Eden.pdf
English - The Forgotten Books of Eden.pdf
 
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
 
St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024
 
Part 1 of the Holy Quran- Alif Laam Meem
Part 1 of the Holy Quran- Alif Laam MeemPart 1 of the Holy Quran- Alif Laam Meem
Part 1 of the Holy Quran- Alif Laam Meem
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service 🕶
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service  🕶CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service  🕶
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service 🕶
 
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UKVashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
 
The King Great Goodness Part 2 ~ Mahasilava Jataka (Eng. & Chi.).pptx
The King Great Goodness Part 2 ~ Mahasilava Jataka (Eng. & Chi.).pptxThe King Great Goodness Part 2 ~ Mahasilava Jataka (Eng. & Chi.).pptx
The King Great Goodness Part 2 ~ Mahasilava Jataka (Eng. & Chi.).pptx
 
Pradeep Bhanot - Friend, Philosopher Guide And The Brand By Arjun Jani
Pradeep Bhanot - Friend, Philosopher Guide And The Brand By Arjun JaniPradeep Bhanot - Friend, Philosopher Guide And The Brand By Arjun Jani
Pradeep Bhanot - Friend, Philosopher Guide And The Brand By Arjun Jani
 
Rohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
VADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call meVADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call me
 
The_Chronological_Life_of_Christ_Part_98_Jesus_Frees_Us
The_Chronological_Life_of_Christ_Part_98_Jesus_Frees_UsThe_Chronological_Life_of_Christ_Part_98_Jesus_Frees_Us
The_Chronological_Life_of_Christ_Part_98_Jesus_Frees_Us
 
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
 
St. John's Church Parish Magazine - May 2024
St. John's Church Parish Magazine - May 2024St. John's Church Parish Magazine - May 2024
St. John's Church Parish Magazine - May 2024
 
Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24
 

Fofos

  • 2. What? Why? Huh? ‣ Fork Forms ‣ Ge kunt er “Phopho” van maken, c’est très PHP. ‣ Veel dichter bij “foef” dan menig mannelijke developer.
  • 5. Backend forms in Fork ‣ Known way of doing things ‣ $this->frm->addText() ... etc typing is a drag, so we copypaste... (kind of a naive passive code generation) ‣ Maintainability/DRY violation (adding/changing fields) ‣ Not that oopie... ‣ SOC: too much responsibility in action (ie. controller)
  • 6. Add field (solely in action / template edits): ‣ add.php (in loadForm() and validateForm()) ‣ edit.php (in loadForm() and validateForm()) ‣ add.tpl ‣ edit.tpl => 6 different code units
  • 8. Extract form from action ‣ Introduce class hierarchy: add > base (BEForm) < edit ‣ Initial SLOC increase (sloccount counts ‘{‘ and ‘}’), but SLOC in actions shrinks (“thin controller”) ‣ SOC/modularity: Action does action things, Form does form things: brain likes, testability increases. ‣ More DRY => less pain
  • 9. Add field (solely in action / template edits): ‣ forms.php (in loadFields()) ‣ form_fields.tpl => in 2 different code units, but it should be 1, so ...
  • 11. What’s next? ‣ Move stuff to the model (“thin controller, fat model”), actions will become parametrizable thin. ‣ More DRY/SPOT, see django models.py fi. ‣ BackendForm::__toString(), no field prefix in tpl. ‣ ORM (not a light step) ‣ ... ?
  • 12. @dubgeiser (No warranty intended or implied) github.com/dubgeiser

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n