Skip to main content

Posts

Showing posts from June, 2015

Mapping Objects

My purpose for this blog is to share what I learn as I become a better developer. Sometimes I have thought of an idea for a post but haven't come up with enough content to finish the entire post. I had a feeling like a post needed to be a certain length before it would be worth posting. That idea doesn't completely mix with my purpose for the blog. Sometimes you don't learn things in a large post, sometimes its just a little nugget of knowledge that doesn't require a ton of explanation.

With that said, something I recently relearned is that mapping objects to other objects, especially with different property names is a bad idea. It leads to confusion when working with the code. It also creates more opportunities for bugs to exist. So if you need a property from one object to map to a property on another object, use the exact same name. And if you can just use the original object without mapping to another object, that is even better.

Training With Dan Whalin

I had a great opportunity this week to be a part of a training course given by Dan Whalin. The focus of the class was on AngularJS, JavaScript, and a little bit about TypeScript. I learned a ton during these few days and want to share some the key points that I took away.

First, Dan is a great teacher and presenter, if you have the chance to take one of his courses or see him at a conference, I would highly recommend doing so.

Day 1 JavaScript Naming functions in JavaScript you should be consistent. A Good practice to follow is:
Anything that needs to be "newed" up should be Pascal Cased (Upper first)If the item is static it should be camel cased (Lower first) If you have a function that accepts many parameters, change it to only accept one object with properties for all of the parameters you will need. Then when calling the function you can call using an object literal. This prevent parameters from being passed in the wrong order. Since JavaScript is dynamic it also become…