Wednesday, April 2, 2014

Never Just One Way To Code

Time again for my nightly recap. What did we do today at Coder Camps?

After reviewing yesterday's codebyte projects, and our morning stand-up; we talked arrays. Shift and unshift for adding and subtracting from the front of the array, push and pop acting likewise for the end, and splice and slice for manipulation anywhere in the array.

Then followed more coderbyte problems to solve in pairs; switching off frequently to practice version control with Git. Either these are getting easier or we are getting better! Actually, they both are true, they were overall easier challenges than the first ten, but we're also learning a huge amount every day.

In the afternoon we started working on a simple To Do List page that has a text input and submit button. Submit an item and it's added to a list. Click an item on the list and you can toggle a strikethrough effect on it. My partner and I also worked on adding buttons to each list item so the user can delete the item, shift it up the list, or down. (you can see our code on GitHub here)

It's nothing fancy but its our first in class project that integrates Javascript, HTML, and CSS, requiring all three to function properly.

Oh, also we learned our Fourth Rule of Javascript - Always define your functions like this:
    var myFunc = function() {}. 

There are (that I'm currently aware of) two other ways to declare your functions. And, of course, this is our rule, not the rule, there are other viewpoints on the subject. However, this is a very safe way to code your functions, which may result in fewer bugs than other formats. And I'm all for that.

One thing I notice every day is how many different ways there are to solve the same problem. And rarely is there a "best" way. One way may be easier to read, another more efficient for the computer to execute, while still another way makes the code more flexible when you have to modify it in the future. Right now I'm just enjoying seeing all my classmate's different approaches - helping me realize new ways of approaching and overcoming problems; which is what it's all about. Awesome.

No comments:

Post a Comment