Home

Your premium source for custom modification services for phpBB

  logo

HomeForumsBlogMOD ManagerFAQSearchRegisterLogin

Comments August 28, 2006

Writing a MOD

Filed under: MOD Writing, phpBB — Dave Rathbun @ 1:54 am CommentsComments (5) 

Writing a MOD is hard. :-)

I should clarify that. Writing a MOD is not hard. If you have a test phpBB board (or two, or three) sitting around, it’s just a matter of coming up with the idea, writing the code, and getting it to function. That’s the easy part.

The hard part is really really thinking about how someone else might use your code. See, when you submit a MOD to the phpBB database, that’s exactly what you have to prepare for. The code that you write for yourself is easy, the code you write for someone else gets harder.

First, you have to make absolutely sure that you use the DBAL. That’s not a problem for me, I use it for every line of code I write around phpBB.

Next, you have to use language strings. I hate this part. :-P What this means is that anything that a reasonable user might be expected to see (which means not critical failure error messages) has to be translatable, and to do that you need to use language strings. What I have started doing to help this is to create all of my language strings within the php code while I’m writing it, then transferring the $lang[] assignments to the language file at the end. In this way I don’t have to constantly jump back and forth from one file to another trying to keep everything in sync.

Beyond that, you need to think about making your code flexible without being overwhemingly complex. In my experience, that often means that you leave some features out because the value they add is not worth the additional complexity that would be required.

For example, a MOD I’m working on now: Topic Points. I had a grand vision where everything would be based on the standard phpBB permissions system. I was going to add “Assign Point” and “Edit Point” and “Modify Point” to the permissions system, and allow board owners to be able to set each of these on a forum-by-forum basis. Ew, too complex. I would never get the code out. So instead, I allow the point feature to be completely on/off across the entire board, or on/off for specific forums.

Next, admin screens. I have a standard template that I follow that helps me crank out admin screens fairly quickly. The basic admin functions are list (select), add (insert), update, or delete, and one page plus two template files is enough to do all of those. But consider a MOD that requires several different admin features, and you see that you need 3 files per function… it starts to add up.

As I see it, here’s the hierarchy of how code complexity adds up:

Code you write for yourself: easy
Code that you write and have to document: harder
Code that you write and have to document and deliver to someone else: harder still
Code that you write and have to document and deliver to someone else and expect to be able to support: hardest :-D

It’s fun, and I enjoy it. But writing MODs can be hard, even if the code is simple.

5 Comments »

  1. Yes dr! nice blog entry :)
    It takes me ages to write a decent install set for a mod so I agree with you there !

    Comment by ramon fincken — August 28, 2006 @ 7:33 pm

  2. Yay! My first legitimate blog content, after 70+ spams… :-)

    Welcome, Ramon.

    Comment by dave.rathbun — August 30, 2006 @ 3:48 pm

  3. You’re welcome.
    I’m currently working on the Guest Watch topics and I’m sure you’ll love it !

    Have a nice day!
    Rfn

    Comment by ramon fincken — September 3, 2006 @ 7:43 am

  4. I agree with ramon. I just came along this blog, because i remembered that dave has a blog. And i’m in the middle of creating my own, so…

    *adds to blogroll*

    Comment by eviL — September 3, 2006 @ 3:07 pm

  5. Yes, Ramon, I’ve been seeing development notes regarding the “guest watch topic” MOD, that’s going to be really nice. I like the idea that you had that will allow a guest to convert their watched topics should they decide to join the board, that’s a really nice touch.

    I don’t use many MODs written by other folks on my boards anymore, but that’s one I would use, I think. 8)

    evil<3, welcome. 8)

    Comment by dave.rathbun — September 5, 2006 @ 7:25 am

RSS feed for comments on this post.

Leave a comment

Tags allowed in comments:
<a href="" title=""> <acronym title=""> <blockquote cite=""> <code> <strong> <em> <u> <sup> <sub> <strike>

Confirm submission by clicking only the marked checkbox:

     **         

Powered by WordPress