Moving app development to the next level, better APIs, cleaner code

The current way of writing ownCloud apps is quite cumbersome and unclean, and often resorts to writing what I call "naked PHP code" in app.php which is code that isn't wrapped into functions or classes.

The way I see it, it would be better if apps would be able to declare and register more things in info.xml, like an entry point class. The entry point class would implement a specifically defined interface which helps enforce a given format for apps.
Also, if the app implements an older version of the interface, it should be easier to catch such errors when loading the app (catchable exceptions).

Now have a look at the service-based proposal here:

With services, we could say that most things that an app defines nowadays could be implemented as service consumers. Basically, core would be a provider for the following services:
- frontend entry points: to specify app navigation entries, templates, javascript and CSS files to load
- admin page entries
- personal page entries
- filesystem services
- ...
Note that backend code would rather be registered as an own service provider by the app itself.

This means that a new app would specify in info.xml whether it implements the frontend service, if it has a frontend (not all apps have one).
An app that needs filesystem access can declare itself as consumer of the filesystem service, and receive it injected on the PHP level.

Note: need to see how this would work on the JS level too.

What I forgot to mention is that with services, apps would not have a single entry points. The entry point is actually the info.xml file.

However if we'd go without services, we should still provide at least a real class (IApplication ?) as an entry point instead of naked PHP.

The overall goal is to work more with classes and interfaces to have these better enforced.