A notebook with the words Field Notes on the cover and a red pencil

Dark Theme | Category: Code, Educational

Lessons My Mentor Taught Me

It began innocently enough: job-related interest here, a coding question there, and before he knew it, he was trapped – I’d made him my mentor. Even after our agency closed down, he couldn’t escape. I sank my curious little coding claws into him and wouldn’t let go, even dragging him along as a contractor to my next job. Fortunately, my coding mentor is a generous guy with the patience of a saint who is actually happy to share his extensive wisdom. I’ve found myself quoting him often with my boot camp cohort, so I thought I’d share the three most-used lessons he’s taught me here as well. Watch your step, dear reader – I’m about to drop some knowledge.

Margin: 0 auto;
CSS is a beast, there’s no getting around it. One of the most annoying struggles for the newbie coder is how to center an element. At this point I should go ahead and get margin: 0 auto; tattooed on my forehead, because it’s the piece of code I’ve written and told people about most often. If you designate a width for your HTML element you can use margin: 0 auto; to center it within its containing element. It works responsively as well. For a clear and succinct explanation of how this code is working, you can check out this StackOverflow post.

Read, Don’t Just Write
Another common struggle of the newbie coder is how to familiarize themselves with coding conventions, webpage structure, and common CSS properties. The answer is as easy as right click, inspect. Take advantage of your ability to view the code of your favorite websites. Inspect elements you like, from navigation menus to buttons to footers and everything in between, and learn how they were written. Just like reading books makes you a stronger writer, reading code will make you a stronger developer. Codepen is also a great place to read up on how different elements and effects are created. In the beginning you may not understand much of what you see, but don’t let that put you off! The more you expose yourself to it, the clearer and more familiar the code will become.

Drink a Beer and Come Back
If you don’t drink or you’re underage, don’t worry – this one is more about the principle. One of the questions new coders ask often is, “How long should I stay stuck before I ask for help?” The answer varies by situation. I once heard a speaker who said one company they interviewed with said that if their software engineers are stuck more than five minutes they want them to ask, because otherwise they’re wasting company time. If you’re learning independently, you may be stuck for days or even weeks if your research and experimentation isn’t yielding the results you need. Being stuck is a reality of coding you’ll experience for your entire life with varying frequency and difficulty, and that’s not a bad thing; you learn a lot from getting unstuck, even if you do so by asking for help. So how do you deal with being stuck on a coding problem? According to my mentor, you take a break, drink a beer, and come back. Move physically away from the code, shift gears, clear your head, and return with an open mind. I find that a beer or a glass of wine makes me calmer, looser, and less self conscious, which is actually a pretty great frame of mind to code with.

</ XOXO >

[Photo credit: Helloquence via Unsplash]

Back to the Blog