Category Archives: Week 8

Why use Docker?

 This week on my CS Journey, I want to talk about Docker. I know we went over several different activities in class; however, I was still a little confused, so I decided to look more into detail from outside sources to understand the concept and terms well. Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. A container is not so much different than a Virtual Machine But, instead of creating a full operating system, a Docker Container has just the minimum set of operating system software needed for the application to run and rely on the host Linux Kernel itself.

The first blog talked about the importance of docker and how to step a docker file in the root directory. There was a 12-minute video from YouTube that explained the concept very well. I learned a lot from that YouTube video. The blog also talked about creating a docker-compose file which is a tool that allows you to deploy and manage multiple containers at the same time. I learned the concepts that go inside a file including, From where to take a Docker file to build a particular image, Which ports you want to expose, How to link containers, Which ports you want to bind to the host machine, and other key commands. This blog was very helpful to do assignment 4 building the Nginx and the MongoDB servers.  

The next blog talked about the benefit of docker, one of the major benefits of containers is portability. Containers can run on top of virtual machines, or in the cloud. This has made it easier to use cases of containers to be around software development. People now can write applications, place it in a container, and then the application can be moved across various environments, as it is encapsulated inside the container which I think is helpful in the environment. It was quite interesting to learn that Docker offers privately hosted repositories of containers, which are about $1 per container. Many tech companies are looking to get into the action of using docker at their place especially the cloud hosting companies.

It was interesting to learn about the concepts of Docker, how to use the commands properly and how major companies are using docker at their workplace, Overall, the blogs and the video helped me to understand the tools behind docker especially running your image from localhost to port and other interesting concepts. I highly recommend everyone check out the video it is well explained.




From the blog Derin's CS Journey by and used with permission of the author. All other rights reserved by the author.

Docker Review


Today I want to explain some information from what I learned in the class and some sources outside.
What is Docker?
Docker is a package of Linux containers, providing a simple and easy to use container interface. It is by far the most popular Linux container solution. It is a kind of visual machine but it also has differences from the visual machine.
Docker packages the application and its dependencies in a single file. Running this file generates a virtual container. The program runs in this virtual container as if it were running on a real physical machine. With Docker, you don’t have to worry about the environment.
Generally speaking, Docker’s interface is quite simple. Users can easily create and use containers and put their own applications into the containers. Containers can also be versioned, copied, Shared, and modified just like normal code.
The main USES of Docker currently fall into three categories. First, provide a disposable environment. Examples include testing other people’s software locally and providing a unit test and build an environment for continuous integration. Second, provide flexible cloud services. Because Docker containers can be opened and closed on demand, they are ideal for dynamic dilatation and shrinkage. Third, establish micro-service architecture. With multiple containers, a machine can run multiple services, so the microservice architecture can be simulated on its own.
Docker mainly contains three basic concepts, namely image, container, and warehouse. Once you understand these three concepts, you can understand the entire life cycle of Docker. The following is a brief summary of these three points that we have a short view of the class.
Docker image is a special file system that not only provides the programs, libraries, resources, configuration files required by the container runtime but also contains some configuration parameters for the runtime. 
The essence of containers is processed, but unlike processes that execute directly on the host, container processes that run in their own separate namespace containers can be. Create, start, stop, delete, pause, and so on, the relationship between an image and a container is analogous to classes and instances in object-oriented programming.
Once the image is built, it is easy to run on the current host, but if you need to use the image on other servers, you need a centralized service to store and distribute the image, and Docker Registry is one such service. A Docker Registry can contain multiple repositories; Each warehouse can contain multiple tags; Each label corresponds to an image, where the label can be understood as the version number of the image.
On the whole, Docker is a concept that is more and more interesting, which is worth our in-depth understanding. 

From the blog haorusong by and used with permission of the author. All other rights reserved by the author.

Adding Comments to Code

