PDA

View Full Version : i hate default namesace of Designer ! Good time to change it is now ! My Proposition



holicon_abg
22 Feb 2012, 5:41 AM
ExtJs 4 MVC (namespaces, filename, name convention, standarize it)

app

controller (plural, camelCase)

App.js - Application Controller extends by User (sometimes call main controller)
Users.js

className: APP.controller.Users

id: UsersController

extend: APP.controller.App

UserProfiles.js (plural, camelCase)

className: APP.controller.UserProfiles

id: UserProfilesController

extend: APP.controller.App


model (plural, camelCase)

Users.js
UsersProfiles.js

store (plural, camelCase)

Users.js
UserProfiles.js

view (controller name, underscored)

App.js - app viewport
users

index.js

className: APP.view.Users.Index
alias: widget.UsersIndex (composite Users.Index without point)
id: UsersIndex

view.js
add.js
delete.js

user_profiles

index.js

className: APP.view.UserProfiles.Index
alias: widget.UserProfilesIndex (glue UserProfies.Index without point)
id: UserProfilesIndex

view.js
add.js
delete.js



anu suggestion ?

inspired by CakePHP and Rails class name convention and file struct.

ssamayoa
22 Feb 2012, 7:08 AM
1. Model = Entity = singular

2. Controllers and views are loosely coupled and I can have a single controller which "uses" severar views and viceversa. If you tie your views to your controllers is your personal choice.

3. Namespace based on directory is ok for me. I'm java developer so I feel natural and good practice. Just use that way.

For example, all "user" related views could be in "user" or "users" (is your choice) namespace. "Package" name part is lowercase in java and I'm ok with that but if you preffer camelcase starting with upper or lower case and/or with underscores is your choice.

Regards.