To The Triforce

Quests for Knowledge

Crush the Rockstar Programmer Myth - PyCon 2015 Keynote

This year's PyCon keynote was given by Jacob Kaplan-Moss, a mediocre programmer who contributes to Django. This was such a great talk. These talks are the reason that I feel like the Python community is a great community to be a part of. I am not saying that the "Rockstar Myth" is not alive and well in the community. The myth exists in almost all skill-driven careers. Any programmer can appreciate that this controversial subject is at the forefront of PyCon. I want to go next year!



Coursera - Learning How To Learn

I just finished taking the Coursera online course: Learning How To Learn. I heard about the course on Reddit when a user asked a question about learning more efficiently and getting smarter overall. It sounded like a really naive question to me, but the users who answered the question answered it respectfully. One user's reply, which mentioned this Coursera course, was great. In one line, he extinguished the previous user's reply, who explained that being smarter had a lot to do with genetics and environment. I have to admit that I am guilty from time to time of thinking that learning a particular subject up to a certain level had something to do with genetics. I know that it is incorrect scientifically, but it is such an easy way for people to write things off when you don't want to put in the work it takes to learn something difficult.

I can't say that the first view concepts were something new to me, but the portions of the course that spoke about how the brain works were pretty interesting. There are extremely bad graphics presented in the course, but they were quite effective in conveying the information.

Here are the portions of the course that made the most impact on me:

What is Learning?


  • Focused and Diffused Modes
    • Explains how both modes are needed to truly learn something. Focused is basically what you'd expect -- intense sessions of Focused learning. Diffused is the act of letting the mind work on things and make connections in a background thread. Ever come up with a great idea or a solution to a problem when you are running or showering? That's Diffused Mode.
  • Procrastination, Memory, and Sleep
    • Explains how the natural reaction to learning something difficult for humans is procrastination. Deals with techniques on how to trick your mind into not procrastinating by replacing anxiety with excitement and applying the Pomodoro technique. Touches on memory, practice and the importance of sleep.

Chunking

  • What is Chunking?
    • The process of grouping several items that you need to remember into a larger whole. An example of this is mnemonics. A more general example is the act of putting on a jacket. If we take that process and break it down, there are a lot of things that we'd have to explain, but we store all those movements into a Chunk.
  • Illusions of Competence
    • While learning, we should not be focusing on the problems that we already know how to solve, we should instead move on to the more difficult problems. This struck me because when I was in college, I would set aside large chunks of time for going over the stuff I'd already learned and it was very time consuming. This practice would often take the time that I'd allocated for learning new concepts -- causing great panic when it was time to be tested. Physics and Calculus problems sometimes took an entire page of work to complete. Giving into this illusion cost me a great amount of time. 

Renaissance Learning and Unlocking Your Potential

  • No Need for Genius Envy
    • There are people who have natural gifts for some things, but that does not mean that the average person couldn't get to the same level of knowledge over time. Being smarter or more intelligent often equates to having a larger working memory (the average person's working memory is 4 slots). But having the average working memory could give the average person an advantage. Once an average person commits a particular chunk to memory, it is known inside out as a result of the way that it was stored (using many of the techniques in this course). The average person has to be creative in forming Chunks, this creativity results in a richer knowledge. The people possessing a natural gift did not have to go through the same process. Therefore, the creative process, along with any external connections, is absent. 
  • Change Your Thoughts, Change Your Life
    • I kind of already follow this mantra. The quote "Whether you think you can do it or not, you're right" is something I didn't realize was true until my late 20's. When I was a 25 year old room service waiter, I would work with college students that were only there so they could pay for their books or tuition, but they never planned on working there for more than a couple of years. Back then, it was so hard for me to imagine myself being enrolled in college or ever working outside of the food and beverage industry. I thought that higher education was something that I was unable to do. I was really beat up from my experience in high school. One day, I started thinking that none of it was really unapproachable and that failing would only make succeeding more desirable. I enrolled in community college, graduated with honors, then enrolled in University and got a Computer Science degree (graduating again with honors) -- all the while, never failing a course. The mind is a powerful thing. 
Overall, I recommend the course to anyone who wants to learn more about how we learn and wants to learn more efficiently. Even if you are not currently taking courses, the techniques apply to learning in general. If you are not in a place where you are learning, you should probably move on to another place where you actually are.  


Using GitHub Pages to host your profile page

I've had my profile page up on GitHub for quite a while now, but it wasn't in a state good enough to write about until just recently. For those who don't know, GitHub has a feature called pages which allows you to purchase a domain and with some very minimal configuration, you can host a static site for free.

Here's a peek at my profile page: www.wmanger.com

Here's a peek at the source: https://github.com/walter-manger/walter-manger.github.com?files=1

Basically, the only configuration that you need is supply a CNAME file with your domain in it, do some very light configuration on the domain side and your done. Some people are ditching database driven blogs and using a static blog generator called Jekyll. The GitHub/Pages page has very detailed information on how to get all of this up and running.

GitHub Pages Documentation: http://pages.github.com/

I decided to go with an info-graphic approach with my profile site. There is still a lot of work to be done, but this is a better start than just having a really bad looking page up there.

