Support Forum

Setting the V5 Ground Rules

YS Yellow Swordfish
Yellow Swordfish
Member

Well – perhaps not so much rules as goals. These are mine for starters as I am sure there will be more. All need a discussion before adopting so feel free to shout, sigh, groan, improve upon, add to or vote to throw out etc.

  1. All database queries, without exception, to go through a central processor. This to contain proper error trapping and reporting. Syntax and routines to be defined.
  2. Clean up and make consistent the returning format of data. We currently converted much to be returned in arrays but not all of it. Propose ALL data is returned in arrays.
  3. All filtering should be carried out in the database layer. Select queries should filter the presentation data before returning with Insert and Update queries filtering data pre-save. If we can get filter calls out of the rest of the code it makes that code easier, cleaner and more efficient.
  4. Cache anything and everything that can be cached whether in-line (such as we are currently doing with avatars and signatures) or in transient storage (WP’s or our own). A good example would be the entire $sfglobals array and even the $current_user array. We would need to check carefully but in principle none of this data should change during a users session so why keep loading it every page. This is, of course, subject to permissions.
  5. Additionally to 4 – we should store forum settings and options in transient storage as well. We currently look them up as needed which often results in repeated checks and calls.
  6. Consider combining $sfvars and $sfglobals – do we really need both?
  7. Display as we go. Time to stop building entire pages as a variable and outputting as we build in chunks. Might not speed up page loading but will make it feel faster and more responsive.
  8. Keep the current admin methodology intact. We have invested a lot of effort in it and it works well.
  9. Add action and filter hooks everywhere.
  10. Document ALL functions.

Actually forgot to add a couple of things but these are not 'rules'.

(1) Let's define a new set of default admin panel colours for 5 – Steve – that's for you. (2) Let's create a new 'upgrade' and 'install' script for 5 instead of just adding stuff to the current files. We can work out later how to weave ot together. And… i would like to suggest that ALL database changes go in one place at the top.

23 Answers

New Answer

MP Mr Papa
Mr Papa
Member

think we need to set up some sort of precedence…  do we want to do this stuff first?  or work in the templating and plugin stuff first? or other order?

but everything we are doing for 5.0 is major changes…  so we should have a plan of attack…  do we want to fix all the db stuff and/or caching (transients) in a known quantitiy (ie 4.3 starting point)…

agree with most here, but couple comments…

#7 – fine philosophy to be remembered and practiced but before implementation, likely need to see how the templating stuff turns out…

#9 – oh yeah, but lets wait until we have new structure (templating) and apl (plugin) in place for we do too much here..

so basically, restructure and improve first, or template and api first?  Think we should put together a schedule of tasks…  they dont need completion dates or anything like that, but an ordered list of tasks to do…

YS Yellow Swordfish
Yellow Swordfish
Member

I'll have an initial go at sequencing see where I get…. wil publish here.

JAMES…are you about reading this? Fancy getting your hands dirty on some coding?

MP Mr Papa
Mr Papa
Member

doesnt have to be completely serial, but at least some dependencies…

sounds good!

LU Luffer
Luffer
Member

Yellow Swordfish said:

I'll have an initial go at sequencing see where I get…. wil publish here.

JAMES…are you about reading this? Fancy getting your hands dirty on some coding?


 

Yes, I'm reading this. Need to sort myself out a bit with regards to coding. Not sure if I asked you guys this before. Do you delvelop using an IDE to code and check in/out files, if so which one? Or do you prefer a plain text / code editor and just use the SVN seperatly?

I have nothing set up at the moment, since my PC issues a couple of months ago I've not even got round to setiing up the SVN again… I know, very bad 🙁

Perhaps it would be better to take this to a seperate thead, but since I've not been involved in PHP stuff before I don't know what the common practises are. How do you guys do it?

Finally, and feel free to laugh at this… but do you have any design documentation on how the plugin is structured? Or any sort of high level overview? It's a big beast of a plugin to dive into!

As I said earlier, feel free to start a new thread to answer this so I don't drag this one off topic!

YS Yellow Swordfish
Yellow Swordfish
Member

Luffer said:

 

Yes, I'm reading this. Need to sort myself out a bit with regards to coding. Not sure if I asked you guys this before. Do you delvelop using an IDE to code and check in/out files, if so which one? Or do you prefer a plain text / code editor and just use the SVN seperatly?

