Category Archives: Week 13

Find Mentors

Programming alone can be difficult with unclear paths to take with lots of uncertainty about which approach will be the best. Without someone who can give you guidance, it makes it difficult to move forward alone. It is necessary to find a mentor who will be there to guide you in times of uncertainty. The mentor you find does not need to be someone who knows all, but someone who has more knowledge and experience than you in a particular programming area. Finding a mentor requires a lot of searching because they may be hard to find, especially finding someone who is willing to spend the time to help. However, when you find one, they will provide a world of experience.

I found it interesting the author himself found a mentor after a few years of already being a programmer. It shows that it is never too late to find someone who knows more than you and to ask for help. This practice relates back to a previous pattern about exposing your ignorance. You must be willing to do this in order to get the proper guidance.

This pattern focuses on the theme of approaching programming as a craft where you must start as an apprentice. This reminds me of my grandfather who was a carpenter. When he was young, he started small jobs without much knowledge. He learned from the other men on the job who were eager to teach him what they knew. Eventually, he learned as much as they did and in his later years went on to share his knowledge with those who were younger just learning their craft.

After reading this far into the book, I have reshaped the way I view the development landscape. I feel that it requires the perspective of apprenticeship and the need for finding others to help you develop your craft. I think it is possible that at the same time you are being mentored, you can also be mentoring someone else. There are no areas in this pattern where I disagree with the author. I find that his recommendations and personal experience are well thought out and are great advice.

From the blog CS@Worcester – Jared's Development Blog by Jared Moore and used with permission of the author. All other rights reserved by the author.

Retreat into Competence Pattern

For this week’s apprenticeship pattern, I did a reading on “Retreat into Competence”. Retreat into Competence pattern about feeling overwhelmed, realizing how little you know about or taking on a big project and things may not be working so well for you. In this pattern it talks about how you should “pull back and then launch forward like a stone from a catapult”. What this means it to retreat to a zone where you’re comfortable with and once you feel ready, you’ll be able to launch yourself even further than before you might have felt ‘stuck’. An example I found from this pattern is pick something that can be self-contained that you know really well and stick with it, by doing this, opportunities will emerge, and it will allow you to capitalize on those opportunities and you will end with great gains.

Unlike my other blog posts, my initial reaction is not quite the same since I have yet to experience this. The closest time I ever felt overwhelmed is just the pressure of trying to find a job by graduation. Its not exactly related to what this pattern talks about but the same concept. For me, it was a matter of constantly getting rejection emails from companies, so I took a step back to look at what I may be missing. Once I was able to go over my resume and qualifications, I started to reapply and now I am starting to receive multiple invitations to take coding assessments and scheduling interview dates. This pattern goes hand to hand with ‘Expose Your Ignorance’ and ‘Confront Your Ignorance’.

The pattern has changed the way I view my profession because I never thought about needing to take a step back in programming. Maybe because I never ran into a situation where I needed to? However, after reading about this pattern I started to reflect on the things I’ve done so far and what else could I do to improve my programming skills and knowledge. I am also trying to figure out what I am really good at so I can focus a little bit more on that skill and work around it so when the time comes and an opportunity presents itself, I will be able to capitalize on it.

From the blog CS@Worcester – Michael's Developer Blog by michaelchaau and used with permission of the author. All other rights reserved by the author.

The Long Road

This week I have decided to write about the long road. As we reach the end of the semester, it seems like a good time to acess the road ahead of me as a software craftsmen. Thus far, I have seen my road as just getting a software job. And everything else was secondary to that. That road included going to school, creating a resume, appying for jobs, studying for interviews, and interviewing. Many of these tasks included programming, but most of this time was not actually spent programming. Now I will be starting my first software job after graduation, and it is the perfect time to consider the road ahead.

Dave mentions that a craftsmen can achieve almost anything if he stays with his craft for 20 years. And that learning is a lifetime skill. He also mentions that the craftsmen should value long term growth over all else, including salary. I have seen online that senior engineers can make comparable salaries to technical managers. So I don’t think that craftsmen need to choose between salary and growing their craft. There seems to be plenty of roles that provide learning oppurtunities, and high salaries. But Dave argues that money should not be the main motivator of the craftsmen.

