Write BETTER Code! 7 Tips to Improve Your Programming Skills

preview_player
Показать описание
I've compiled seven programming tips for anyone who is new to coding that will help make your code more readable and easier to work with. These tips are based on some clean code principles but I've tried to distill them into a simple concept for beginners.

P.S. Apologies for my face being blurry. The focus was not set correctly. Hopefully it's not too distracting! :-P

*** DOWNLOAD THE FREE REPORT ***
Рекомендации по теме
Комментарии
Автор

30+ years of coding - and I still needed to hear this...

jean-pierregygax
Автор

Great video! Your tips encapsulate my all-time favorite quote:
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler

InfallibleCode
Автор

Good tips man! Definitely a good watch!

1. Avoid abbreviating variables (pw => password)
2. Limit function arguments (aim for 3)
3. Simplify conditional expressions
4. Declare variables close to their usage
5. Avoid unintended consequences in functions
6. Functions should do one thing (avoid long functions)
7. Stop writing zombie code

FLUoooECG
Автор

if (true == true) {
return true;
}

I never saw so good code like this in my life.

JHVOGamers
Автор

Yes.. For newbies only..

*quickly deletes zombie code*

Definitely good tips!

Omniwoof
Автор

I have been coding in C++ for 5 years and I gotta say your video is great and really covers all the essential tips. I didn't know about the last two tips! Very resourceful.

shehabmostafamohamed
Автор

Besides the nice tips your room is fucking dope! Especially the bright laptop and you with the dawn (!?) in the background is sooo amazing!

JousefM
Автор

"Signal to noise ratio"...good audio analogy. A great way of explaining a code file being too "busy"/distracting looking. Never heard it explained like that before, I like it.

DB
Автор

Holy crap. These were *really* useful tips. I've been coding since high school, but I still find myself making the "mistakes" of tips 1 and 6. This one will have to be shared.

joshuastevenson
Автор

Hey man I’ve been subscribe for a few months now but just started watching you videos. I wish I started watching a year ago, you videos are very clear and to the point and offer a lot of info of very important info that is commonly over looked!! Thanks!! Your videos are a huge help!

brandonlind
Автор

I've been programming since the 1970's. You nailed it. Well done! I particularly enjoyed your observations on zombie code and practice, practice, practice. I would add, and have added to numerous coding style documents, some of these:

0) NEVER, EVER, EVER use the TAB key! I worked at one company where a guy set his tab stop to 2 spaces - so what looked good to him went far to the east for everybody else.

1) learn and use the coding style of the corporation for whom you work,

2) use a consistent coding style,

3) use consistent code formatting - e.g. always indent 2, 3, or 4 spaces,

4) make your code as easy to read as possible (e.g. for a long list of assignments, line up all the equal signs,
person[firstName] = "Bob"
person[middleName] = "Andrew"
person[lastName] = "Smith"
person[phoneNumber] = "1-555-123-4567"
person[Street_Number] = "9827"
person{Street_Name] = "West First St."
person[City] = "Toledo"
person[state] = "OH"
person[zip] = 49208
)

5) Make your code readable and maintainable. Don't be afraid to do the right thing:

if ( x == 1 )
{
func1( args1...)
}
else if ( x ==2 )
{
func2( args2 )
}
else if ( x == 3 )
{
func3( args3 )
}

becomes

if ( x == 1 ) { func1( args1 ) }
else if ( x == 2 ) { func2( args2 ) }
else if ( x == 3 ) { func3( args3 ) }

which is infinitely easier and faster to read, understand, and maintain.

5) Don't make files with hundreds of code lines
make code files that contain associated functionality: employee_details.code, company_product.code, taxes_federal.code, taxes_state_WI.code, taxes_state_IL.code, taxes_local.code, taxes_SS.code, taxes_medicare.code

6) Read books, papers, and online articles on good programming style.

7) Read the code of senior staff.

8) Force yourself to look at the code you wrote 6/12/18 months ago and try to figure out what it does. This is a great way to learn how to write better code.

normanrogers
Автор

YES. Simple tips with immediate pay-off, bite-size and highly nourishing. Thanks for the quick feast!

nikolajacques
Автор

My biggest piece of advice is to embrace comments (not zombie code). The first thing I always do before beginning any difficult program is write a paragraph / list at the top describing exactly what I plan to do. Then I can go back to this original plan whenever I get lost

This is also super useful when I come back later and have completely forgotten what I was doing

I also use in-line comments to describe what I am doing whenever I am doing something that might be even a little confusing, especially to somebody with less programming experience. A good example is regex - it's super confusing if you don't understand it, so I always pop a comment in describing exactly what the regex does

joshuaevans
Автор

This is by far one of your best videos since it had clear, tangible examples with code visualizations added to get your point across. Please make more content like this since your newer stuff is a bit loaded with fluff.

SunDevilThor
Автор

I'm familiar with CleanCode and I've been a software engineer at Microsoft for 3 years and at first I was like "meeh why is this beginners video on my recommendations?" Haha DUDE! All these tips were super useful and well explained. I learnt a lot from you. Thank you
I wish more "advanced" programmers could see this video. Subscribed

aaen
Автор

I find your tip #4 to be interesting. It directly contradicts what I was taught in school. My professors wanted all of our variables declared at the top of their relevant functions, although they also demanded descriptive names and comments for each.

VTdarkangel
Автор

Great tips. I am a junior web developer and looking for tips to improve my coding, while searching I suddenly found your video. Your tips are really helpfull. 🌟👍

md.farzan
Автор

As a bit more seasoned junior, I attest to all the tips in this video. You will benefit a lot from keeping your functions short with minimal arguments, abstract the task at hand which makes it easier to develop tests and creates software easier to debug.

If I were to add one thing it would be to encourage early on test development. While you’re writing a function, in parallel or even before: try to write code that tests your new function that expects a certain output. When you get this down, you’ll integrate with the test framework in your language of choice much easier, your tech lead will thank you for having a Test-driven development approach.

simonolofsson
Автор

Yes Andy, yes, I always enjoy your videos, advice and your honest take on programming techniques.

zezeandjr
Автор

You forgot to mention that another reason why people use dead code is for debugging or testing purposes. Some people leave dummy implementations of certain things in order to check them much faster when debugging a different issue.

The solution to that, to avoid this dead code, is to use testing classes with implementations of the classes you need to inject (dependency injection), and thus leave testing-specific code only within the scope of your testing root folder.

Edit: Sorry - I usually see the negative as I take the positive for granted - but the tips given were great and it's really important for beginners to get rid of these bad habits as soon as possible, so good video!

Grempington