Gafes
In Portuguese, "gafe" means a mistake or social blunder. In the context of software development, gafes are common errors that can disrupt projects, cause downtime, or create security risks. Recognizing these pitfalls is the first step to avoiding them. This page lists some frequent mistakes encountered in Drupal and open-source development, along with tips to prevent them.
Common Gafes (Mistakes)
- Not clearing Drupal cache after changes — Drupal's caching system can cause confusion if you don't clear caches when adding new code, themes, or modules. Always flush caches after significant updates.
- Hardcoding URLs — Using absolute URLs or hardcoded paths instead of Drupal's url() function or base_path leads to broken links when the site is moved to a new environment.
- Modifying core or contributed modules directly — Overriding core files or editing contributed modules makes upgrades impossible and can break your site. Always use hooks or custom modules.
- Ignoring update notifications — Drupal provides security and bug updates. Neglecting them exposes your site to vulnerabilities and stability issues.
- Not using version control — Code changes without Git or other VCS lead to lost work and difficult debugging, especially when collaborating.
- Poor database practices — Running direct SQL without using Drupal's database abstraction layer can cause compatibility problems and security holes.
- Overlooking accessibility — Drupal has strong accessibility features, but failing to test with screen readers or ignoring color contrast makes your site less inclusive.
By learning from these common gafes, developers can build more robust, secure, and maintainable Drupal sites. Explore more articles and resources on Pedro Rocha's blog.