Should I be using plugins?

I’m working on quite a customised Wordpress site and what I need to do is get all images attached to a post and create a sideshow from it. I have achieved this without using any plugins. So what I have done is put a but of code in functions.php to loop thought a post and build an array of image attachments. I then call it on my template file and then use a jquery slideshow to display it.

Am I ok to leave it like that or is it best practice to convert it to a plugin? Never made a plugin before which is why I am apprehensive about it.

Putting the code in the theme’s function.php file is fine. With the only problem being a change of themes will remove the code. If you want it to work with other themes then a plugin is the way to go.

Another advantage to using plugins is that you can put different modifications in different plugins, allowing you to selectively activate / deactivate features more easily.