Day 3/30 — Refactor time!!
One thing about coding is you always keep finding new ways to do same same task. You will keep improving your code and the way your coding. This is way I strongly recommend re-visiting your old code and check what all you can change now.
My process of attacking any problem through code is — I understand the requirement, do paper work — write how the flow will work, what all will fall in front-end and what will go in back-end, what will be static and what will be dynamic, what can be done in css and what should move to JS & so on. Once happy with that I first code and achieve the output I am looking and once that is done I start refactoring my code or cleaning of my code.
As of now the code I have wrote in this challenge is very small and refactoring will be very easy to do. I found that if I move the navigation of header and footer in <ul> would be best wrt to scaleability of code. So just this change I did. But when I work on very complex code I change my approach (will discuss as I keep moving further in this challenge).
http://codepen.io/NehhaSharma/pen/dOdKjL
What is refactoring?
Cleaning your code by removing unnecessary stuff/classes/logic/loops and so on.
Why Refactoring?
Why not? before peer code review or QC it is very very important to re-visit your code files and clean the code.
How often we should Refactor?
I do twice when on project and once everything is live I re-visit and make notes what more could be done. But at least 1 you should.
How you know it is the code you need to refactor?
I believe strongly every code should be refactor as I mentioned there are many ways to do one task and within those ‘many ways’ you need to get your best one which will take care of your requirement and best practise too.
What’s next?
What about some logics? Time to write some JS or add some complexity in CSS?