Category Archives: Week-2

The White Belt

I’ve been in the Computer Science (CS) program at WSU for quite some time now. Though I’ve learned a lot in the process, I realize that graduating in May will be just the beginning of my career. I still have a lifetime responsibility of learning ahead of me, and I must find a way to effectively approach this everlasting task.

The textbook references The White Belt as what I feel to be a highly effective pattern to apply when learning new things. The idea is to keep an open mind and bring a proverbial “clean slate” whenever approaching something new. I’m going to use the example of learning new programming languages to further explain this pattern.

We focus a lot on the Java programming language in our school’s CS program. Because of this, I feel I have a proficient understanding of that particular language. We have branched out into other programming languages as well, such as C and TypeScript. But since Java was my first programming language I’ve become proficient in, I always find myself comparing the new languages I learn to Java while I am learning them. The White Belt pattern has changed the way I feel I should be approaching new material. I shouldn’t be making assumptions of new technologies based on my knowledge of other topics, no matter how comparable they may seem. I should be applying The White Belt pattern when approaching new ideas.

For instance, consider a scenario where an algorithm that has been coded in the most effective way known possible for the Java programming language. I should not assume that the code will be just as efficient in a different programming language just because some of the terminology may be similar. I should approach learning a new programming language in the same fashion that I learned Java. A good start would be to consult the community who are well-versed in the skill I am seeking to learn. I ought to start at the very beginning, practicing beginner projects before attempting the more advanced ones. As simple as a “Hello World” exercise may seem based on prior coding experience, The White Belt suggests I should “set this previous knowledge aside.” Based on reading the context of this pattern, I will always try to approach new topics with an open mind and a “clean slate.” This applies not only to the example of learning new programming languages, but also any new situation I may find myself during my professional career.

From the blog CS@Worcester – Jason Knowles by Jason Knowles and used with permission of the author. All other rights reserved by the author.

Apprenticeship Patterns – The Long Road

Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman[AP] by Dave Hoover and Adewale Oshineye isn’t a book for those looking to take the easy road. It isn’t a book for those looking to quickly ascend in to management. It isn’t a book for those looking to become wealthy fast. What it is however, is a book for those looking to truly become masters at what they do. In chapter 3, a pattern called “The Long Road” [AP] is discussed. It discusses how in today’ society there is a big draw towards quickly rising to fame and wealth [AP]. People want to get rich quick and without much effort [AP]. The pattern discusses how for most people that is unrealistic [AP]. More importantly, if you truly want to be great at your craft of choice, then jumping into management isn’t the right path to take [AP]. Expect to sacrifice promotions and salary increases and make other sacrifices along the way [AP]. Some people may aspire to go into management. If that case, there is nothing wrong with that and no one is going to stop you. But that’s not what this book is about.

I agree that to truly become a master software developer, you have to continue to be actively developing for a long time. The field is forever changing and changing quickly. Each passing year you continue to hone the skills you currently have while picking up more new skills along the way. Eventually you’ll get to the point where you can handle any situation. I feel when you reach that point; when you have an answer for everything (or almost everything) relating to your field then you truly have mastered what you do. To get to this point will take a long time. I also feel that this road is not for everyone. Not everyone wants to be developing software into their 40’s or 50’s. Some may want to move on to other things. Some feel that the role of a developer is merely a stepping stone for higher ranking positions. There is nothing wrong with this philosophy. Not everyone aspires to be a master developer. Personally, I am not sure if I want to become a master developer. I’m not sure if I want to be a true developer into my 40’s or 50’s. I feel this is a question I will answer for myself as time goes on and my career develops. I don’t think anyone my age (I’m 21) has an answer to this question. However, if you are one of the one’s who do want to be a master, then long road is the only way to get there.

 

Link to pattern in the book: http://chimera.labs.oreilly.com/books/1234000001813/ch03.html#the_long_road

 

From the blog CS@Worcester – README by Matthew Foley and used with permission of the author. All other rights reserved by the author.

Staying Open to New Ideas

After a few years of using mainly one language to accomplish programming assignments, I will certainly admit to becoming complacent with Java. If I was asked to write pseudocode, my mind immediately begins object orientation and even begins running through some of the Java syntax. While this can be helpful, as I feel my ability to think in Java means that I may be well on my way to becoming bilingual, there are also many drawbacks to complacency.