This post is about Chapter 4. Comments from the book, Clean Code by Robert Martin. This chapter along with the rest of this book has a strong relationship with the course because it is all about how to write clean organized code. This chapter is on writing effective comments. Rather than long drawn out chapters of plain text, the chapter is split up into many subheadings with even more sub-subheadings. I find this format very useful because it splits up and organizes the information so that it is easier to read and understand. Many of the subtopics have many examples to go with them. This makes it even easier to understand what they are trying to say. The chapter is split up into into two main sections/subheadings, “Good Comments” and “Bad Comments”. Each have many subheadings to them such as “Legal Comments”, “Explanation of Intent” , and “Informative Comments” under the “Good Comments” subheading. “Redundant Comments”, “Misleading Comments”, and “Mandated Comments” under the “Bad Comments” subheading. I selected this article because we have not gone over proper comment writing in my classes (or at least I have not), and I think it would be an important thing to learn for future jobs and class projects. I have found the information in the article to be very direct and informative. As said earlier, it is split up into various subheadings with subtopics so if you are debating whether to add a certain comment into your code, you can go right to topic of the exact type of comment you are looking to add. I have learned about “noise comments” which is basically putting comments that are not needed such as /** Default Constructor*/ over a constructor. I would do this because I would typically like to explain everything in the code but things such as constructors explain themselves. Another is “mandated comments” where you give a javadoc at every single function. I would always do this but it only creates clutter. An example of a “good comment” that I have learned about is “warning comments” where you can warn other programmers of certain consequences for example leaving, “// don’t run unless you have time to kill” above a test with a really big file. Another example of a “good comment” is “amplification” where a comment can be used to amplify the importance of something that may not seem that way. I will be able to apply this knowledge in the future with projects and work to provide clean uncluttered code and powerful, efficient comments.

From the blog CS@Worcester – Austins CS Site by Austin Engel and used with permission of the author. All other rights reserved by the author.


In Past class session we are learning a lot about docker. Not just docker but also how it work with Java & JavaScript. Today I am going to introduce JavaScript and how it work in docker. So let’s start what’s different between Java and Java script. So Java applications are run in a virtual machine or web browser while JavaScript is run on a web browser. Java code is compiled whereas while JavaScript code is in text and in a web page. JavaScript is an OOP scripting language, whereas Java is an OOP programming language.

Do not confuse JavaScript with the java programming language . Both “Java” and “JavaScript” are trademarks or registered trademarks of Oracle in the U.S. and others countries. However, the two programming languages have a very different syntax, semantic, and use.

JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class function While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.jsApache and Adobe. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. The Docker  platform allows developers to package and run applications as containers. A container is an isolated process that runs on a shared operating system, offering a lighter weight alternative to virtual machines. Though containers are not new, they offer benefits — including process isolation and environment standardization — that are growing in importance as more developers use distributed application architectures.

  • JavaScript is used in Web Application Development. Some of the examples are -NetFlix, Facebook, Uber, LinkedIn etc.
  • JavaScript is used in Mobile Application Development. Some of the examples are- Spotify, Instagram, Facebook, Skype, Uber etc.
  • JavaScript is used in Game Development. Let’s see some games where JavaScript is used- Angry birds, Candy Crush ,Systems Offline, Re-wire, Offline Paradise etc.

Runnig JS code in browser: A good way to learn JavaScript is to run it in browser’s JavaScript console. Just open your favorite browser and press F12 key or Ctrl + Shift + I on your keyboard.You will see something like this on the screen now click on the console tab which I marked. And thats your plaground, yes you heard me correct you can write javascript code here. Lets write our legendary program here and see.You will see something like this on the screen now click on the console tab which I marked. And thats your plaground, yes you heard me correct you can write javascript code here. Lets write our legendary program here and see.

here is link to instruction on How To Build a Application with Docker.

From the blog CS@Worcester – </electrons> by 3electrones and used with permission of the author. All other rights reserved by the author.


Following the Docker activities in class, I found docker-compose quite confusing. I decided to use that as an opportunity to look for some other resources that explains the concept briefly but detailed so I can understand the term well. I finally settled on this blog that gives a tutorial on docker-compose. I like the fact that all concepts have been covered and explained simply. I also see some terms that in found confusing during class activities defined and explained. I like how it starts by giving a walkthrough of docker in general and then introduces docker-compose so the connection is clear and as a reader, you would not get lost.

