Hero Image

Tech Tips

Technology Tips

Marginal Gains & Technology Tips

Sir David Brailsford, a world-renowned cycling coach, is well known for his concept of “Marginal Gains." His idea was that if you could improve by just 1% each day or even each week, that you could produce a dramatic increase in results overall and/or by the end of the year.

He employed this strategy with Team Sky, the British cycling team, which then went on to produce 5 Tour de France wins over 7 years. This would do things like bringing their own mattresses to each new hotel, so the riders would sleep on a consistent surface, the same look/feel/smell every night. This resulted in improved sleep by about 6%.

They would do similar things with materials, weights, training patterns, etc. Each item brought a slight gain of 0.5 - 1%.

So what does the concept of marginal gains have to do with your work in technology?

We first have to ask ourselves if the same concepts can be applied to what we do. To web development and design. If we can make small, incremental, improvements each day…then we can potentially get 37x better and faster over the course of a year. Are you up for the challenge?

To help make these marginal gains, this blog will be a resource that shares small tips, shortcuts, insights, tools, etc. every week. 

Please stay tuned for trusted tech tips from OPIN's Director of Technology.

Image of a person working on a laptop

 

Drupal Console & Generate:Module

November 3, 2020

From the ground up, it has been built to utilize the same modern PHP practices which were introduced in Drupal 8. Drupal Console started as a scaffolding tool but evolved into a full CLI with the help of multiple contributors.

The Drupal Console makes use of the Symfony Console and other third-party components which allows you to automatically generate most of the code needed for a Drupal 8/9 module. In addition, Drupal Console helps you interact with your Drupal installation.

The command that I am sharing today is one of my favourites: “generate:module”. This command creates the scaffolding needed for custom modules and allows you to start off with all of the files, basic details, and templates that you need for any custom module development. Simply run the command, with some options, and follow the prompts to create your starting point and scaffolding.

Example:

Generate a module specifying the module name, machine name, the path, its description, Drupal core and the package name. In this example, the composer file, the unit test and twig template are generated too.

Example image of the Drupal Console Generate:Module

Stay tuned, for another great Drupal Console command!

 

Drupal Console & Create:[content]

 

November 10, 2020

Until now, the Devel Generate module has been used to add dummy content to Drupal but there is a better way.

The following commands, that come with Drupal Console, allows you to add various pieces of content to your system, for testing.

  • create:comments

    • Create dummy comments for your Drupal 8 application.

  • create:nodes

    • Create dummy nodes for your Drupal 8 application.

  • create:roles

    • Create dummy roles for your Drupal 8 application.

  • create:terms

    • Create dummy terms for your Drupal 8 application.

  • create:users

    • Create dummy users for your Drupal 8 application.

  • create:vocabularies

    • Create dummy vocabularies for your Drupal 8 application.

Create:Nodes Example:

Provide the content type name.

Create:Nodes Example

Provide the limit of publications, the limit of title words, time range and language.

Create:content

Each create:[content] command has various options that you can use and include. You can check out a full list here: https://drupalconsole.com/docs/en/commands/

Stay tuned for next week's tech tip!

 

Drupal Console & Debug:[xyz]

 

November 19

One of the pain points of Drupal comes from having to debug anything from contributed modules to your own custom modules, and even core issues that may come up. Although we have many tools such as xdebug available to us, sometimes more is needed.

This is where Drupal Console’s debug:[xyz] command helps out!

There are over 35 debug commands that you can use to help configure Drupal, troubleshoot Drupal, or even just decide what to do next. Some example commands are as follows:

debug:cron

This command lists all modules in your system that are implementing cron. It is very useful to debug any cron issues and to see if there are any conflicts.

debug:migrate

This command displays the current migrations available for the application, along with their details. Migrations are hard, especially if we are inheriting them from someone else. This command helps you get organized.

debug:router

This command displays current routes for the application and can also display information for a particular route. Let’s face it, we have all had router issues with our custom modules. This is very useful to help you quickly determine if your routes are properly registered.

debug:update:composer

This command displays the current updates available from the composer file. This is useful for when you recognize there may be a bug with a module and you are not sure if there are updates available. A simple command run will help you determine what to do next.

There are many more examples that you can utilize and review. To see a complete list, check out the documentation at https://drupalconsole.com/docs/en/commands/

Happy dubugging!!!

 

Steve Lavigne

Director of Technology

Steve is a passionate storyteller who thrives on challenging the status quo. He is an avid researcher with a keen analytical mind able to strategize on technology, sales and marketing decisions by analyzing data and behaviours across various industries and technologies.

Ottawa

320 Catherine St.
Ottawa, ON K1R 5T5
TEL: 1 (877) 257-6746

Saratoga Springs

153 Regent Street
Saratoga Springs, NY 12866
TEL: 1 (877) 257-6746