Applying this Java-like thinking to problems in other languages or under other frameworks is where problems may arise. Rather than being open to discovering and developing new skills, the existing knowledge becomes a hindrance to learning. Attempting to apply existing knowledge to problems of a different sort or in a different language may slow progress, and make learning even more difficult and frustrating.

The solution offered by Hoover and Oshineye in Apprenticeship Patterns is to put on The White Belt and allow oneself to be ignorant by putting aside accumulated knowledge and experience, leaving no choice but to learn the way through trial, error and reflection. Treating new learning opportunities in this way allows for more deeper understanding and helps to create more smooth communications with members of the existing community.

I recently decided to expand my software development experience by studying JavaScript. While I feel confident that I have stumbled over the most difficult learning hurdles at this point, I wish that I had read this apprenticeship pattern before my attempt. I feel that I had a difficult time initially overcoming how fundamentally different JavaScript is, and often found myself grasping for the comfort of Java. It wasn’t until I took a step back from what I was doing that I realized I needed to open my mind to fully understand and appreciate JavaScript for what it was rather than how it was different from or similar to Java. The example that Apprenticeship Patterns uses, a lottery program written in three languages (Java, Io and J) is especially telling of this fact.

While I would have previously described myself as open minded and always willing to learn, I believe that The White Belt pattern has helped me see a more valuable way to approach new learning. I will certainly be using the ideas of Hoover and Oshineye the next time I attempt to learn a new programming paradigm.

From the blog CS@Worcester – ~/GeorgeMatthew/etc by gmatthew and used with permission of the author. All other rights reserved by the author.

Apprenticeship Patterns Chapter 1

“Apprenticeship makes a difference because it instills a lifelong passion to master the craft. It instills a passion for perpetual learning and, in the process, enables the apprentice to become a great developer.” – Pete McBreen

I do agree with this statement that was at the beginning of the chapter. As an individual, whenever I hear the word “Apprentice”, I always wonder and think about the “Master” because that is who the apprentice learns from. After reading through this chapter, I tried to tie all the concepts back to the title of the book Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman. An apprentice should always try to learn and understand the concepts that the master is trying to teach. Understanding and learning the concepts is one thing. Learning how to implement and use the concepts is another. The techniques that you learn from a master can sometimes, if not most times, be found found in textbooks or they can’t be basically self-taught. Every master can have different styles, which is why a “master” is very valuable and special in a sense. To me, that is an Apprentice and Master relationship. When the apprentice is trying to perfect their craft with the aid of their master, it instills something very special within the apprentice’s work and makes them have the desire to want to learn and create more. This quote by McBreen is very important to me and makes sense to me the most. To relate it to myself, I feel that the Master is the contents of which I am trying to learn, and the Apprentice or Journeyman is myself.

There is a quote that also sparked my interest because it is a statement that I fully acknowledge. “One of the lessons we’ve learned from the Agile development movement is that just telling people to do things doesn’t create lasting or sustainable change. When the people you’ve advised encounter a situation that isn’t covered by the rules, they’re lost. However, if those same people have imbibed the values that underpin the rules, they can come up with new rules to fit any situation. Our goal here is not simply to hand people a rule book, but to give them the ability to create new practices for new contexts, which in turn drives the discipline of software development forward.” This supports the thought of critical thinking in a sense that thinking outside of the rules in order to create new ones is the foundation of continuing the evolution of software development. If developers encounter a situation that certain rules do not cover and they become lost, software development cannot progress forward.

As I am currently aspiring to become a future video game developer, I expect that there are going to be new rules that are going to be created constantly. I know that I am going to learn and to develop certain “crafts” to be very efficient in that environment of work because there will be many things to adapt to. As Pete McBreen points out, there are many developers out there today in the field. The important question is are there enough “good” ones? When I head out there in the field, I would want to be recognized as one of those “good” developers.

 

From the blog CS@Worcester – Ricky Phan by Ricky Phan CS Worcester and used with permission of the author. All other rights reserved by the author.

Training your Code Nose

This week’s reading was Code Smells written by Jeff Atwood, on Coding Horror. As the title of the blog suggests, the message that the reader should get from the post is to familiarize themselves on the common smells to prevent design problems. With that, he lists the different type of smells into two categories, “Code Smells within Classes” and “Code Smells between Classes”. The first category deals with simplifying, removing or splitting code where its due to make reading methods easier. This idea is also applied to classes, which should reduce unnecessary classes or makes sure encapsulation is applied properly.