This blog talks about the fundamentals of docker. It explains docker-compose as a docker tool used to define and run multi container applications. It talks about the features of docker-compose, structure of a docker-compose file and explains some of necessary keywords found in the structure. It gives images of structure of docker-compose file and images on docker-compose and docker to differentiate them. Blog also explains some docker-compose commands.

I learned in this blog that you can start using docker-compose with docker files by defining your apps environment using a docker file, defining the services for your app so that they can run in an isolated environment and start the app by running docker-compose. Docker-compose can be added to a pre-existing project and to your workspace if you add a docker file.

Docker-compose files can work by applying multiple commands that are declared within a single .yml configuration file. The compose file consists of keywords that make up the structure such as services, ports, volumes, build, etc. In class, these keywords were not clear to me. However, in this blog I learned that version denotes the version of the Docker-compose which is usually the latest version. All containers created are defined in services and docker composes will create containers based on the name we provide under this section. Build specifies the location of the docker file and ports map the container’s port to the host machine. The image keyword allows to run a service using a pre-build image by specifying the image location. Understanding of these concepts really helped me in the recent homework assignment.

I also learned that the purpose of the build in docker-compose build is to get images ready to create containers but this will be skipped if a service is using a pre-built images. I always thought that docker compose up builds images and run containers but little did I know that it also forks containers directly if images are already built.

I hope others find this blog helpful especially those that are new or beginners to the term, as it will give an insight of the term and that will help guide you through working with docker.

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

Factory Design Pattern

In keeping with my recent learning with java design patterns, I have been learning about the Factory Design Pattern. It is defined as a creational pattern by the Gang of Four and is very widely used because of the plethora of applications that it has. This seemed to be one of the best design patterns to learn as I saw a great many recommendations to do so in my research on design patterns. In the Factory Method Pattern article from Java T Point, the design pattern is made by, “[defining] an interface or abstract class for creating an object but [letting] the subclasses decide which class to instantiate.” In other words, if the client requires multiple similar behaviors, the Factory Design Pattern is used to choose the required subclass instance to complete the required behavior. The article outlines the key advantages to this design pattern, including the promotion of “loose-coupling” because of the lack of application specific classes into the code. It then gives a couple of examples for usage including a class not knowing what subclasses will be required. There is then a simple UML diagram which shows a small example of how an electricity bill may be calculated using the Factory Design Pattern. This example is then expanded upon. First, an abstract Plan class is created. It contains an abstract getRate method and a concrete calculateBill method. The subclasses show the real usefulness of the design pattern. There are 3 subclasses: DomesticPlan (with a rate of 3.50), CommercialPlan (with a rate of 7.50), and InstitutionalPlan (with a rate of 5.50). Each class implements the getRate method, which sets the Plan class’s rate variable to their respective rates. From here, a GetPlanFactory class is created which uses the Plan class and its subclasses to return a Plan object. The one method here is getPlan, which takes a string variable and has a set of if statements, each of which returns a different Plan subclass object depending on the string. Finally, the GenerateBill class is the one which the client interacts with. It asks the client the name of the plan needed, which the PlanFactory class uses to return an object of the one of the Plan subclasses. Then, units of electricity are taken from the client. The Plan subclass object then calls getRate to get the rate associated with the plan, and then calculateBill to tell the client the total charge for electricity usage. Although the explanation seems complicated, it is quite simple and clean in implementation, and extremely useful when one does not know which of a given set of behaviors will be required. I expect I can use this design pattern quite frequently in my personal, school-related, and professional coding. 

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

Practice Makes Perfect