I can only speak personally here as the only Mac user! I have tried a couple of IDE's, including the excellent Zend. The problem I find is that WordPress sort of gets in the way. You have to carry around all of the WP code for the IDE to make sense of our small bit. I would love to know if other plugin authors have managed to set a decent IDE up without but i somehow doubt it. So I use a bloody good editor (bbEdit for OSX) which has built in svn and a great and extensive tooklit.

I have nothing set up at the moment, since my PC issues a couple of months ago I've not even got round to setiing up the SVN again… I know, very bad 🙁

Perhaps it would be better to take this to a seperate thead, but since I've not been involved in PHP stuff before I don't know what the common practises are. How do you guys do it?

Not sure how to answer that. I guess it all comes down to knowledge of the code and I appreciate that is a tall order starting from scratch. We have a few users who have managed it though. Maybe Steve can provide some insights as someone who came to the project after it was already going.

Finally, and feel free to laugh at this… but do you have any design documentation on how the plugin is structured? Or any sort of high level overview? It's a big beast of a plugin to dive into!

OK… here goes… Ha ha ha ha! Ho ho ho ho heh heh ha.

As I said earlier, feel free to start a new thread to answer this so I don't drag this one off topic!


 

Seriously we are both happy to help out and point you in the right direction for anything. If you really do fancy some coding I started learnng php from an O'Reilly pocket guide and I still dip into that sometimes. I am sure we could find some discrete little projects to start out with that were simple and self-contained.

LU Luffer
Luffer
Member

Yellow Swordfish said:

Perhaps it would be better to take this to a seperate thead, but since I've not been involved in PHP stuff before I don't know what the common practises are. How do you guys do it?

Not sure how to answer that. I guess it all comes down to knowledge of the code and I appreciate that is a tall order starting from scratch. We have a few users who have managed it though. Maybe Steve can provide some insights as someone who came to the project after it was already going.

What I was really asking was how you have things set up when you're working with the plugin. I'm struggling to put into words exactly what I mean…. But the processes you have in place for writing the code, then testing it etc.. For example, in Visual Studio and C++ I can compile and test/debug the code. How do you do that? Obviously there is nothing to compile, but what do you do with regards to debugging etc..?

Fairly basic PHP questions I imagine, I can probably find answers by reading some websites devoted to the subject. I'm not looking for massive explainations, just how you work because if it works for you and I can do the same I'm guessing it will make things a lot easier.

OK… here goes… Ha ha ha ha! Ho ho ho ho heh heh ha.

Seriously we are both happy to help out and point you in the right direction for anything. If you really do fancy some coding I started learnng php from an O'Reilly pocket guide and I still dip into that sometimes. I am sure we could find some discrete little projects to start out with that were simple and self-contained.

LOL, I guessed that would be the case. I guess I just need to grab a copy of the code and play with it until stuff starts to make sense Smile I appreciate you willinigness to offer help, but I'm concious of taking up your time when it could be better spent focused in other areas rather than giving me the PHP for dummies treatment.

I'm bound to ask a lot of stupid questions, as I've said it's years since I did any serious coding. So I am grateful that I don't need to worry about making myself look like a complete idiot Wink

MP Mr Papa
Mr Papa
Member

speaking from the pc side…  I do use an IDE though not nearly the beast of visual studio…  as Andy mentions, from an IDE perspective, WP gets in the way and makes it very difficult to use a debugger on the plugin itself since every page load starts with WP…  so most debugging occurs with special code or use of the ashow() or vshow() functions defined in sf-debug.php (basically print statements)…

so we tend to be pretty simplistic compared to a normal commercial endeavour…  We use wamp, xamp or similiar server environment on our computers…  we tend to check wordpress out of svn so we can keep that up to date more easily…  we check SP our of svn so we get udpates… we also tend to have multiple sites set up on localhost so we can test or play with diff versions…

My IDE is phpDesigner which I have found to be quite nice…  It has the ability to work directly wtih SVN and of cours xdebug, but I tend to not use either one of those from within the IDE… so its mostly just an editor…  I use tortoise svn as my svn client and just keep my checked out repos up to date manually when needed…

We have been a bit lax in commenting our code – the inline is better than before functions/etc… we aim to do better with 5.0…

