XF Add-on Development Flow - What to code first?

TheBigK

Well-known member
I'm taking my steps into learning XF Add-on development and wish to understand the right flow or approach to adapt for the development. I'm looking for advice on what to code first?

That is, if my add-on requires a new route; I start it by -
  1. Creating new route
  2. Followed by writing the controller
  3. Will switch to writing templates before completing the controller.
  4. Then Datawriter
  5. Followed by Model
  6. Views at the end.
But then, I began wondering if the entire process would be easier if I started by building the templates first. Another thought is to build the back-end first and then build all the public interface.

What do you suggest?
 
My rough flow (usually):
  1. Installer
  2. Datawriter
  3. Model
  4. Controller
  5. Route
  6. Templates
  7. Views
Really depends what I'm doing though, and not always that straight forward.

For this sort of add-on development, I have some tools that I might be willing to release if there was enough interest.
 
My rough flow (usually):
  1. Installer
  2. Datawriter
  3. Model
  4. Controller
  5. Route
  6. Templates
  7. Views
Hmm It's interesting how differently we do things.

I always do my installer last, otherwise I have to commit to the db schema I originally had in mind [unlikely] or I have to go back and adjust the installer [multiple times].

I don't write anything entirely in one stage (except the Route and the DataWriter as they are small and usually standard, except for _postSave, _preSave, delete).

Typically I go:

  1. Create the database table(s) in phpmyadmin:
  2. Create the route
  3. Create the controller with the action to display the form and save the form
  4. Create the template
  5. Create the datawriter (note that 3, 4, and 5 are interchangable)
  6. Add a controller action to view a list of data
  7. Create the model with methods for showing/preparing the list of data
  8. Create the template to display the list view of data
  9. Add a controller action to view one row of data
  10. Create the model with methods to show one item
  11. Create the template to display one item
  12. Add controller action to edit a row
  13. Create template to edit a row
  14. Add controller action to delete a row
  15. Create template to delete a row
  16. Views aren't required but if I need them for ajax responses (typically all I need them for really), I'll make them as I need them or at the end
  17. Create all the phrases (I like to do them all at once so I'm not in and out of the admin panel and risk missing one).
  18. Create the installer (once the add on is done, the schema is set so I export the structure and go off that).
 
I always do my installer last, otherwise I have to commit to the db schema I originally had in mind [unlikely] or I have to go back and adjust the installer [multiple times].
Where you go to PhpMyAdmin to edit your database, I basically just edit my installer and run it again.
 
Tools that automate the process of creating datawriters, models, controllers, etc.
What kind of tools are these? Like are they integrated in to the ACP or something different? I have some CLI tools that I use (which can be executed from most IDEs), plus a couple other things. Been tidying up the code recently and was thinking of releasing them to aid others too.
 
What kind of tools are these? Like are they integrated in to the ACP or something different? I have some CLI tools that I use (which can be executed from most IDEs), plus a couple other things. Been tidying up the code recently and was thinking of releasing them to aid others too.
Mine are all ACP tools.
 
For me, typically:

Installer
Datawriter
Route
Controller
Model
Phrases (error phrases for the datawriter, controller, permissions)
Template
Phrases (for the template <- I really dislike this part)
 
I always did do things a little differently.

I start in the ACP first with the perms, options, admin templates, etc.
Then move on to the code.
 
Everything jumbled together, but usually in this order: Model, DW, Templates/Phrases (together), ACP stuff, Installer
 
I don't really follow a set structure, although I generally always start with creating the directory structure and the Addon.php file that houses the installer & event listener methods.

Then I create my installer, and call it from the methods...

Then I do the rest, which is generally all over the place - I generally add phrases as I mention them in code, same with templates.

Liam
 
Top Bottom