Category Archives: Blog

What is Javascript

Summary:

This article starts off by defining Javascript as a scripting or programming language that allows for us to implement complex features on web pages. It enables you to create dynamically updating content, control multimedia, animate images, and a lot more. They continue on with explaining Application Programming Interfaces and how they support the top side of Javascript. What is also explained is what Javascript is doing your page from browser security, to javascript running order, Interpreted versus compiled code, server-side versus client-side code, and dynamic versus static code. There’s also a section where we are shown how to add javascript to our page.

Reason:

The reason I chose this article is because we have been doing a lot with javascript on our in-class assignments and projects and I thought it was a good idea to find something that is informative and can help with that. We haven’t worked much with front-end languages and their functionality for long so this article can help give us a better in-depth look at javascript and how it functions.

What I Learned:

JavaScript is a scripting or programming language that allows you to implement complex features on web pages. Javascript  is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and lot more. APIs are functionality built on top of the client-side JavaScript language and provide you with extra superpowers to use in your JavaScript code. They fall into two categories, Browser APIs and Third Party APIs. Browser APIs are built into your web browser, and are able to expose data from the surrounding computer environment, or do useful complex things. Third party APIs are not built into the browser by default, and you generally have to grab their code and information from somewhere on the Web. A very common use of JavaScript is to dynamically modify HTML and CSS to update a user interface, via the Document Object Model API. In interpreted languages, the code is run from top to bottom and the result of running the code is immediately returned. Compiled languages on the other hand are transformed into another form before they are run by the computer. Client-side code is code that is run on the user’s computer, and Server-side code on the other hand is run on the server, then its results are downloaded and displayed in the browser. Dynamic Code refers to the ability to update the display of a web page/app to show different things in different circumstances, generating new content as required.

Source: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_is_JavaScript

From the blog CS@Worcester – Life as a CS Student by Dylan Nguyen and used with permission of the author. All other rights reserved by the author.

What is GRASP?

GRASP is short for General Responsibility Assignment Software Patterns. GRASP is a design pattern in object-oriented software development. It’s a tool for software developers that provides a way to solve organizational problems. Also, it offers a common way when talking about abstract concepts. This design pattern sets responsibilities for objects and classes in object-oriented program design

     In GRASP (General Responsibility Assignment Software Patterns) when working with object-oriented programming, it classifies problems and the solutions together into a pattern. Thus making them well defined where they can be applied in other similar instances. Grasp has nine different patterns for classes and objects that helps make it clear to show the responsibilities. The nine patterns are:

– Controller: Assigns the responsibility of dealing with system events.
– Creator: Most common in object-oriented system, which class is responsible for creating objects.
– High Cohesion: Evaluative pattern that attempts to keep objects focused, manageable and understandable.
– Indirection: Pattern that supports low coupling and reuses potential between two elements.
– Information Expert: The most basic principle – if we do not have the data we need, we would not be able to meet the requirement and assign responsibility.
– Low Coupling: A measure of how strong one element is connected to, has knowledge of, or relies on another element.
– Polymorphism: Responsible for defining the variation of behaviors based on the type is assigned to.
– Protected Variations: A pattern that protects elements from the variations on other elements by wrapping the focus with an interface and using polymorphism to create various implementations.
– Pure Fabrication: A class that does not represent a concept in the problem domain.

     I chose to write about GRASP (General Responsibility Assignment Software Patterns) because it is a part of our curriculum which we will be learning in this class. Since I have written about DRY (Don’t Repeat Yourself) and YAGNI (You Ain’t Gonna Need It), it made sense to continue researching about patterns and learning more about it. As I have mentioned many times before, I plan on becoming a full-stacked developer. Learning about these different types of patterns and what each of them do will help me as a developer become more knowledgeable and more efficient when it comes to coding. 

A good blog I found when researching this topic that I suggest to read and learn more about GRASP is:
http://www.kamilgrzybek.com/design/grasp-explained/.
This Blog is very useful and has many examples of the nine patterns I mentioned.

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.

JSON

