Nao

  • Dadman with a boy
  • Posts: 16,061
Code clean-up
« on May 6th, 2011, 05:20 PM »Last edited on February 8th, 2013, 10:36 AM
Feature: Code clean-up
Developer: Nao
Target: modders, geeks
Status: 80% (I fix stuff when it hurts my eyes. Most of it is done though.)
Comment:

They say beauty is in the eye of the beholder. Let's be clear, the SMF codebase would already enchant any given geeky beholder. Really. Just have a look at any other popular forum/blog platforms. Their PHP, HTML, CSS and JS are often at best acceptable, at worst unreadable. Wordpress says that coding is art. Well, if you looked into their code, you'd swear they meant talking about modern art.
SMF doesn't have this problem, because it's been mostly maintained by anal-retentive genius coders. Only problem -- I'm even more anal-retentive than they are. So, every time I find some code that I feel is sub-standard, I'll just rewrite it. Sometimes the code is micro-optimized in the process, mostly it's just prettified.
Some changes are project-wide (making sure that all files are saved in LF format as opposed to CRLF, removing useless {} or extra tabs in empty lines or at the end of lines), most are way more specific. Let's not delve into that too much. You might find I'm a bit crazy in that area. I changed thousands of lines just because they looked ugly to me.

(And that concludes this feature set -- for now!)

Re: Code clean-up
« Reply #1, on July 2nd, 2011, 07:52 PM »
Glad to see that. Hopefully you can get rid of some of the big ones like the over use of @ operator

Re: Code clean-up
« Reply #2, on July 2nd, 2011, 08:51 PM »
I don't see that used so often actually...
If you could point me out to some of the uses that bother you... I shall look into it.

Re: Code clean-up
« Reply #3, on July 2nd, 2011, 09:47 PM »
Mainly on things like ini_get and so on if I remember right. I'm sure, though, that Amdahl's Law is also applicable here...

Re: Code clean-up
« Reply #4, on July 3rd, 2011, 05:52 AM »
Quote from Arantor on July 2nd, 2011, 09:47 PM
Mainly on things like ini_get and so on if I remember right. I'm sure, though, that Amdahl's Law is also applicable here...
Absolutely, but it is just ugly. It also leads new programmers to think that is the proper way to do things.

Re: Code clean-up
« Reply #5, on July 3rd, 2011, 11:41 AM »
It's only slower if an error is actually found I believe. So it should only be avoided in loops.

Re: Code clean-up
« Reply #6, on July 3rd, 2011, 05:50 PM »
It is slower no matter what.

Re: Code clean-up
« Reply #7, on July 3rd, 2011, 06:06 PM »
There are far more useful things for us to worry about in terms of performance than that.