THE CHOP SHOP
  • Home
  • Blog
  • About
  • Art
  • Contact
  • Home
  • Blog
  • About
  • Art
  • Contact
Search

day 4

1/4/2019

Comments

 

100 days of code

<day 4>
Today, I thought I’d document a few things I know about HTML and CSS.  These are the basic building blocks of the web and it’s good to master HTML/CSS, before moving on to JavaScript, I think.  

In the beginning, (January 2018) I was so anxious to learn code that I immediately jumped into Python and PHP without learning HTML/CSS first and it was very overwhelming and it made me almost want to quit.  But now that I have a good handle on HTML/CSS and dabbling in JavaScript, I can see that for the most part, JavaScript, PHP and Python are very similar to each other.  They have a dozen or so, core principles that they all share and once you understand them all, it’s much easier to learn another language.  I hear that it might take 6 months to a year to get good at the first language, but once you master it, the others take only a fraction of the time; a few weeks to a couple of months, depending on your level.  That’s why my main focus now is to master HTML/CSS and JavaScript before jumping back to Python.  It’s easy to get overwhelmed with the amount of technologies out there, but it’s really not that intimidating once you know that they’re very similar to each other.  

I’ve been self teaching for about a year now and I found a strategy that works for me.  I find that when I hear the same information from different sources, I retain it better and I make it a habit of seeing the same problem worked in different ways.  The same way when I’m looking for a sunday gravy recipe… I tend to watch 7-8 cooking videos on Youtube for the same recipe.  I observe what those 7-8 cooks are doing and what they all share in common, in terms of technique and ingredients.

I like to approach learning how to code in a similar manner.  I’m currently enrolled in Team Treehouse and slowly working through several courses on Udemy.  I’m also listening to coding podcasts and talks and this helps me figure out what the essentials are.  You also find out how to do things and how not to do things.

One of the early CSS classes I took on Udemy was terrible.  Even though I was a complete beginner, I could tell something didn’t feel right about the code, but I thought it was ok to do it this way since the final product seemed to function.  The Udemy instructor kept using the CSS command “!important” on several lines right off the bat.  Later, I find out that the command “!important” should only be used sparingly, but this asshole instructor had about 8 in the first 30 lines.  The nerve of that guy to teach a course like that…but I digress.

Another early principle I learned is to “keep the CSS dry”.  D.R.Y. stands for Don’t Repeat Yourself.  The two sets of code below are the same exact code.  They do the exact same and look the same on the screen.  The only difference is that the first set has a lot of repeated commands.  They have the “color” and “padding-top and bottom” repeated 3 times in the first set of code.  The second version has no repeats and has less words.  It’s easier on the eyes and easy to update or debug later on.   

I’m not sure of the exact quote, but there’s a famous saying among chefs that said something like: a good chef’s goal is to make the best meal with as few ingredients as possible.  I think it’s good to approach writing code in this way.  There are, of course, times where it’s a good idea to repeat yourself, but as a general rule, I try to keep the CSS as “dry” as possible.
Picture
Picture
Comments

    Author

    Manny Cortez

    Archives

    January 2019

    Categories

    All

    RSS Feed

Proudly powered by Weebly
  • Home
  • Blog
  • About
  • Art
  • Contact