Summary:

This article gives us insight into JSON and why it is a popular format that we can take advantage of. We learn about what JSON is, the history of JSON and how it came to be, JSON structure, syntax, and usage, the benefits of JSON, and how to use JSON. After reading this, we should have a better understanding of how JSON works.

Reason:

The reason why I chose this article was because now since we are working with REST APIs in class, I felt that it was important to find an article that would assist with that. There’s a lot we still have to learn with JSON and after reading this I hope it helps anyone who reads this to understand the syntax and structure of JSON.

What I learned:

JavaScript Object Notation (JSON) is a data format that was built to be easily readable for both humans and computers. It has become the most popular way for applications to exchange data, and its most commonly encountered when working with APIs. JSON is a data interchange format that is easy to parse and generate. JSON is an extension of the syntax used to describe object data in JavaScript. It has a text format that uses object and array structures for the portable representation of data. All modern programming languages support these data structures, making JSON completely language independent. JSON is commonly associated with REST services, especially for APIs on the web. Although the REST architecture for APIs allows for any format, JSON provides a more flexible message format that increases the speed of communication. The structure of a JSON object are curly braces {} hold objects, the data are in key, value pairs, square brackets [] hold arrays, each data element is enclosed with quotes if it‘s a character, or without quotes if it is a numeric value, and commas are used to separate pieces of data. JSON data types are string, number, object, array, boolean, and null. The benefits of JSON are that it’s compact and efficient format, easily readable, broadly supported, self-describing, and has a flexible format. YAML is a superset of JSON that’s primarily designed to support more complex requirements by allowing user-defined data types as well as explicit data typing. Most popular programming languages have built in support to parse JSON, but they also include a plethora of JSON manipulation functions including the ability to modify JSON, save to and read from JSON files, and convert common data objects into data formats. JSON has become a vital tool of the developer arsenal because of its ease of use, efficiency, and flexibility.

Source: https://www.nylas.com/blog/the-complete-guide-to-working-with-json/

From the blog CS@Worcester – Life as a CS Student by Dylan Nguyen and used with permission of the author. All other rights reserved by the author.

What is Docker?

Summary:

This article goes over what docker is how it has it become so mainstream today. They generally go over what containers are, the components of docker, docker’s advantages, and even it’s drawbacks. Docker became popular due to the fact it makes it easy to move code for an application and all of its dependencies from the developer’s laptop to a server. After reading this article, we should have a general understanding of what exists within docker and how it works.

Reason:

The reason I chose this article was because we use docker very often in class and most of use had never heard of it coming into to computer science. Why suddenly was it something that seemed so instrumental in most of our assignments? As we continued to use docker, the more and more it appeared to use how versatile it was and the power of its capabilities.

What I learned:

Docker is a software platform for building applications based on containers, it uses small and lightweight execution environments that make shared use of the operating system kernel but otherwise run-in isolation from one another. Containers are self-contained units of software you can deliver from a server over there to a server over there, from your laptop to EC2 to a bare-metal giant server, and it will run in the same way because it is isolated at the process level and has its own file system. A docker file is a text file that that provides a set of instructions to run an image. A docker image is a portable read-only executable file containing instruction for creating a container. Docker run utility is the command that launches a container. Docker hub is a repository where images can be stored, shared, and managed. Docker Engine is the server technology that creates and runs the containers. Docker compose is a command-line tool that uses YAML files to define and run multi container Docker applications. It allows you to create, start, stop, and rebuild all the services from your configuration and view the status and log output of all running services. The advantages are that docker containers are that it’s minimalistic and enables portability, they enable composability, and they help ease orchestration and scaling. The disadvantages however are containers are not virtual machines, they don’t provide bare-metal speed, and they are stateless and immutable. Today container usage continues to grow as cloud-native development techniques become the mainstream model for building and running software, but Docker is now only a part of that puzzle.

Source: https://www.infoworld.com/article/3204171/what-is-docker-the-spark-for-the-container-revolution.html

