Coding Conventions

preview_player
Показать описание

3 Ways to spruce up your code. Make your code look smarter by learning how to name things and format your code nicely.

Let me know in the comments: what area do you need to improve in to keep your code looking nice?

6 Tips for Every Coder Playlist:

Chillhop Music Credits:
Рекомендации по теме
Комментарии
Автор

I'm surprised someone with content as good as this doesn't have more views. Your advice is really good. Keep up the great work!

rhysbaker
Автор

"Don't change the style of existing codebase", huh? Let me tell you the story of an exception. I once had to maintain code written by a programmer who was used to code on very old systems, I'm talking about MS-DOS era, so he mixed and matched tabs and spaces at will. On his machine, it look fine. On mine, indentation was all over the place. And his lines of code were very long, so I'd often have to scroll left and right to understand what a line did.
For that, I took a drastic approach. First, get rid of all tabs. Second, make every level of indentation ONE space to the right of the previous one, because one space is always one space. In the end, I could finally read the code. Since then, I've always used one space for indentation levels when writing in C.

DevilMaster
Автор

Great video! I disagree with the underscore prefix for class members though. While technically possible to access class members without the "this" keyword, I always considered this to be an antipattern. I keep my member variables underscore-free and always use the "this" keyword to access them. This way, I leverage language features instead of loading off the distinction to a naming convention. This also makes IDE-assisted refactoring much easier and less error-prone in my experience. I also deliberately leave out the "I"-prefix for Interfaces in C# because I think it's silly. Maybe it's inconsistent with most libraries for .NET. In most other places, I follow the official style guide to a t, though.

arminmatthes
Автор

I like my code how I like my favourite moments on TV...
One liners

timwatz
Автор

I'd rather change to wingdings font than code with indentation. It's a mess either way.

InsaneFirebat
Автор

Seems like a good video.
Shame I can't hear half the words because of the overbearing elevator music.

haltsmaul.