CodeIgniter Forums
Abstraction - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Abstraction (/thread-18190.html)



Abstraction - El Forum - 04-28-2009

[eluser]Richard Rowe[/eluser]
I'm developing an application in CodeIgniter that requires me to interact with multiple APIs that share the same sort of functionality. I am planning to do abstraction / interface design pattern, so I can define an interface and have classes extend/implement the interface. Very similar to how the database abstraction is done.

My question is how should I implement this neatly into my CI application (folder structure, application design, etc)? I would like to give each class (each specific api) its own file to minimise the footprint of this.

Hope that made sense. Thanks in advance.


Abstraction - El Forum - 04-28-2009

[eluser]Colin Williams[/eluser]
Seems like it would either fall in the category of Model or Library. Model especially if it deals with data manipulation and retrieval.


Abstraction - El Forum - 04-28-2009

[eluser]Dam1an[/eluser]
I second that
I would go for model too (people seem to be under the impression models are just for database stuff, but its for all data manipulation)


Abstraction - El Forum - 04-28-2009

[eluser]Richard Rowe[/eluser]
Thanks for the help. Because there will be a few classes extending this interface, I'm thinking about putting them into a folder too to neaten things up (quite like how in CI they put all the classes that extend the DBA in /drivers/), in terms of folder structure any tips?

The APIs are domain reseller ones. So I'm using one for .com, .net, .org, another for .uk, another for .au and .nz, and so on.