New minimal scaffolder plugin

16 views
Skip to first unread message

Tiago Silva

unread,
May 20, 2011, 2:08:18 PM5/20/11
to colony...@googlegroups.com
Just added a new scaffolder plugin to demonstrate how small Colony plugins can be. The plugin is called pt.hive.colony.plugins.main.scaffolding.minimal, it injects into pt.hive.colony.plugins.main.scaffolding, via the scaffolder capability, and you can use it by typing generate_scaffold minimal <plugin_id> in the Colony console.

Some of the examples that were shown until now may seem quite big and give the wrong impression that Colony plugins require a lot of typing overhead, but this is not so. We personally go overboard on code conventions, and that is the end result... the extra effort definitely pays off for us, since we are a team, and we have learned that no good comes out of each one coding in a different way. However, all these code conventions may be unnecessary for single developers, and are uninteresting and "scary" for beginners.

This plugin was introduced in commit 14345.

João Magalhães

unread,
May 20, 2011, 2:55:54 PM5/20/11
to colony...@googlegroups.com
How many lines of code for the complete plugin including back end ?

Tiago Silva

unread,
May 22, 2011, 8:55:39 AM5/22/11
to colony...@googlegroups.com
124 lines of code for this plugin, which includes facade, system file, a console extension with a dummy command, a test suite with a test for this console extension, and an exceptions file with that plugin's base exception.

However, the mininum plugin one can make, can be as small as 5 lines of code, and it could be 4, if we made CPython the default platform ;).

2011/5/20 João Magalhães <joa...@hive.pt>

Markus Gattol

unread,
May 22, 2011, 11:08:01 AM5/22/11
to Colony Users
> code, and it could be 4, if we made CPython the default platform ;).

Which we won't do of course because soon we'll all be speed devils
using PyPy :-)
Message has been deleted
Message has been deleted
Message has been deleted

João Magalhães

unread,
May 22, 2011, 12:00:56 PM5/22/11
to colony...@googlegroups.com
We're really interested in pypy mostly because the sandboxing features of it.
It would be really interesting to have a sandboxed environment where anyone could install a untrustable 3rd party plugin in a machine of ours, without being able to compromise it.
Making pypy the default environment for the colony python implementation is a different story as it must first become the "de facto" standard for python before we can make it the default python platform, I guess... :)

Markus Gattol

unread,
May 23, 2011, 8:18:49 AM5/23/11
to Colony Users
sure thing, totally agree, but then I was just kidding a bit; I am
looking at pypy mainly for those reasons

- speed
- security
- shortened development cycles (no more need for C extensions)

The fact that it's RPython does not seem to be a (practical) problem
to me and my observations are that 8 out of 10 folks feel the same
about it. We shall see ... anyhow, we're getting offtopic, sorry,
didn't want to derail the thread. Back to "New minimal scaffolder
plugin" :)

Tiago Silva

unread,
Jun 1, 2011, 6:14:40 AM6/1/11
to colony...@googlegroups.com
By the way, I took the exceptions and test file out of this scaffold, to make it the minimal useful plugin, which is a plugin, with a command, and console extension to invoke that command. It is now 54 lines ;)

Tiago Silva

unread,
Jun 1, 2011, 6:20:20 AM6/1/11
to colony...@googlegroups.com
Also, the minimal mvc scaffold (generate_scaffold minimal_mvc <plugin_id>), which creates a mvc plugin with a specified model, controllers providing CRUD logic for that model, RESTful routes to interact with this logic, and a simple web interface, is currently 138 lines of code, thanks to the new helper methods provided by the web mvc utils plugin ^ ^.
Reply all
Reply to author
Forward
0 new messages