From the blog CS@Worcester – Life as a CS Student by Dylan Nguyen and used with permission of the author. All other rights reserved by the author.

REST APIs

Summary:

This article helps us understand how to be able to read APIs and use them effectively by teaching us what we need to know about REST APIs. They go over The anatomy of an API request, Testing Endpoints with cURL, JSON, Authentication, and API versions. After reading this article we should be able to learn how to use cURL to perform request with GET, POST, PUT, PATCH, and delete. As well as that we should get a grasp on how to authenticate our requests with the -u option and what HTTP statuses mean.

Reason:

The reason behind choosing this article is because in class we just recently started learning about APIs and I think it is one of the most important real world skills we need in order to be a software engineer.

What I learned:

An API is an application programming interface. It is a set of rules that allow programs to talk to each other. The developer creates the API on the server and allows the client to talk to it. REST stands for “Representational State Transfer”. It is a set of rules that developers follow when they create their API. One of these rules states that you should be able to get a piece of data when you link to a specific URL. In the anatomy of a request, you have the endpoint, the mother, the headers, and the data (or body). The endpoint (or route) is the url you request for. The method is the type of request you send to the server and you can choose from GET, POST, PUT, PATCH, and DELETE. These methods provide meaning for the request you’re making. They are used to perform four possible actions: Create, Read, Update and Delete. Headers are used to provide information to both the client and server. It can be used for many purposes, such as authentication and providing information about the body content. The data contains information you want to be sent to the server. This option is only used with POST, PUT, PATCH or DELETE requests. JSON also known as JavaScript Object Notation is a common format for sending and requesting data through a REST API. On the web there are two main ways to authenticate yourself and that is with a username and password but also with a secret token. Developers update their APIs from time to time. Sometimes, the API can change so much that the developer decides to upgrade their API to another version. If this happens, and your application breaks, it’s usually because you’ve written code for an older API, but your request points to the newer API. You can request API version in two ways, and that is directly in the endpoint or in a request header.

From the blog CS@Worcester – Life as a CS Student by Dylan Nguyen and used with permission of the author. All other rights reserved by the author.

What is YAGNI?

     Just like my post from last week, YAGNI is another acronym in computer science. It’s an acronym for “You Aren’t Gonna Need It”. Which translate to only having features added when they are required. It’s another type of principle that is heavily followed in computer science. This is a large part of development since it trims away any excess and inefficient part of the program.

     The YAGNI principle tells you to mainly focus on current tasks. This however does not mean you cannot work on future steps but if it’s something that doesn’t need to be done currently, then you shouldn’t spend time doing it now since you can be working on something that will be more valuable now. A real-world example that I found can be that a client orders a kayak but is given a yacht. They both float on the water, but the yacht is like a luxury house on the water, where as the kayak is a simple vessel used to travel on water. In this case the yacht isn’t necessary as the client only wanted to travel or even just float on the water. This is considered “over-engineering”. This is a term that can be define as making something more complex instead of simplifying things

     There are many advantages to YAGNI. First, you will be saving time which also means you are saving money. Without having complex code, it makes it easier for others to understand the code. Without all the unnecessary coding, the code itself is better quality and allows developers to focus more on what the code is about instead of having to figure out what everything does. Following the YAGNI principle allows developers to not waste time on creating extraneous elements that may not be necessary or slow the development process.

     The reason why I chose to write about the YAGNI principle is because it is a part of our curriculum. Since I am planning to become a developer, I need to learn the different principles when it comes to programming. Learning about the YAGNI principle will help me become a better programmer as I will know to only work on the current tasks and not try to implement more complex code that will not be used until a later date or when it is necessary.

Here are some blogs I recommend to those who want to learn more about the YAGNI principle.
https://codibly.com/news-insights/yagni-how-to-do-things-when-you-actually-need-them-to-be-done/
https://whatis.techtarget.com/definition/You-arent-gonna-need-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.

What is DRY?

First of all, what does DRY stand for? It is a term “don’t repeat yourself”. In the software engineering world, this is a principle of reducing repetition in the code, referring to a single source-or “snippet” -of reusable code whenever you need it.

