Twitter RSS

Writing your own code vs. Plugins

by Brett Wejrowski on September 30th, 2008

Recently I have been discussing with some fellow coders the benefits of plugins, and when you should write your own code.  I basically wanted to throw out a couple of ideas and hope for some discussion on the topic.  Let me know what you guys think and I’ll do a follow up soon.

Some Background

I, like many of you out there, started programming back in the day by messing around with computers, writing little calculator programs, making websites, etc.  But I really didn’t get into it much more until I started college, where I immediately started programming with C++.  

Most of my classes started out with projects where we had to write everything (no STL!), and all of my code was from scratch.  Once I started doing more of the “development” in “web design and development”, I still practiced the idea that the only code I know is good is the code I write.

But now I can see…

Then one day, the skies parted, trumpets sounded, and my designer Steve said “Hey, have you heard of Ruby on Rails?”  

I immediately started developing with nearly pure Rails, using the built-in-just-about-everything and loving the fact that anything I couldn’t code (or didn’t want to) was usually readily available in plugins ( I love file_column!).  

I will say this, RoR is good code.  And it’s constantly being improved.  For the most part, the plugins are also good code.  And many times, a plugin works perfectly into your project to save you time and add functionality.  

Good Programming

Ask any real programmer, and the efficiency of code is not only about how it performs, but how long it takes you to create.  So obviously there is a trade-off between using plugins and writing your own code.  

That being said, if you are a web designer who is using rails to help you out, or just trying something new, use the plugins: they are great and it will save you days of coding and headaches.  

If you consider yourself a developer (or hope to), you should still use plugins.  If you code everything, you’re going to waste time. However, don’t completely rely on them.  If you want to be a programmer, you need to know how things work, because some day there won’t be a plugin for you, and you’re going to need to know what to do.  

Also, plugins are meant to be helpful for a range of situations.  Therefore, there is going to be some overhead.  If you are concerned with performance, and a plugin isn’t “perfect” for what you’re trying to do; you might need to code from scratch (or at least be prepared to customize the plugin code).

Here’s the thing…

All things considered, I will say that my natural tendency is to code most everything myself.  I like to know where everything is, and exactly what the code is doing.  I also appreciate when the code is only doing exactly what I want it to do.  If it’s impractical to write something, by all means I will ( and do ) use plugins.  

If you want some good coding experience, and have the time, try writing something yourself that you wouldn’t normally do.  Even if you don’t end up using it, you’ll learn a bit more about RoR (or any other language) and you may just have some good code you can use again.

Agree? Disagree? Don’t care?

I’m just one guy.  Let me know what you guys think.


Tags:
Posted in Miscellaneous, Programming 5 Comments »


5 Responses to Writing your own code vs. Plugins

Leave a Comment
  1. Chris Heald  September 30, 2008

    I definitely hear you on the “roll your own” thing. I tend to have a weird mishmash of plugins in my projects, and home-grown code shoved into lib/. The really valuable stuff, though has been a) Packaging my own code into plugins suitable for consumption by others (it really makes you go over the quality of it with a fine-toothed comb!), and b) hacking up existing plugins to fit my particular project. Both have taught me a lot, and in the case of b), has let me leverage a lot of really great work without sacrificing the flexibility I need out of my code.

  2. Yeah that is a great point. I have been tentative to put any of my code into a plugin for others yet, but as soon as I finish up a couple projects I’m working on, I will definitely attempt to share some of my code with the Rails world. As of now, I’m just posting some simple things on this blog for others to use. Thanks for the input!

  3. Julian Gruber  October 17, 2008

    I think it depends on the situation. If you need exactly what a plugin provides and it can save you a lot of work. But, if you only need a small part of the plugin or would have to extend the plugin, I’d write my own code.

  4. Julian Gruber  October 17, 2008

    in the 2nd sentence, add “it’s ok.” :)

  5. PCSpectra  November 14, 2008

    I think there is a genuine concern with many developers reusing code written by others.

    We all know code breaks, and when it does, we need to fix it (actually were expected to fix it). Relying on third party code usually means you have to wait for them to fix the problem.

    To make matters worse, scripting languages attract developers of all experience levels, from newbies to hardened veterans.

    C++ for instance, takes years before you become capable of writing reusable code (ie: Windows MFC controls) and during that time you learn a lot about programming. I was far less reluctant to reuse a Windows control I found on CodeProject than I am to reuse a class I find on PHPClasses.

    RoR has the benefit of being somewhat of a niche market language/tool/framework with a strong focus on design, more than PHP or Perl anyway.

    For that reason I rarely reuse PHP classes unless I know the developer from a particular forum and have been impressed by their insight into certain topics.

    Cheers,
    Alex

Join the Discussion