There is no definite reason as to why I chose this topic but it is said that developing your code nose early is useful for the future! From what I have gathered so far, the idea behind this topic is to have a good design where the earlier choices of methods/classes will not have conflicting issues for later additions or improvements to the code. Many of these code smells are already taught in earlier introductory CS courses such as, duplicated code and making useful comments.

After reading about the different types of code smells, I have noticed a couple that code be smells in previous school projects. One would be the overuse of comments, as I sometimes find myself not remembering what a certain function was used for, which compels myself to leave a comment here and there. Another would be oddball solutions, where sometimes issues mysteriously fixes itself as you continue with your code. This usually leads to problems in the future while adding newer functions. However, there are a couple of smells that are useful to remember now then later such as Speculative Generality. After being taught to prepare for future problems in life, it’s also sometimes applied to writing code but is a wrong mindset. Only implementing things when you need it will reduce clutter and seems to apply to the dead code smell, where you should delete unused code.

By exercising or having an open mind to these design problems will help prevent simple problems from appearing while working on projects. Having clean code benefits myself and others while reading the different classes/methods we each produce. Which should entail a better experience for group work, and saves time solving problems that should not have existed in the first place. There is no way to remember all the different smells, but being aware of them will help myself produce cleaner code in the future.

From the blog CS@Worcester – Progression through Computer Science and Beyond… by Johnny To and used with permission of the author. All other rights reserved by the author.

Lambda expression in java

A Lambda Expression is a representation of an anonymous function which can be passed around as a parameter thus achieving behavior parameterization. A lambda consists of a list of parameters, a body, a return type and a list of exceptions which can be thrown. I.e. it is very much a function, just anonymous.

An instance of a lambda can be assigned to any functional interface 
 whose single abstract method’s definition matches the definition of the lambda. In fact, a lambda is a less verbose way of defining an instance of an interface provided the interface is functional. Since, the definition of a lambda can match the definition of multiple functional interfaces, hence, a lambda instance can be assigned to any of these matching interfaces.

The reason i picked this topic was because it was something new i have seen in the java language. Also wanted to know more about it and see if i can utilized it on some of my java programming language.

Examples of lambda expression.

First of all. Comparing java 7 to java 8.

public interface StateChangeListener {

public void onStateChange(State oldState, State newState);

}

In java 7 we implement this interface in order to listen for state changes. You do this

public class StateOwner {

public void addStateListener(StateChangeListener listener) { … }

}

But in java 8 you can add an event listener using a java lambda expression. like this.

StateOwner stateOwner = new StateOwner();

stateOwner.addStateListener(

(oldState, newState) -> System.out.println(“State changed”)

);

 

From this topic ( lambda expressions), i learned that previous java or java 7, if i wanted a block of code to be executed, we need to create an object and pass the object around. From Java 8, lambda expressions enable us to treat functionality as method argument and pass a block of code around. Lambda expressions in Java 8 are very powerful and therefore very compelling. For me, lambda expressions is way much better, convenient and very easy.

link to the resource : http://tutorials.jenkov.com/java/lambda-expressions.html


 

From the blog CS@worcester – Site Title by Derek Odame and used with permission of the author. All other rights reserved by the author.

Writing “Clean” Code

https://www.thecodingdelight.com/write-clean-code/#ftoc-heading-2

As I learn more about computer science, I find that writing code for a programming project is very similar to writing an essay for an English project. I find that the core structure of a coding language mimics the core structure of any other language. A run on sentence can be compared to poorly using indentations, grouping your variables together at the top of the page is like having a well organized thesis statement. Just as we spend years taking English courses perfecting our grammar and sentence structure, it takes a lot of practice and learning to perfect our syntax and ability to write clean code.

Some benefits of writing clean code include:

  • Being able to easily follow your own code to track down errors
  • More efficient productivity
  • A more professional reputation
  • Your employer/teacher will resist the urge to strangle you

This article explains in detail why we should try to better our code and how to develop better habits from common mistakes. I for one, typically write messy code just hoping it will work and later try to buff out bad variable names, overly complicated methods, and half written comments. After reading this article however, I’ve learned tips and tricks for writing better code and how to embrace the clean code mindset. I can only imagine how many frustrated programming teachers’ evenings I’ve saved after reading this article, so for your own sake and for the sake of whoever has to look at your code, I recommend you read this article as well.

From the blog CS@Worcester – CS Mikes Way by CSmikesway and used with permission of the author. All other rights reserved by the author.