@include Welcome(); to mixins.

Don’t Repeat Yourself (DRY) is a common software development principle.

If 10 places have the same functionality. Writing the same code 10 times would break this DRY principle. Non-DRY code is humorously considered WET. “Write Everything Twice”, “We Enjoy Typing” and “Waste Everyone’s Time”.

The reasoning behind this, is that any change would lead to editing all 10 different places. Editing multiple places can be horribly tedious and error prone.

A much better solution would be to write the code only once and reference it from other places.

Much like Harvard Referencing, or when giving credit to someone’s written work, Mixins allow you to point at some other information and paste it in place of your reference.

Another benefit to this, is that the information you’re pointing to might be quite large, a shorthand can be useful.

Mixins have other uses as well, and in some languages are used for creating an object from multiple concepts. The Michael Gregory object is a composite of Computer Programmer, Musician and Mullet Enthusiast.

The specific syntax you are seeing here is from SCSS or SASS. When creating webpages, we specify the colours and style of the website using CSS. SCSS/SASS allows us to re-use code along with many other useful features.

More information on SASS’ mixins can be found at https://sass-lang.com/guide#topic-6 .

If you’re into something a little spicier, these pages on Java Recursive Generics and the Curiously Recurring Generic Patter might be of interest.

https://vyazelenko.com/2012/03/02/recursive-generics-to-the-rescue/

http://www.unquietcode.com/blog/2011/programming/using-generics-to-build-fluent-apis-in-java/

share this post

Share on twitter
Share on facebook
Share on linkedin
Share on email
 let's have a proper conversation contact us

let's have a proper conversation

more to explore

2021 has been an eventful year!

We’re looking back and reflecting on everything we’ve achieved this year. Thank you to everyone who has worked with us this year. We’ve been fortunate

One person standing in a warehouse, surrounded by professional lights, audio equipment, and cameras. This is part of Creative agency, Colonel Duck's Video Production in Birmingham with BVSC to capture real life stories.

productions

we create and deliver captivating content that audiences engage with.

Two computers next to each other, one showing a web application, created by software agency Colonel Duck, called Pre Enrolment, and the other with software related code

systems

we build and evolve robust platforms that people want to use.

The BBC live streaming one of the Multiple Disadvantage day events, a choir singing, in Birmingham Grand Central Station.

campaign

we design and manage effective campaigns that exceed set targets

info@colonelduck.co.uk
0121 426 3776
Studio 2, Weekin Works
112-116 Park Hill Road
Birmingham
B17 9HD

This site uses cookies: Find out more.