10 Things I Hate About [Drupal] Code
Mark Jones
@JustAnotherMark
Intro
Things That Annoy Me
- General
- Drupal Modules
- Drupalisms
- Finally
General
1. Coding Standards
- Understanding
- Consistency
- Collaboration
General
1. Coding Standards
- Read drupal.org
- Use Codesniffer & git hooks
- Raise issues & make patches
General
2. Commit Size
- How to undo a problem commit?
- Where is the bug?
- When did the build break?
General
2. Commit Size
- Use
git add -p
- Standardise message format
- Reference task/bug in message
Modules
4. Field Collection
- Mostly works
- Hard work when it doesn't
- Unnecessary complication
Modules
4. Field Collection
- Custom entity/node type
- Entity reference
- Inline Entity Form
- More reliable, consistent & Drupal-y
Modules
5. Workflow
- [Mostly] functional
- Poor UI/UX
- Outdated structure
- Slow development (although improving)
Modules
6. Date
- Abandoned until last month
- Still 1089 open issues & 567 bugs
Modules
6. Date
- No alternative
- Search for similar issues when the arise
Drupalisms
7. Module All The Things
- Large site can have >100 modules
- Temptation to put every alter in separate module
Drupalisms
7. Module All The Things
- Group sensible changes together (especially Features)
- Consider submodules
- Use .inc files
- Avoiding too many modules
- Do you really need a whole module for one feature?
Drupalisms
8. Hacking Core (or Contrib)
Drupalisms
8. Hacking Core (or Contrib)
- Bugs happen
- Create patches directory/file
- All patches must have a d.o issue
- Check back often
- If specific use case add alter
Drupalisms
9. Contrib
- Difficult to find modules
- Difficult to compare modules
- Difficult/absent maintainers
Drupalisms
9. Contrib
- Check popular distributions
- Check most popular modules
- Blog posts
- Podcasts
- SimplyTest.me
Drupalisms
10. Admin Area
- Hardcoded listing pages
- Strange structure
- Difficult to customise
Drupalisms
10. Admin Area
- Admin Views module
- Admin module
- Admin Menu module
- Module Filter module
- Filter Permissions module
Finally
Code I've Written
- Accept criticism
- Encourage debate
- Be bold
Summary
D8 Summary
- Coding Standards - Big structural changes
- Commit Size - Unaffected
- Bad Commenting - More important (annotations, class discovery, etc)
- Commented out code - Unaffected
- Field Collection - Please stop
- Workflow - State revisions in core, https://groups.drupal.org/workflow
- Date - Date component and field in core
- Module All The Things - Some improvement in discussions
- Contrib - Hopefully lose some in the process
- Admin Area - Mobile improvements, List pages are Views
- Code I've Written - Always improving
←
→
/
#
General
3. Bad Commenting
http://www.flickr.com/photos/lobsterboy1980/3565047496