• Resolved bosseal

    (@bosseal)


    Hi Keith,

    Thanks a lot for the plugin. It really helps to keep a clean WP install.

    I had to browse the code for controling some stuff (the red herring comment form not showing on my install) and noticed a few formatting differences:

    • tabs mainly used for tabulation, but also spaces used sometimes
    • different formatting for conditional statements (spaces between logical opertors, sometimes not, etc.)

    I’m aware it’s not a big deal and it doesn’t prevent the code to work perfectly. Plus code formatting is often a personal choice, the choice of the developper. But having a correct formatted code can help readability of the code, offers best display in IDEs and also make the collaboration easier in case of several developpers work on the code (of course they have to apply the same formatting rules).

    So, unless these formatting differences are kept for historical purposes (making diffs or patching easier), maybe it can be an improvement to reformat the code ? IDEs (at least NetBeans and Eclipse, and I guess others) usually have a feature to do that automatically. Maybe going from a sub-release (4.3) to a major release (5.0) is also a good opportunity to apply such formatting ? What do you think ?

    Anyway, the current code is in any case readable and understandable so no worry !

    Best regards,

    Alexandre 8)

    http://wordpress.org/plugins/stop-spammer-registrations-plugin/

Viewing 2 replies - 1 through 2 (of 2 total)
  • It’s not like there is a team of coders here. It is just me and I only get to work on this a few hours each month. The code is cut and paste from other projects and sometimes I use notepad and sometimes notepad++ to code depending on where I am when I make changes.

    Overall, the code is pretty clean and consistent in style. Spaces or tabs mean nothing to me. The indents seem to be mostly ok. I leave in lots of commented code and I am not real careful with spelling in comments.

    I am the only one making changes, so it only has to be readable to me.

    In my day job I use java and regularly use a code beautifier and I pay attention to what comments I make, because I get paid to code java and other people will see the code. This is not true in PHP. The PHP code is personal.

    I am glad that you were able to find the places you need to make your changes. Every coder has his own approach. My own style involves breaking code out into separate functions as the program gets complicated, even when there is little need for it. It would be nice if no function were longer than a single screen, but some of my functions are run-on and need shortening. I think short functions help make the code a little more readable, even if you have to search around to find the right function.

    Keith

    Thread Starter bosseal

    (@bosseal)

    Yes it makes sense, especially if you’re the only developer and code on the run on your free time.

    Plus you’re right, the code is clean, organized and commented.

    Once again it was not a criticism nor anything, I know that every coder has his own rules and approach, it was just a thought after browsing the code and an idea in case the project was developed with several hands.

    So forget about it, and my apologies if my message seemed a bit rough.

    Best regards,

    Alexandre 8)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Improvement – Reformatting code’ is closed to new replies.