The action is to imagine my career 20, 30, and 40 years from now. It is difficult for me to say what my career will look like this far out. But I know that I want to work in tech for my entire career. I do know for the next five years I want to work as a Software Engineer. With the hopes of moving from Junior level, to a mid level engineer. From there, I may decide to take on a leadership role, while still focusing on the codebase most of the time. This could be a tech lead, or Senior Engineer role. Twenty years from now, I could either be in leadership, or a may be a very accomplished engineer. It would be very rewarding to be the guy that everyone goes to with questions, and I do like helping other people succeed. So this could be a good path. Thirty years from now I could see myself being a leader of a tech focused small business, or maybe freelancing. Going out on my own is something I have always been interested in. Forty years from now I will be sixty eight. So I will likely be getting ready to retire. But who knows, maybe I will still be coding at that time.

From the blog CS@Worcester – Jim Spisto by jspisto and used with permission of the author. All other rights reserved by the author.

Docker: The Differences Between a Dockerfile, Image, and Container

Docker is a program used to package applications and their dependencies into bundles that can run on any computer. A running instance of the bundle is a container. Docker containers help developers build software by isolating applications, sandboxing projects, and guaranteeing running software. To have a docker container, one needs to write a Dockerfile, build it into an image, and run the image. When I was learning the process, my instructor explained the process and terms by using only an analogy. He compared them to the process of how source files became executables, and then running processes.  Because analogies only help understand concepts (not define them), the goal of this post is to define Dockerfiles, images, and containers as well as their relationships. To achieve the goal, I will be using information from the article, “Differences Between Docker Images and Containers,” written by Eugen Baeldong, an author who has written about software development extensively. His article differentiates Docker images from containers.

The Dockerfile is a text file that contains instructions on how to find, install, and configure an application and its dependencies. In the same way an embryo is a baby at the first stage of development, a Dockerfile is a container at the first stage of development. Some commands that can be used to create instructions are RUN and COPY. RUN is used to install a package or application and COPY is used to copy files and directories from one location to another. With the commands, instructions are created. The set of instructions tell a computer how to find and install the applications and its dependencies.

When a computer executes the instructions in a Dockerfile, an image is built. According to Baeldong, an image is a template for creating the environment one wants. In other words, it is a snapshot of a system one wants. Returning to the baby analogy, an image is a container at the second stage of development in the same way a fetus is a baby at the second stage of development.  I imagine an image as one’s desktop environment. The icons in the environment represent the application and its dependencies in a dormant state. The application is not running yet in the same way desktop applications do not run until one double-clicks their icons.

When a computer runs an image, a container is created. A container is an environment where an application and its dependencies are running. The application in the container is independent from the applications on the computer. In other words, the contents inside a container and one’s computer are unaffected by one another. I imagine it as a computer inside a computer; however, the second computer will not have a graphical interface because it is not necessary for an application to run.


https://www.baeldung.com/ops/docker-images-vs-containers

From the blog CS@WORCESTER – Andy Truong's Blog by atruong1 and used with permission of the author. All other rights reserved by the author.

A Very Small Introduction to JavaScript

Since we’ve been using JavaScript for the past several weeks in class and in homework, I thought it would be beneficial to help run through some elements of JavaScript I found weird or difficult at first. I’ve noticed some people have a harder time understanding JavaScript’s syntax or how its variables work, so I wanted to make this as a sort of reference.

Types

JavaScript contains primitive and non-primitive types. A variable can be declared with “var”, “let”, or “const”, more on const later. The main primitive types are1:

  • Boolean: true, false
  • Null: null
  • Undefined
  • Number: 72, -174.21
  • String: “Hello, ”, ‘world’

For an object type, objects are very loose and can for the most part be defined with relative ease. 

Let’s take a simple object, named “car”.

This object has three properties, wheels, year, and color. When declaring or assigning properties, the syntax shifts from the typical use of “var num =”, to “num: ”. These properties in an object are pairs: “wheels” and “4” are a pair, specifically a key-value pair as well as an object. This means that there is more than one way to access an object’s properties. 

