xeoncross / forumfive

A < 10kB forum system in PHP - Code Golf
164 stars 18 forks source link

Meaningful variable names #4

Closed maxk42 closed 11 years ago

maxk42 commented 11 years ago

Using meaningful variable names would go a lot further toward making this usable and extensible. Trying to shave a few hundred bytes off of the file size at the expense of legibility is foolish. If you have a de-obfuscated version of forum.php, you should use it in lieu of the version that's there.

xeoncross commented 11 years ago

That is a perfectly valid point, readability needs to improve in this project. However, also realize that the project isn't truly obfuscated - I only did that to six variables which are outlined in the forum.php file.

$t = Topic ID (later Topic object)
$h = Topic Headline
$b = Topic/Comment Body
$c = Comment ID
$a = Auth assertion request (Login)
$d = Delete request
maxk42 commented 11 years ago

Ah, I didn't notice that comment -- but that's not what I'm talking about -- I'm talking about the function parameters (and function names for that matter) and the other variables that aren't in that list: $q, $s, $p, $v, two different $d variables. I should have clarified that the function names are also non-intuitive (aside from db()) and should probably be used as well.

I like to follow r/tinycode submissions for bite-sized views of different people's coding styles.

I'd seriously consider using this in a microsite if I could follow the code a bit easier and determine that it was secure / appropriate for my needs.

xeoncross commented 11 years ago

Yes, I'm leaving this issue open since I do plan on implementing your ideas.

xeoncross commented 11 years ago

https://github.com/Xeoncross/forumfive/commit/073e3fef1c2b23f8260f99c2924dff14b2ebd10f