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

No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Naveed Bangali
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachiamil baba kala jadu
 
Study of the Psalms Chapter 1 verse 1 - wanderean
Study of the Psalms Chapter 1 verse 1 - wandereanStudy of the Psalms Chapter 1 verse 1 - wanderean
Study of the Psalms Chapter 1 verse 1 - wandereanmaricelcanoynuay
 
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdfUnity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdfRebeccaSealfon
 
原版1:1复刻莫纳什大学毕业证Monash毕业证留信学历认证
原版1:1复刻莫纳什大学毕业证Monash毕业证留信学历认证原版1:1复刻莫纳什大学毕业证Monash毕业证留信学历认证
原版1:1复刻莫纳什大学毕业证Monash毕业证留信学历认证jdkhjh
 
Tremble song lyrics Powerpoint church music
Tremble song lyrics Powerpoint church musicTremble song lyrics Powerpoint church music
Tremble song lyrics Powerpoint church musicmaynjc
 
Culture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptxCulture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptxStephen Palm
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Mangal Maseeh
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Mangal Maseeh
 
Unity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdfUnity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdfRebeccaSealfon
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Mangal Maseeh
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Naveed Bangali
 
Sawwaf Calendar, 2024
Sawwaf Calendar, 2024Sawwaf Calendar, 2024
Sawwaf Calendar, 2024Bassem Matta
 
Call Girls in Greater Kailash Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Greater Kailash Delhi 💯Call Us 🔝8264348440🔝Call Girls in Greater Kailash Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Greater Kailash Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Naveed Bangali
 
Understanding Jainism Beliefs and Information.pptx
Understanding Jainism Beliefs and Information.pptxUnderstanding Jainism Beliefs and Information.pptx
Understanding Jainism Beliefs and Information.pptxjainismworldseo
 

Recently uploaded (20)

🔝9953056974 🔝young Delhi Escort service Vinay Nagar
🔝9953056974 🔝young Delhi Escort service Vinay Nagar🔝9953056974 🔝young Delhi Escort service Vinay Nagar
🔝9953056974 🔝young Delhi Escort service Vinay Nagar
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
Study of the Psalms Chapter 1 verse 1 - wanderean
Study of the Psalms Chapter 1 verse 1 - wandereanStudy of the Psalms Chapter 1 verse 1 - wanderean
Study of the Psalms Chapter 1 verse 1 - wanderean
 
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdfUnity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
 
原版1:1复刻莫纳什大学毕业证Monash毕业证留信学历认证
原版1:1复刻莫纳什大学毕业证Monash毕业证留信学历认证原版1:1复刻莫纳什大学毕业证Monash毕业证留信学历认证
原版1:1复刻莫纳什大学毕业证Monash毕业证留信学历认证
 
Tremble song lyrics Powerpoint church music
Tremble song lyrics Powerpoint church musicTremble song lyrics Powerpoint church music
Tremble song lyrics Powerpoint church music
 
Culture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptxCulture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptx
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
🔝9953056974🔝!!-YOUNG BOOK model Call Girls In Pushp vihar Delhi Escort service
🔝9953056974🔝!!-YOUNG BOOK model Call Girls In Pushp vihar  Delhi Escort service🔝9953056974🔝!!-YOUNG BOOK model Call Girls In Pushp vihar  Delhi Escort service
🔝9953056974🔝!!-YOUNG BOOK model Call Girls In Pushp vihar Delhi Escort service
 
young Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort service
young Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort serviceyoung Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort service
young Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort service
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
St. Louise de Marillac: Animator of the Confraternities of Charity
St. Louise de Marillac: Animator of the Confraternities of CharitySt. Louise de Marillac: Animator of the Confraternities of Charity
St. Louise de Marillac: Animator of the Confraternities of Charity
 
Unity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdfUnity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdf
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
Sawwaf Calendar, 2024
Sawwaf Calendar, 2024Sawwaf Calendar, 2024
Sawwaf Calendar, 2024
 
Call Girls in Greater Kailash Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Greater Kailash Delhi 💯Call Us 🔝8264348440🔝Call Girls in Greater Kailash Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Greater Kailash Delhi 💯Call Us 🔝8264348440🔝
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
Understanding Jainism Beliefs and Information.pptx
Understanding Jainism Beliefs and Information.pptxUnderstanding Jainism Beliefs and Information.pptx
Understanding Jainism Beliefs and Information.pptx
 

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