I just rewrote the part that is responsible for creating Friendica messages.
A last minute change was that this is now a class and the class functions are called statically. I'm using the class here mainly as some kind of namespace and to hide private functions that needn't to be exposed.
I'm planning to do the same for OStatus and Diaspora.
I like the idea of using classes as namespaces. I think we should have a look at the whole structure of the system.
We could do like this:
- Files under /mod should never be included from other files
- Most code should be removed from files under /mod and should be transferred to /include
- There should be a class per file under /mod (if there are more than the default functions)
- Functions in that class should be defined as "private" per standard. (With exeception of the ones, that are called from /mod)
- Functions of general use have to be moved to other files
- Functions should be separated between "frontend" and "backend" if possible. This would reduce the memory load.
- In these files we are using classes as well (for example: we could create a class named "network", so that we had the functions "network::get" and "network::post" instead of "z_fetch_url" and "post_url")
- Our existing "App" class should be modified so that it can handle with static calls. This is better than having to transmit the variable $a at every place or to fetch it via "get_app()".
What do you think?