The second one looks suspiciously similar to a map, specifically one in C++. Objects may be iterated through using a for-loop directly.

Functions

Functions may be defined in a few ways. If inside of an object, the function would be defined as:

Else, it may be defined as the following:

The bottom function declaration is known as arrow notation. A function with arrow notation is not bound to an inherited constructor or the keyword “this”, and its usage with scopes may be troublesome. Its parentheses may be dropped if there does not exist any parameters, such as “getProps => {}”2.

JSDoc

JSDoc is a markup language used to comment JavaScript code, and is similar to JSDoc in many ways. JSDoc may be created by typing “/**”, then pressing enter upon this pop up:

JSDoc is, in my opinion, very useful in declaring classes, functions, objects, types, or declaring types. This is especially important with JavaScript, since types are handled dynamically.

JSDocs can use the following my pressing “@” inside of the comment, revealing a large list of descriptors, with users being able to make any and anytime3:

Upon creating a simple JSDoc annotation:

Hovering over the object “car” will read:

For our function getValue:

This is rendered as: 

Hopefully, this post can be helpful. JavaScript was odd for me when I first started, with these topics being some of the things that took me a while to get used to. The sources contain a wealth of information that I have and will continue to refer to and learn from, and hopefully they can help you too.

Links:

  1. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures (Types)
  2. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions (Arrow Functions)
  3. https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html (JSDoc)

From the blog CS@Worcester – Chris's CS Blog by Chris and used with permission of the author. All other rights reserved by the author.

DRY PRINCIPLES

The DRY meaning “Don’t repeat yourself” principle is a best practice in software development that recommends software engineers to do something once, and only once. The concept, which is often credited to Andrew Hunt and David Thomas, authors of “The Pragmatic Programmer”, is the tongue-in-cheek opposite of the WET principle, which stands for “write everything twice”.

According to the DRY principle, every discrete chunk of knowledge should have one, unambiguous, authoritative within a system. The goal of the DRY principles is to lower technical best by eliminating redundancies in process and logic whenever possible.

Redundancies in logic

To prevent redundancies in logic (code), followers of the DRY principle use abstraction to minimize repetition. Abstraction is the process of removing characteristics until only the most essential characteristics remain.

Redundancies in process

To prevent redundancies in processes (actions required to achieve a result), followers of the DRY principle seek to ensure that there is only one way to complete a particular process. Automating the steps wherever possible also reduces redundancy, as well as the number of actions required to complete a task.

An important goal of the DRY principle is to improve the maintainability of code during all phases of its lifecycle. When the DRY principle is followed, for example, a software developer should be able to change code in one place and have the change automatically applied to every instance of the code in question.

As programmers, we collect, organize, maintain, and harness knowledge. We document knowledge in specifications, we make it come alive in running code, and we use it to provide the checks needed during testing.

Violations of DRY

“We enjoy typing” (or, “Wasting everyone’s time”.): “We enjoy typing”, means writing the same code or logic again and again. It will be difficult to manage the code and if the logic changes, then we have to make changes in all the places where we have written the code, thereby wasting everyone’s time.

How to Avoid DRY

To avoid violating the DRY principle, divide your system into pieces. Divide your code and logic into smaller reusable units and use that code by calling it where you want. Don’t write lengthy methods, but divide logic and try to use the existing piece in your method.

DRY Benefits

Less code is good: It saves time and effort, is easy to maintain, and also reduces the chances of bugs. One good example of the DRY principle is the helper class in enterprise libraries, in which every piece of code is unique in the libraries and helper classes. I chose this topic because as a programmer, it is always important to know why design principles are useful for us, what and how to implement them in our programming.

Software Design Principles DRY and KISS – DZone Java

The DRY Principle: Benefits and Costs with Examples (thevaluable.dev)

What is DRY principle? – Definition from WhatIs.com (techtarget.com)

From the blog CS@Worcester – Software Intellect by rkitenge91 and used with permission of the author. All other rights reserved by the author.

Week 13: Why You Need a CSS Developer

https://www.toptal.com/css/why-you-need-a-css-developer

Keeping in line with my front-end blog posts, I wanted to read another blog post on front-end stuff so I decided to pick this blog post from toptal.com on CSS developers. I also decided to choose this blog post because I think CSS is the first programming language I was aware of, I only knew that it was part of web design but I was always confused looking at it’s syntax. In this blog post from Silvestar Bistrović, he runs over what CSS developers do and why we need one.

He introduces the reader with CSS developers and what they are. They’re web professionals whose primary responsibility is to deliver a polished and styled product to the visitor’s browser. Practically every website uses CSS, but CSS is often not considered an “equal” in the modern web development stack. This has led to CSS being taken for granted, sometimes even overlooked. He then goes on to explain why CSS developers are a necessary good and to have a dedicated CSS developer instead of someone who isn’t.

The blog post is sectioned into 3 sections: What Do CSS Developers Do, Why Do You Need a CSS Developer, and Wrapping Up with every section having subsections explaining further on the section. What Do CSS Developers Do covers what they do, CSS tools, techniques, and principles, CSS, the fact Javascript is everywhere, and that writing tidy HTML always matters. Why Do You Need a CSS Developer covers CSS coding standards, CSS design implementation, organizing your CSS code, CSS code in production, and what CSS developers can do for you. Wrapping Up is self explanatory, it’s a conclusion.

As mentioned earlier, CSS was the first programming language I stumbled upon. I stumbled upon it as a kid playing online games and trying to customize my profiles for sites. I didn’t know what it was at the time and just took CSS code from others and used that to format my profile for those online games. It wasn’t until now that I would stumble upon it again in class during In-class activity 15-16 and realize how important it actually is. CSS is one of the forefronts of frontend design and that was something I didn’t know until now because I haven’t dipped my toes in web dev stuff yet. At first I thought front-end web developers were supposed to be jack of all trades for front-end development but after reading this I think having someone who specializes in CSS is essential to your team and as the author says, “do you want to leave your product in the hands of a specialized professional that could polish it to perfection, or would you settle for good enough?”

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

API Design – Getting Started—Alen Pokos

The speaker in this podcast is Alen Pokos, a deputy chief technology officer at Trikodor, a software development company specializing in UX (user experience) and natural language processing for computers, think Siri/Cortana. He spends this hour discussing API design and ideas on how to approach designing web APIs as well as giving personal accounts of his time in the industry and the solutions for common problems he’s encountered.

He begins the presentation defining API as something that enables applications to communicate with one another, it should reflect the goals of the business it is designed to serve, as well as giving a brief description of REST. Pokos goes on to explain common scenarios where Web APIs are usually built; being for other web servers or client consumers such as a web browser or mobile application.

The topic covered in the video that I found most compelling, and really where a lot of the value I gleaned was, was API design. This is primarily what his company presents itself as being experts in. He very poignantly states that “When people disagree on design, it is often they do not agree on the goals.” I’ve run into this situation when designing other things, be it in woodworking, Information Security, Hardware deployment, you name it. It’s something that should really be agreed upon before a project begins which is why software process management strategies all have some form of a task list where goals of development are clearly stated and agreed upon prior to actual development. It is important that before you decide on how a project accomplishes its task, you know what the task is.

I chose this episode because we are currently studying API, frontend, and backend development for the Libre Food Pantry. Understanding the context of what we’re doing and how it may relate to the industry is important for maintaining a firm perspective of how I could potentially translate the skills I’m cultivating into a professional workplace.

From the blog CS@Worcester – Jeremy Studley's CS Blog by jstudley95 and used with permission of the author. All other rights reserved by the author.

To-may-to : To-mah-to; Po-tay-to : Po-tah-to ; Framework : Library?

At the end of my previous blog post, I incorrectly referred to React.js as a framework. It is actually a JavaScript library. Although the two can be used to achieve a common goal, the two terms are not exactly interchangeable. Allow me to use the following analogy to explain my understanding of the two.

The main difference is when you’re using a library, you’re asking for it to assist you with completing your code. Frameworks on the other hand can be used to write your code but require you to “relinquish ownership” and abide by its rules. To discern the two, let’s look at the code to be written in terms of sharing information with one another. 

Scenario A.

You’re browsing StackOverflow and you come across a user who is asking a question about how to use various functions/methods in a particular programming language. You, being a well-seasoned programmer and active user in the StackOverflow community, wish to give this user a bit of assistance. So you decide to do some research on said programming language and functions/methods. Once you’ve gotten a firm understanding of the concepts, you give a friendly and in-depth response to the user, which helps to solve their problem. 

Scenario B. 

You’ve been assigned to write a paper explaining how to use various functions/methods in a particular programming language by your professor. They require the paper to be written in an accepted formatting style (MLA/APA) of your choosing. You, being a top student of your class, do some research to produce a high quality paper that reflects your standing. As you write your paper, to adhere with formatting guidelines, you use in-text citations. Once your paper has been completed you also cite your sources on your works cited page. Your professor gives you perfect marks on your paper due to the accuracy and proper formatting of your paper. 

In both of these scenarios, we were able to relay the information (write our code) in different ways. While the method of finding the information was roughly the same the end product is what differed. 

In scenario A the user was able to answer the question in any manner that suited their needs with no restriction. In scenario B, however, the student was not granted the same leisure and was required to structure their response according to a specific set of guidelines. Scenario A represents the usage of a library in your code, while scenario B represents the use of a framework. While the tools used were essentially the same, the control over the end product was not. The correlation to be made here is the control over the code that highlights one of the main differences between how libraries and frameworks operate.

From the blog CS@Worcester – You have reached the upper bound by cloudtech360 and used with permission of the author. All other rights reserved by the author.

Week 13: 9 Best Practices for Optimizing Frontend Performance

https://blog.bitsrc.io/9-best-practices-for-optimizing-frontend-loading-time-763211621061

So last week I wrote a blog post on good practices for REST API design so naturally I had to follow it up with a blog post on good practices to follow on optimizing frontend performance since we’re working with frontend stuff this week.

This week’s blog post is about a blog post from bitsrc.io from Nethmi Wijesinghe titled “9 Best Practices for Optimizing Frontend Performance.” In this blog post, she writes about 9 best practices that will be useful to the reader to optimize frontend data loading. The 9 best practices she lists are: minify resources, reduce the number of server calls, remove unnecessary custom fonts, compress files, optimize images, apply lazy loading, caching, enable prefetching, and use a content delivery network.

To summarize the 9 practices:

  1. Minify Resources: remove unnecessary, redundant data from your HTML, CSS, and JavaScript that are not required to load, such as code comments and formatting, etc.
  2. Reduce the Number of Server Calls: More calls to server, more time to load. 3 ways to reduce the number of server calls include: using CSS sprites, reducing third party plugins, and preventing broken links.
  3. Remove Unnecessary Custom Fonts: Self explanatory, but also you can take these 3 actions when using fonts on your website like, converting fonts to most efficient format, subset fonts to remove unused characters, and preloading fonts explicitly required.
  4. Compress Files: Compress files to save loading time since larger files = longer loading time.
  5. Optimize the Images: Images improve user engagement but make sure they are optimized to save loading time.
  6. Apply Lazy Loading: Lazy loading allows web page to load required content first and then remaining content if needed
  7. Caching: Allow caching so browsers can store the files from your website in their local cache and avoid loading same assets when revisiting
  8. Enable Prefetching: Prefetching loads the resource in anticipation of their need to reduce the waiting time of the resource.
  9. Use a Content Delivery Network: Using a CDN (group of servers distributed across several geographical locations that store a cached version of the content to deliver fast to the end-user) allows you to optimize loading time as well.

I picked out this blog post because we were using frontend in class during Activity 15-16 and I wanted to follow up with practices to optimize your frontend. This was one I found that was interesting but also introduced new terminology to me. Things like lazy loading, prefetching, and CDNs I didn’t know about until this reading this post. Also, I haven’t had any web dev experience prior to this class and doing the in class activities made me more interested because it was something new to me I had never touched. I knew web dev things existed I just never knew how complex it can actually get and it’s actually made me more interested in possibly pursuing a web dev position instead.

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