16 Jul

Weekly Update 110: Show us your code

This is a copy of our weekly newsletter for developers which you can subscribe to here.

Hello contributors,

I'm very proud that we get lots of people starting their programming lives by contributing to DuckDuckGo. Together with the welcoming community, my hope is that it's an opportunity both to learn new skills and to be part of a greater mission that benefits people around the world.

But programming's not easy and we all run into bugs and errors. That's why we have an #ask-anything Slack channel where you can ask for help with any problem, big or small. To make this easier, however, I have one bit of advice for when you seek help:

Submit a pull request!

You may feel a bit shy about people seeing your code before it's ready, especially if you know it doesn't work properly, but it's worth being brave and making it public. If you make it clear that it's a work in progress, then there's no pressure to have working code, and it also makes it much easier for others to help you. We have some highly skilled developers who are happy to help with issues whenever they see someone in need. Being able to put comments next to specific lines in GitHub is very effective for this. Not only that, but other programmers who see the code will learn from it as well.

So don't be shy! Show us your code and feel free to ask (or answer) questions in Slack. If you've not joined yet, you can invite yourself here. And if you're just not sure what to work on, here are some suggestions...

5-minute Fixes

More quick fix ideas here...

Weekend Warriors

More high priority fix ideas here...

IAs for Adoption

The following Instant Answers are looking for a maintainer — someone to moderate suggested changes from the community as well as address any issues that pop up in the future. If you'd like to step forward, please create an issue on GitHub using the button at the bottom of each IA page.

Quick Tip

We've been neglecting JavaScripters so let's put that right. An easy but important tip to improve your JavaScript code is to add this line:

'use strict';

either at the top of your whole script (my recommendation) or within a function.

As you can probably work out, it tells the browser or JavaScript parser to be strict with your code. As a result, it will complain if you:

  • Declare variables without var
  • Use eval() inappropriately
  • Use reserved words as variable names
  • Use the with keyword

These, and a few other advantages, will make your code more secure and help you develop better coding practices. In addition, because it's just a string, it will be ignored by browsers that don't understand it, so you don't need to worry about backwards-compatibility issues. A double win!

And as a bonus, it can be used in Perl too, although the syntax is slightly different:

use string;

Whichever language, I recommend you use this in all your code unless you have a very good reason not to.

And with that, we wish you all a safe weekend.

- The DuckDuckGo Staff

0 Tweet

This blog has been archived

Thank you for reading and contributing lively discussion to our blog! Read more posts about online privacy on our new blog at spreadprivacy.com.