An example of this could be an app that your programed that throws a ball for your dog once an hour throughout the day. Instead of writing the entire code out for finding the ball, picking up the ball, and throwing the ball every hour, you can write the code once and give it a name such as toss.ball. This will then allow you to just type toss.ball each time to call it. This saves a lot of time writing the code.

Not only are we saving time when first writing out the code, but it also means that there will be less human error as well. From the example, if we were to write out the code entirely 24 times (1 for each hour), you would be bound to make some sort of error at least once. Another reason how this is also effective is that if you wanted to change the object being thrown for example a stick, all you would have to do is change the term ball once, instead of doing it 24 times.

In terms of real life, we can see this being used when we let websites save our information such as logins, password, or any other type of information we would have to type in each time. The same goes for music. If we are using sites such as Spotify, most of us create playlists so we don’t have to constantly look for the song we want to listen to.

I chose to write about this topic because it is part of our curriculum. We will be learning about this principle along with others as it is an important part of coding. I will post a link that will take you to a blog I read. https://zapier.com/blog/dont-repeat-yourself/ I really enjoyed going taking the time to go through this blog because it taught me and showed the importance of reducing time when it comes to coding. I also recommend this blog to anyone who plans to become a software engineer because it goes into depth about DRY and uses many examples to help you understand how it works. It amazes me how a simple principle could do so much such as saving time, less human errors, and overall having a simple code.

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.

Interface vs Abstract class vs Concrete class

Summary:

As a programmer, java is all about classes and there are design patterns that we must follow, and it is our duty to question them. Java is an object orientated programming language where we have the ability to write our code in the form of reusable classes. Code re-usability doesn’t start by creating objects out of classes, it starts way before that when we are creating the classes itself. The class types that we have available to us are Interface, Abstract, and Concrete classes.

Reason:

The reason why I chose this article was because I thought this article would help us understand why we us certain classes and when to use them. In class we have gone over different design patterns where the uses of every class are different depending on what we want to achieve. I believe that it is important to fully understand how they each function as it will make understanding the design patterns much easier.

What I’ve Learned:

Interfaces are a blueprint for your class that can be used to implement a class and an interface cannot have any concrete methods. What your interface can have are static members and method signatures. All methods that you declare in an interface can have static, default or abstract modifiers. Abstract methods cannot have a body; all they can have is a method signature. Variables are not allowed in interface. Hence any data declaration is public static final. Interfaces can extend other interfaces (one or more) but not classes (abstract or not). Interfaces cannot be instantiated as they are not concrete classes. Methods and constants cannot be declared private, methods cannot be declared final.

Abstract classes are a bit different from interfaces. These are also used to create blueprints for concrete classes but abstract classes may have implemented methods. Abstract classes can implement one or more interfaces and can extend one abstract class at most. A class can be an abstract class without having any methods inside it. But if it has any methods inside it, it must have at least one abstract method. This rule does not apply to static methods. As abstract classes can have both abstract and non abstract methods. Static members are allowed. Abstract classes can extend other at most one abstract or concrete class and implement several interfaces. Any class that does not implement all the abstract methods of it’s super class has to be an abstract class itself.

Concrete classes are the usual stuff that every java programmer has come across for sure. It is like the final implementation of a blueprint in case you are extending it some abstract super class. A concrete class is complete in itself and can extend and can be extended by any class. The only condition is that all the methods have to be implemented in order for it to qualify as a concrete class.

From the blog CS@Worcester – Life as a CS Student by Dylan Nguyen and used with permission of the author. All other rights reserved by the author.

What Is Unified Model Language (UML)?

Unified Model Language is the standardized modeling language that consists of integrated set of diagrams, that were developed to help system and software developers. This allowed them to specify, visualize, construct, and document software systems which also works well for business modeling and non-software systems. The UML consists of some of the best engineering practices that have been proven successful in large and complex systems. When becoming a developer, it is important to learn UML because it is a very important part of developing object-oriented software and the software development process. The way UML are expressed is mostly through graphical notations to show the design of software projects. UML is very useful for project teams because it helps them communicate, explore potential design and validate the architectural design of the software.