we do have some coding standards but you will see diff styles between andy and myself (ie spaces after if or while before the {)…  it will become pretty obvious just trawling through the code…

As andy says, we are quite happy to walk you through just about anything – just ask!

YS Yellow Swordfish
Yellow Swordfish
Member

I am not a great coder. I tend to be pedantic and don't take short cuts. There again – when I look at a bit of my older code I can usually see what is going on and why it is like it is which is more important to me in the long run.

I recently took a quick look at the first WP plugin I ever wrote back in 2005 and it was awful! But, interestingly, it wasn't so much my coding that was awful even though it was my first brush with php. It was my understanding of the WP core platform that was awful.

A lot of WP may be annoying and their code documentation sucks as much as ours does – but the more you dig the more you find useful core functions that you can make use of and a decent framework for doing stuff. Many, many faults but littered with gems. And learning that takes much longer.

Mac OSX, is built on a firm Unix base. it comes bundled with apache, mysql and php etc., so it is easy to set my laptop up as a server. So I just have local websites for just about every release we have ever made although I have wiped everything prior to v4.0 now. The only thing I refresh while working is the database which I pull after each release from the public site to give me a good healthy set of data for each release. I use a good MySQL application (Mac only but there are PC ones about) which I find invaluable. phpMyAdmn is good but it is slow and very pedantic. More so than my coding! I use a decent editor and while my editor can handle svn I also use an svn client because it give me better control and messaging.

When both Steve and I are working on code I update my local copies regularly so I get his changes. At least twice a day. I commit changes as soon as I feel they are stable even if unfinished so Steve can also get them in case of conflicts or knock on effects.

i tend do do most of my work in a copy of our public theme although will regularly check things in other themes if I feel there may be a theme related issue.

Personally, I always have at least 7 tabs open in my browser. Admin/Site of our public site. Admin./site of whatever version I am working on. The wiki, The translate forum and Mantis.

php is not great as far as debug tools go. I just as often will use echo or print_r to view variables and arrays/objects. I have put a wrapper around these in our sf-debug.php which makes it a little easier and it is far easier to search for 'vshow' (which runs an echo) when you have finished with it than trying to find an echo in reams and pages of legitimate echo statements! I keep adding to sf-debug.php when things are needed.

As I said before – I would love to find a decent IDE but so far have not really had much success with one. There are more choices for Windows though so something might work well.

And the main problem with php? Too many damn functions and too many different ways of doing the same thing. This is mainly because of the way it has grown from when it was started and called 'personal home page' which tells you everything really! But I love it all the same even if it does have just about the lousiest error reporting ever imagined.

I doubt I have helped at all here!

LU Luffer
Luffer
Member

On the contrary, that's helped quite a bit. I already use XAMPP on my PC to host the local copies of any sites I'm working. I also use Tortoise SVN (when I have it set up), which you guys pointed me to in the first place.

I was wondering about how to edit the PHP code. My limited research (I have done some) seems to indicate that Eclipse is quite a popular PHP IDE, but your comments about how the plugin ties together with WP have made me question if it's worth persuing…

I'll maybe look at a couple of reasonable editors rather than a full IDE.

MP Mr Papa
Mr Papa
Member

which is exactly how I ended up with phpDesigner…  not quite a full IDE but a lot of the same characteristics and I dont use most of those… mainly the editing and syntax highlighting…

LU Luffer
Luffer
Member

Got phpDesigner installed as well as TortoiseSVN, but I'm having a problem getting the repository to download. Trying to use https://simple-press.com/svn/ but it says:

Repository moved permanetly to “https://simple-press.com/svn/”; please relocate

I'm probably doing something stupid, but it's ages since I set it up before and I can't find the instructions you sent me the first time around.

In other news… I've been doing some background reading on PHP. It's reassuringly familiar to C++, maybe it won't be as horrendous to learn as I'd thought. But then again, it's similarity to but not actually being C++ may be my downfall Confused

So anyway, SVN… help?

YS Yellow Swordfish
Yellow Swordfish
Member

The 5.0 svn repository is at http://svn.simple-press.com/branches/5.0.0

php like C++ ? Wasn't really my impression. Well yes – as far as structure perhaps. But no pointers. Never did really get my head around pointers! You can pass values by reference and there is a lot more oop stuff  in php 5.

Have a litle fun…

LU Luffer
Luffer
Member

Well I was reffering to it in terms of syntax, all looks pretty familiar. Same structure for for, if, while, do loops etc.. Also uses familiar operators, seems a bit weird not defining types for variables though, that freaks me out!

Yes pointers are evil but similar to reference I guess. A pointer just points to the memory location rather than copying the value, man it's years since I used pointers. I'm glad I'm not the only one who struggled with them! It was when you got to into virtual pointers and pointers to functions that things start to get weird!!! LOL

MP Mr Papa
Mr Papa
Member

as to svn… if you had it before, you may need to destroy your repos and recheck them out…  they were all damaged in the hardware failure of a week or two ago…