The pattern “practice practice practice” is what the title implies and focuses on one of the most important things in any kind of career. The idea that practice makes perfect has been apart of every job/hobby/club/etc. since the beginning of time. Since programming puts you in a situation where any mistake could ruin the entire project/work, you need to avoid mistakes at all costs. Practice allows for programmers to work on different things and see what works for both them and what ever they are working on. The pattern suggest that you solve an exercise multiple times over a few weeks from scratch and see how your solutions evolve and change overtime and use those in your future projects.
This pattern is something that I thought of when reading the breakable toys pattern since they have a similar aspect of taking things from work home and expanding your knowledge on things that could be used in projects. I felt like this would be something that I would need to do for most jobs in the field of computer science. I think one thing that I found interesting was how it suggests to use exercises in different books because it wasn’t something that I would have thought of to help practice on different aspects of coding. The pattern, similar to breakable toys, suggests to have fun with it and not worry about things like deadlines, production issues and so on cause it allows you to expand on what you learned and see what works and what doesn’t. I felt like this pattern had a lot that I wish I knew about when I began computer science classes because it would have made my learning experience easier and more enjoyable.
I will use this in my professional career since it seems to be something that would benefit me and help me to be a better developer and computer scientist. The idea of using different computer science books on different topics and using the exercise in the book were a good idea that I will use in my career as well. While old books may have the fundamentals of coding, it is important to get newer books focused more on the languages that are being used since they will have a good understanding of how to use the language to the best of its ability.

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

Analysis and Comparison of Ascending and Descending Scales

With added pressure in realizing the semester is half over, as well as an upcoming interview for a position dealing with DSP and machine learning, I came into this week with newfound motivation. The focus that comes with a little bit of pressure is paradoxically quite freeing.

I had some issues when attempting to compare features between audio files. In hindsight, it was an obvious mistake that I had already learned in theory. But of course, applying theoretical knowledge always reveals the points of weak understanding.

As I’ve written in the past, MFCC (mel-frequency cepstrum coefficients) are most common with speech processing. There are time slices taken from the audio file and by default Librosa calculates 13 coefficients commonly used for speech processing. The MFCC is an array of time slices, each represented by 13 coefficients. These are plotted below, with color representing magnitude (from dark blue to dark red), time slices on the y-axis, and coefficients on the x-axis. The waveform, MFCC Delta, and Chromagram are also plotted.

The chromagram is of particular interest, as it extracts the frequencies in the time domain, revealing that the scale on the left is ascending and the scale on the right is descending. You can even see where my finger slipped playing the descending scale.

Analysis of an ascending and descending scale

This shows the importance of scale invariance when comparing features, which will also come to play in machine learning. This is why frames of equal time-slices, which usually overlap, are taken from an audio sample.

Originally, I was extracting features without cutting the audio files to the same size. This resulted in a larger MFCC. Attempting to plot the difference between the features caused an error. Files with the same length, however, naturally resulted in two arrays of the same size. Because they were only slightly off, I wanted to be sure that my understanding was correct, so I made the ascending scale exactly half the size and ran the program again.

Indeed, cutting the first sample in half reveals that the resulting matrix has half as many MFCC time slices. Librosa extracts the first 13 mel-frequency coefficients, so each array will be length of 13 and each time slice will have one of these arrays. Trying to find the difference by subtracting one matrix from another results in this error message:

ValueError: operands could not be broadcast together with shapes (44,13) (87,13)
Analysis after cutting the ascending scale in half

Also notice the chromagram only reveals 4 major frequencies. And because a chromagram is in the time domain, but the plot still has the same x-axis, the notes end at approximately the halfway point.

Plotting the absolute difference between MFCC features may not be visually illuminating, but potentially has uses for pattern identification. The real utility comes from comparing an audio sample to existing files. Take a look at the ascending versus ascending scales:

The absolute difference in MFCC features between ascending and descending scales

There is little difference in the higher coefficients, but some strong differences in the first coefficient. There are irregular differences through the rest of the plot, both in time and within coefficients. In isolation, this doesn’t reveal much. But when instead comparing two ascending scales offset by 0.1 seconds, the differences are very small. There are regular spikes in the first coefficient however, likely due to the earlier change of note in one sample.

