Welcome Guest, Not a member yet? Register   Sign In
where should I write a re usable code ?
#1

[eluser]core-coder[/eluser]
Hi all,

Thanks for reading this post.

I have to write some reusable function in my application. for example i have to upload too many files so I would like to create a function with all config and other details in a function and just call the function to upload files with parameters. but where should I write the function ? in a library ? or some where else ?

Thanks again
#2

[eluser]tomcode[/eluser]
For simple, universal stuff I create helpers. They have the advantage to be usable anywhere, no need to respect the context I am in.

In Your case I'd create a library and probably also some config entries (paths, filetypes and so on) :

1. file uploads are probably only done inside a controller
2. configurations can be nicely commented / easily maintained
3. functionality can be split into single task methods for better control and readablity.




Theme © iAndrew 2016 - Forum software by © MyBB