Exploring JavaScript's Function Invocation Patterns

In chapter 4 of JavaScript: The Good Parts, the author writes about JavaScript's take on functions. I think that I've read the first few parts of the chapter a couple of times now and I plan on spending more time on this chapter before I move on. There are some very interesting parts discussed in this chapter and I want to make sure that I get the chance to actively learn the concepts through testing as opposed to just reading about them.

Here's my attempt at describing JavaScript's Function Invocation Patterns. First, a code sample. 


As shown in the sample, there are 4 invocation patterns. Each invocation pattern has its own way of defining what the this keyword represents in the body of the function. 

Method Invocation: 
How: An object has a method and it's called with dot syntax. someObject.do_something()
this = the object itself

Function Invocation:
How: A function is defined in the global space or within another function. 
this = global object

Constructor Invocation:
How: A function is created to mock a constructor and the new keyword is used to create an instance.
this = the instantiated object

Apply Invocation:
How: .apply() is added to the end of a function allowing to pass in an object and parameters.
this = the object passed in

JavaScript: The Good Parts I

In JavaScript, the basic types are number, string, boolean, null, and undefined. All other values are objects. The difference between null and undefined is sometimes confusing, but basically, when you set a variable to something, it is not undefined, otherwise it is -- unless, of course, you set the variable to undefined. This isn't something that is particularly new to me, but it was interesting to see the formal definition of the types in plain English. To illustrate, the types variable below is an array of JavaScript's basic types:


The first few chapters of JavaScript: The Good Parts are a basic introduction to JavaScript's types and how they are linked. An especially interesting chapter is Chapter 2: Grammar, where it shows how JavaScript is parsed with railroad diagrams. Here's a railroad diagram for a function literal in JavaScript:


Chapter 3: Objects introduces how JavaScript defines objects. As I've mentioned in a previous post, there are many places where you will find JavaScript looking like a strongly-typed language. There is really no need to treat JavaScript this way as creating an object is as simple as:

Notice that a person object is created directly with Object Literal notation. In this example, person is the prototype used to create the pete object below. The prototype chain could go on forever. Multiple inheritance is achieved by using jQuery's $.extend() method. pete_student is an object that is inherited from student, pete_student_attribs, and pete, which inherits person. Note that the new keyword has not been used in this example.

I can't say that I've had to use JavaScript in this fashion before, but knowing more about how prototypical inheritance works in JavaScript has already proven to be beneficial while debugging or thinking of ways to improve existing code without breaking legacy code.

My focus on learning JavaScript

JavaScript is a web technology to the core and there is something about the web that is love/hate for me. Things change so rapidly that it is sometimes difficult to keep current. It's not just the actual technology that changes, but the style of using the technology that changes. Not so recently, JavaScript has emerged as one of the most useful languages in terms of web tech. At the time of this writing, JavaScript is the number one language in GitHub -- meaning that it holds the most repositories. Something that has proven to be attractive to me about JavaScript is its somewhat functional nature. I hold most of my experience in statically-typed languages (C#, C++), so JavaScript's instant gratification as a result of no compilation makes me happy.

I write JavaScript from time to time in my current position and I've discovered that when you mix my lack of breadth and depth of knowledge of the language with the other software developer's lacking knowledge, you are left with very messy code. The JavaScript that we write is made to look and act like C#, which it can in some cases, but not using JavaScript the way that it was intended to be used causes cluttered, tightly-coupled, and often unmaintainable code. We rely on libraries (jQuery, Knockout, Telerik) to get us through the sometimes painful implementation. In most cases, we abuse these libraries creating even more of a maintenance nightmare. After all, why learn everything about a library when you can just get what you need working now without a complete understanding? I've seen emails from coworkers touting the need for design patterns in our code, but it seems that it only ever gets that far. I agree that design patterns are needed, but more importantly, testable, maintainable, well organized, and readable code is needed. The classic design patterns don't address third-party library uses specifically anyway. To date, we don't have a JavaScript testing or code quality strategy in place. Apparently, knowing JavaScript is just knowing what can be immediately ported from our existing C# knowledge and third party library implementation. What's worse is that there seems to be a movement to make JavaScript look and act more like a strongly-typed language. There has to be a better way. 

I've decided to dive into JavaScript deeper to find out if there's a way to address the mess. 

Here's where I am going to start: 

Books

  1. Jsbin with Qunit
  2. Sublime Text 2
  3. jsLint
I am going to try to read a chapter from each of the books every 2 days, but we'll see how that turns out. As a new father, there is limitless things to do aside from reading books and playing with JavaScript. After each chapter read, I will attempt to post any interesting concepts with examples.

Speaking of being a new father, my daughter is now officially 2 months old. Since she doesn't have a job yet, she decided that unloading her full 4 ounces of breast milk all over me during her 2am feeding was a good gesture of appreciation. Eh, I'll take that as a good thing... 


The Move to Blogger

I've decided to stop paying for blog space since I've failed to be disciplined enough to blog regularly. As a result, everything that I write gets removed after I miss the due date on the annual payment. I figure if I start here, the posts will be around for quite a while and RSS accessible. If I wanted to recreate the blog on my own server I could pretty easily, though I don't know why I'd want to do that at this point.