The absolute difference in MFCC features between ascending scales, offset by 0.1 seconds

This lack of difference is one example of how a machine learning algorithm can detect whether a audio sample fits into a group. Actually training these models will be the topic for next week.

From the blog CS@Worcester – Inquiries and Queries by James Young and used with permission of the author. All other rights reserved by the author.

“Use the Source”

“Use the Source” is a pattern from Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman by Dave Hoover and Adewale Oshineye. This pattern focuses on the need for reading code written by other developers. Some good sources of code to examine are open source projects. By examining source code, a programmer can see what their bad habits are and adopt new, better habits. Another benefit from code reading is learning new algorithms to solve different kinds of problems. Expanding one’s collection of code solutions allows a programmer to be flexible and able to solve more problems.

I found this pattern particularly interesting. Since programmers are constantly required to work with other’s code, it is imperative that they learn to read code efficiently with practice. I do not have much experience with this myself and this pattern has made clear how important reviewing other’s code is. Regardless of what career I pursue after graduation, it will be important to read code effectively. I will need to start looking into some open source projects so I can improve my skills. Now I just need to find some projects that I contribute to and am interested in.

“Use the Source” suggests contributing to open source projects for software you already use. This is very helpful advice to me; I use a lot open source software.

  • Atom: text editor
  • Eclipse: IDE
  • Insomnia: REST client
  • GIMP: image editor
  • Several different game system emulators

I briefly examined some of GIMP’s source code. GIMP has a label on issues for newcomers, allowing for quick access to simpler issues.  After reading through some of the code, I realized that it would take a great deal of time to get an idea of the project architecture.

I looked at this issue, (, and thought it seemed simple enough problem to start with. While the problem seemed simple, I could not navigate the repository and locate where the problem may be. GIMP is significantly more complex than any project I have worked on before. Ultimately, I was not able to make any headway on the issue. I was, however, able to read through portions of the code and begin to see some of the structure behind the it. Though I did not find what I was looking for, I did get a basic feel of the code’s flow.

As stated in Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin, developers read far more code than they write. With that being the case, “Use the Source” is an excellent way to grow your code reading skills.

From the blog CS@Worcester – D’s Comp Sci Blog by dlivengood and used with permission of the author. All other rights reserved by the author.

Digging In

The Dig Deeper pattern is all about knowledge and gaining more of it. More specifically, this pattern is about taking something new that you have learned or are currently learning and teaching yourself about that subject’s roots. It’s not enough to know how to use the subject matter to solve your specific issue, you need to know that subjects use as a whole to gain knowledge of its context. This pattern is about understanding how a system works as a whole and not just the part you are working on. This deeper knowledge allows you to understand your work more concisely based on the context of it as a whole, which will help you understand your specific issue even more.

When I first started reading on this pattern it felt like a very blunt lecture. It felt as though I was being told to learn everything to its fullest and if I do not then I will be a less desirable individual for hire. However, as I read on I realized it was not about having total knowledge of EVERYTHING, that would be overwhelming and nearly impossible. I began to understand that it was about delving your knowledge into specific things, subjects that you are currently working on. If you are working on a specific issue and find the solution, it’s not about knowing every way to solve the problem, but to know in detail the workings of your solution.

This pattern further enforced my idea that you can do anything, learn anything if you put your mind to it. If there’s something I really want to excel at, deepening my knowledge can only help me achieve my goal. Being able to fully express my knowledge on the specific things I have worked on, though maybe few, is far greater than a larger quantity of surface knowledge. It reminds me of using MongoDb for the first time in our libre food pantry project. It’s all good and well to set up a database and query and get the results you want. However, it’s much more important to understand how the database functions beyond my own entries and data types I’m working with. In furthering my knowledge I was able to communicate my understanding into the other areas of the project including tying the database to a Java REST API. I fully agree with the ideologies of this apprenticeship pattern, dig deeper into your knowledge and it can only benefit you.

From the blog cs@worcester – Zac's Blog by zloureiro and used with permission of the author. All other rights reserved by the author.