SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Dernier

Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...baharayali
 
A Spiritual Guide To Truth v10.pdf xxxxxxx
A Spiritual Guide To Truth v10.pdf xxxxxxxA Spiritual Guide To Truth v10.pdf xxxxxxx
A Spiritual Guide To Truth v10.pdf xxxxxxxssuser83613b
 
The Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxThe Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxFred Gosnell
 
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...makhmalhalaaay
 
Peaceful Meditation | Peaceful Way by Kabastro
Peaceful Meditation | Peaceful Way by KabastroPeaceful Meditation | Peaceful Way by Kabastro
Peaceful Meditation | Peaceful Way by KabastroKabastro
 
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...Amil Baba Naveed Bangali
 
From The Heart v8.pdf xxxxxxxxxxxxxxxxxxx
From The Heart v8.pdf xxxxxxxxxxxxxxxxxxxFrom The Heart v8.pdf xxxxxxxxxxxxxxxxxxx
From The Heart v8.pdf xxxxxxxxxxxxxxxxxxxssuser83613b
 
Genesis 1:8 || Meditate the Scripture daily verse by verse
Genesis 1:8  ||  Meditate the Scripture daily verse by verseGenesis 1:8  ||  Meditate the Scripture daily verse by verse
Genesis 1:8 || Meditate the Scripture daily verse by versemaricelcanoynuay
 
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...makhmalhalaaay
 
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
 
Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdfEmails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdfOH TEIK BIN
 
MEIDUNIDADE COM JESUS PALESTRA ESPIRITA1.pptx
MEIDUNIDADE COM JESUS  PALESTRA ESPIRITA1.pptxMEIDUNIDADE COM JESUS  PALESTRA ESPIRITA1.pptx
MEIDUNIDADE COM JESUS PALESTRA ESPIRITA1.pptxMneasEntidades
 
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
 
Amil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in PakistanAmil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in PakistanAmil Baba Mangal Maseeh
 
"The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version""The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version"aijazuddin14
 
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...baharayali
 
Genesis 1:5 - Meditate the Scripture Daily bit by bit
Genesis 1:5 - Meditate the Scripture Daily bit by bitGenesis 1:5 - Meditate the Scripture Daily bit by bit
Genesis 1:5 - Meditate the Scripture Daily bit by bitmaricelcanoynuay
 

Dernier (20)

Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
 
A Spiritual Guide To Truth v10.pdf xxxxxxx
A Spiritual Guide To Truth v10.pdf xxxxxxxA Spiritual Guide To Truth v10.pdf xxxxxxx
A Spiritual Guide To Truth v10.pdf xxxxxxx
 
The Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxThe Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docx
 
St. Louise de Marillac and Abandoned Children
St. Louise de Marillac and Abandoned ChildrenSt. Louise de Marillac and Abandoned Children
St. Louise de Marillac and Abandoned Children
 
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
 
Peaceful Meditation | Peaceful Way by Kabastro
Peaceful Meditation | Peaceful Way by KabastroPeaceful Meditation | Peaceful Way by Kabastro
Peaceful Meditation | Peaceful Way by Kabastro
 
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
 
From The Heart v8.pdf xxxxxxxxxxxxxxxxxxx
From The Heart v8.pdf xxxxxxxxxxxxxxxxxxxFrom The Heart v8.pdf xxxxxxxxxxxxxxxxxxx
From The Heart v8.pdf xxxxxxxxxxxxxxxxxxx
 
Genesis 1:8 || Meditate the Scripture daily verse by verse
Genesis 1:8  ||  Meditate the Scripture daily verse by verseGenesis 1:8  ||  Meditate the Scripture daily verse by verse
Genesis 1:8 || Meditate the Scripture daily verse by verse
 
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
 
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
 
Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdfEmails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdf
 
famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...
famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...
famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...
 
MEIDUNIDADE COM JESUS PALESTRA ESPIRITA1.pptx
MEIDUNIDADE COM JESUS  PALESTRA ESPIRITA1.pptxMEIDUNIDADE COM JESUS  PALESTRA ESPIRITA1.pptx
MEIDUNIDADE COM JESUS PALESTRA ESPIRITA1.pptx
 
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
 
Amil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in PakistanAmil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
 
Zulu - The Epistle of Ignatius to Polycarp.pdf
Zulu - The Epistle of Ignatius to Polycarp.pdfZulu - The Epistle of Ignatius to Polycarp.pdf
Zulu - The Epistle of Ignatius to Polycarp.pdf
 
"The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version""The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version"
 
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
 
Genesis 1:5 - Meditate the Scripture Daily bit by bit
Genesis 1:5 - Meditate the Scripture Daily bit by bitGenesis 1:5 - Meditate the Scripture Daily bit by bit
Genesis 1:5 - Meditate the Scripture Daily bit by bit
 

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

Notes de l'éditeur

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