UML has many uses and one of them is the uses of diagrams. The diagrams are divided into three categories. The three categories are Structure Diagrams, Behavior Diagrams, and Interaction Diagrams. Structure Diagrams is a category that includes Class, Object, Component, Composite, Package, and Deployment Diagrams. Another category is the Behavior Diagrams include the Use Case Diagram, Activity Diagram, and State Machine Diagram. The last category is the Interaction Diagram which is derived from the general category of Behavior but also includes the Sequence, Communication, Timing, and Interaction Overview Diagram. Other things that are useful with UML is that it has tools to analyze existing source code and reverse-engineer it into a set of UML diagrams. There are also tools that allow the UML models to be executed. Another interesting tool I found is that you can generate a program language code from UML, that is mostly bug-free. There’s also several tools that can generate Test and Verification Suites from UML models.

I chose to write about the topic of Unified Model Language (UML) because it is part of our curriculum. It is one of the first topics we touched in our CS343 class. Also, I believe it is very important to understand how UML works as a developer. This allows teams to work together and understand what needs to be done and the connections that are being made. While researching this topic I found a few sites that elaborates on what UML is and I recommend anyone who’s thinking of becoming a developer to look at the links I provided down below.

Links:
https://www.uml.org/what-is-uml.htm
https://www.visual-paradigm.com/guide/uml-unified-modeling-language/what-is-uml/

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.

Why Encapsulation Matters

Summary:

In this article, they don’t show us examples of encapsulation but instead explain to us the importance of it and why we do it as software engineers. Initially, they start off with how encapsulation helps us hide the complexity of our code. The beauty of hiding our code is not having to understand all the details in order to be able to use it, we just need to understand a broader abstract concept and how it works and how we interact with it. They also explain to us what happens when are not able to achieve the proper levels of encapsulation in our design. That article continues as to why we need accessor and mutator methods in Java.

Reason:

The reason why I chose this article was because in class we have done a lot coding in regards to encapsulation and I thought that this would help me fully grasp the purpose and meaning of encapsulation. Encapsulation is the very essence of API’s and how they work and being able to understand this is very important since we may be creating API’s in the future.

What I’ve Learned:

Encapsulation is more than just defining accessor and mutator methods for a class. It is a broader concept of programming, not necessarily object-oriented programming, that consists in minimizing the interdependence between modules and it’s typically implemented through information hiding. Our software designs the visible parts of our modules/classes constitute their public interface, and this is exposed to the outside world, the rest of it should be hidden to the naked eye. With encapsulation us as humans deal with complexity by defining abstractions with public interfaces so that we are able to interact with them and all of the code that lies beneath it is unnecessary in order for use it. It is like an iceberg, only a small portion of it is visible on the surface, but most of its true size is hidden underwater where we cannot see it. Changes can we made in directional systems because internal implementation is encapsulated and because of that, changes can we safely done without affecting it’ public interface. By minimizing the impact of changes and independence of modules, we can achieve proper levels of encapsulation in our software that can handle change without breaking its users. Information hiding is important because it decouples modules that compromise a system and it allows for them to be tested, optimized, used, understood, and modified in isolation. This allows for other modules to be developed in parallel and eases the burden of maintenance without the fear of affecting other modules. Encapsulation is a desirable attribute that allows for the evolution of APIs and as long as we respect public interfaces of our abstractions, we are free to change whatever has been encapsulated. Failing to define proper abstraction with proper levels of encapsulation will end up causing difficulties when change happens. There is no way to change the public interface of an abstraction without breaking its users. Encapsulation is one of the tools we use that help us create good abstractions, but no level of encapsulation is going to make bad abstraction work.

Source: https://dzone.com/articles/why-encapsulation-matters

From the blog CS@Worcester – Life as a CS Student by Dylan Nguyen and used with permission of the author. All other rights reserved by the author.