2013-08-17, 05:35 PM
I don't have anyone to talk to that cares about anything I like
My friends online and IRL don't understand PHP, much less MyBB forum software. Sometimes when I am just dying to tell someone about a new idea I have had I realize that the person wouldn't care to even hear about it and I wouldn't care to try to explain it :p
The idea for this threads is similar to the Admin Scratchpad thread. In my opinion, that thread has become mostly about the design aspects involved in running a MyBB forum. Post here about your projects and coding for MyBB in general. To be honest, posting about PHP/JS coding in general would be fine with me.
I'll start:
I'm sure it won't be a revelation to any of you pros, but to a n00b with a little over a year of experience with PHP, it took me quite a while to understand what the search for efficiency is all about.
In my opinion, efficiency isn't something you ever stop looking to improve. Every time I am look through source code someone else wrote I am looking for neat tricks they've used to save a little time and every time I am looking through my own source code, I look for things that could be done better.
The thing is, there is a balancing act to maintain and two distinctly different aspects to deal with (in most cases).
Feel free to chime in, as I have stated, I am a rookie at this and still have tons more to learn.
Post here about your programming projects and coding for MyBB in general.
To be honest, posting about PHP/JS coding in general would be fine with me.
My friends online and IRL don't understand PHP, much less MyBB forum software. Sometimes when I am just dying to tell someone about a new idea I have had I realize that the person wouldn't care to even hear about it and I wouldn't care to try to explain it :p
The idea for this threads is similar to the Admin Scratchpad thread. In my opinion, that thread has become mostly about the design aspects involved in running a MyBB forum. Post here about your projects and coding for MyBB in general. To be honest, posting about PHP/JS coding in general would be fine with me.
I'll start:
I'm sure it won't be a revelation to any of you pros, but to a n00b with a little over a year of experience with PHP, it took me quite a while to understand what the search for efficiency is all about.
In my opinion, efficiency isn't something you ever stop looking to improve. Every time I am look through source code someone else wrote I am looking for neat tricks they've used to save a little time and every time I am looking through my own source code, I look for things that could be done better.
The thing is, there is a balancing act to maintain and two distinctly different aspects to deal with (in most cases).
- In the ACP side efficiency is (of course) still important, but you must keep in mind that taking a bit longer in an ACP function is a great idea if it will save the forum side operations any time at all.
The ACP code will be used by admins and of course we want to write good clean code for them, but none of that affects the forum's users when it comes to how efficient the ACP code has been written.
An example plugin might be a plugin for featuring specific threads and the threads OP that creates a database table and allows admin to add entries (lets say tids) to the db on the ACP side.
The most efficient way would be to simply save the info to the database, but if there is any processing at all on the forum side (perhaps the title of the thread from the tid and a short snippet of the first post, OPs username and formatting info) a smarter move might be to accept the input in ACP, store it in the database and then build a cache of the information with any and all extraneous information or parsing needed that can be done ahead of time.
- On the forum side of things, working from the database is obviously necessary from time-to-time and cannot be avoided, but when at all possible, use the cache to save multiple queries.
Also, keep in mind that if you are implementing a repetitive hook (like parse_message_start when on showthread.php) you need only load the cache entry once in the first call. So using a static variable and an isset() conditional will allow your implementation of that hook to work without a query or too much extra cache work either.
Feel free to chime in, as I have stated, I am a rookie at this and still have tons more to learn.
Post here about your programming projects and coding for MyBB in general.
To be honest, posting about PHP/JS coding in general would be fine with me.