Kids, Code, and Computer Science Magazine

What is Clean Code?

Jenny Lee Silver on Flickr

While you can't use soap and water on your code, you can keep your code as sparkly clean as any dish or silverware.

he term “Clean Code” could be confusing for beginners. What does it mean? You clean the car, you clean your bedroom, how do you clean your code?

Lets start by thinking about almost the opposite of Clean, which is Messy. You can imagine a messy room, and I’m sure you can also imagine messy code. When I think about messy code, I think of lots of lines of code, poorly named variables, multiple classes in the same file and so on. In the same way it is difficult to cross a messy room, it is difficult to read and work with messy code.

What are the benefits of clean code?

There are multiple benefits for writing clean code, here are some of the main ones:

  • It is easier to understand.
  • You can tell what the code will do.
  • You will be able to understand it, even when coming back to it after 6 months.
  • Other people will be able to understand it.
  • It will be easier to maintain.
  • It will be easier to test.

What things can you do to write clean code?

Here are some of the main things you can do towards writing clean code:

 

Become a subscriber and get access to the rest of this article. Plus all our magazine articles.

Stories also include numerous links to help parents, kids, and teachers learn more. Get access today at just $15 per year!

Subscribe Today!

Also In The June 2017 Issue

Can we measure the time and steps required for things to happen?

This Canadian experiment used a robot to explore how people respond to robots and technology.

An amazing new book turns math problems into shapes and illustrations.

This pen and paper project helps organize ideas into stories with a finite state machine.

While you can't use soap and water on your code, you can keep your code as sparkly clean as any dish or silverware.

This project explores the basics of using Google's Static Map software to display your own maps.

Most people love cookies. But these cookies are the kind that make the internet possible.

Links from the bottom of all the June 2017 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for June 2017.

Software languages don't magically appear. They're created by design. First in a series.