convention for naming controllers

117 views
Skip to first unread message

Dmitry Polyanovsky

unread,
Jan 6, 2014, 3:28:21 PM1/6/14
to chica...@googlegroups.com
Hello Bosses,

there is important question to all CB community, regarding one of the CB features. I proposed to get rid of %appname% in name of controllers, as it was prior v0.6. Actually, %appname% was added as requirement to allow running few apps on same server without conflicts. Proposed change is to automatically prepand %appname% to controller name, as currently happens with views.To minimize breakage we should probably use the existing convention for the compiled controller -- actually, to be 100% backward compatible we could simply prefix the application name if it isn't there already, i.e.

myapp_foobar_controller.erl -> myapp_foobar_controller.beam
foobar_controller.erl -> myapp_foobar_controller.beam

Pros:
* code portability/re-usage
you can easily move controllers across apps (i.e. have some kind of packages by having related controllers, models and views moved together).

Cons
* The main issue for me is that automatically prefixing the app name creates another layer of mystery. Right now if I create myapp_foobar_controller, I can debug it in the console because I know the module name is myapp_foobar_controller. With the auto-prefix I create foobar_controller, but then I don't see any such module loaded in the console. (Evan)
* additional development and breaking things
* Using Wrangler is preferred option
* common practice is to use separate apps, so code portability/re-usage of controllers is not even an issue. (no packages needed)

Vote! add your thoughts!

Ilya Shuma

unread,
Jan 6, 2014, 4:36:21 PM1/6/14
to chica...@googlegroups.com
Hello, Dmitry!

We use ChicagoBoss to develop dozen of applications, that share common functional with separate CB applications, used as a dependency.

So, as for me, i think, that currently used myapp_foobar_controller.erl naming is preferred.

Cuong Thai

unread,
Jan 8, 2014, 6:00:00 AM1/8/14
to chica...@googlegroups.com
Hi Dima,

There's no problem with myapp_foobar_controller.erl

Regards,
Cuong Th.


Romu

unread,
Jan 15, 2014, 10:31:17 PM1/15/14
to chica...@googlegroups.com
I think 'myapp_foobar_controller' is ugly.  Why do we have to include 'myapp' and 'controller' in the naming?

Thanks
Simon

Kai Janson

unread,
Jan 17, 2014, 12:46:40 PM1/17/14
to chica...@googlegroups.com
Since Erlang doesn't have namespaces, that's one way to "create one".

--Kai
Reply all
Reply to author
Forward
0 new messages