Jump to content

Releasing Code


ApocalypeX

Recommended Posts

I've been away working on a few projects and some I want to release Open Source so anyone can use it. Now obviously I need to write up documentation etc.But I look at some of my smaller tools/projects and they are not OOP. Now I know that I should use the best method for the job and for example a little uploading repo for pics, isn't large. So I built it using a number or scripts rather than classes. Should I refactor them to be more Object Oriented for the sake of allowing them to be expanded by others with more ease? Or keep them simple by nature/"don't fix it if it aint broke".

Link to comment
Share on other sites

Depends on how small they are, and how much they'd be polluting the global namespace. If you only have few functions like tool_prepare(), tool_do(), tool_cleanup(), simply using OOP for the sake of using it is somewhat pointless.My personal rule of thumb is that if you need to carry any variable across more than one function, you need a class with that variable as one of its properties. Remaining related functionality that uses no variable at all becomes a static method of the same class. This rule doesn't apply if all of your functions would be "static" if turned into OOP, or if the static functionality can be used for unrelated purposes.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...