Category Archives: Week 7

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

Docker in a nutshell

The blog post starts by identifying what are the different teams in software development and what each team does or is responsible for. It also talks about how what the development team does might be counterintuitive to what the DevOps team does and create problems for the two teams. An example of such a case would be when the development team adds a new feature because the new feature might affect the stability of the code by breaking the code which leads to problems for the DevOps team. The blog post also talks about what is Docker and containerization. It defines both terms and lists the benefits and features of both. It also talks about how Docker and containerization can solve problems that arose when we use virtual machines. For example, Docker can have faster build and testing times. Then, the blog identifies and talks about the different parts of the Docker architecture. In the post, it identified that Docker is composed of four components: images, containers, registries, and the Docker engine. The post defines each term and what each one does. The rest of the post talks about the components of the Docker Engine (such as the daemon, how to submit requests to said daemon…etc.) and why we should use docker, what are its benefits and what are its alternatives.

I personally really like this blog post made by the BNC Software company because the article is not too long or difficult to read. Personally, I have always had a terrible memory and been the kind of person where if I read something I can form some sort of an understanding about something, but I won’t completely understand or remember the topic until I get a formal definition. So, I chose this blog post to look at because I think this post does just that for me. The post explains the terminology in almost layman terms which makes it easier for me to remember and understand the material. Another reason why I chose this particular post is because I think this blog post explains the basics of Docker very well and is a great resource for us to have as we start moving on to more advanced topics in Docker. While reading this post, I think it brought up an interesting point about how the development team can interfere with the work of the people on the DevOps team. This was a question that I had before but never really thought about or put in the time to research this topic. It reminds me of what we learned in Software Process Management and LeBlanc’s Law. Starting up a Docker container takes a lot of initial effort and time commitment, but it would save us time in the long run because we would run into fewer problems of incompatible code and run less of a risk disrupting the stability of the code.

From the blog CS@Worcester – Just a Guy Passing By by Eric Nguyen and used with permission of the author. All other rights reserved by the author.

CS-343 Post #3

I wanted to read more about micro-services and monolith architecture after working on the recent activity with them and comparing and contrasting the two. They both have their benefits and have similarities, but there are important differences that make people question which is the better choice for designs that they are working on.

Monolith architecture has one database and is more contained, but is more risky to change and update because of how reliant it is on database. Microservices has two databases and has less risk because there is less reliance on each database and one that is getting changed will only affect up to half the system, while monolith risks the whole system being affected. Monolith is faster because it uses one database instead of two and less overall components, but micro-services is safer and better for larger or more complex systems. Microservices seems the better choice out of the two, but monolith has its benefits that should be kept in mind.

I wanted to look more into the two architectures and found an article “Microservices vs Monolith: which architecture is the best choice?” from N-iX, that went over the two and did more comparisons. Monolith was described as the default model for a while, but microservices was getting more traction and monolith is less used. The purpose of the article was to go over the two and decide if monolith is still useful and what it could still be used for.

More comparisons between the two were talked about as the article went over the strengths and weaknesses of both. The pros and cons that were already talked were mentioned, such as the risk of changing components in monolith and how microservices is better for more complex systems, but there were some that were either not mentioned or briefly talked about in the activity that show up in the article that makes the debate between the two architectures more even.

While monolith is more risky, it is more simple to work with and has less overall components to work with, which can make it effective for less complicated systems. It was also said that it is easier to debug and test monolith because it works as a single unit while microservices is multiple. Microservices is better with complex systems and can be easier to understand because of the division of the architecture with the multiple databases, and there is less risk with changes. Flaws of microservices are that it can get too complex, testing is more difficult, and has more cross-cutting issues.

In conclusion, monolith does still have its benefits and is better than microservices for simple and smaller systems, while microservices is better for complex and larger systems but would need more experience to use it efficiently.

https://www.n-ix.com/microservices-vs-monolith-which-architecture-best-choice-your-business/

From the blog Jeffery Neal's Blog by jneal44 and used with permission of the author. All other rights reserved by the author.

Docker compose

For the homework#3 of this week, I had a chance to practice on the docker compose. However, excepting for the little knowledge that I learned from the activity 10 in class, I had no clue what docker compose was. Therefore, I wanted to learn more about docker compose to get a better understanding and also learn how to write a docker compose file.

Docker Compose Tutorial: advanced Docker made simple is one of the resources that I find useful to help me get an overview about the docker compose, how to write an .yml file, and how to run the .yml file with docker-compose commands. Through the website, I know that docker compose is used to define and run multi-container Docker applications; and I also get an idea of what components should be included in a .yml file to create a docker container. Specifically, to create a container service, we need some entries like build, link, image, ports, volumes, command, environment, etc.; and the function of each entry is also described in detail on the website. For example, back to the activity 10 in class, now I am able to convert the docker command given in the below picture to an equivalent .yml file.

As shown in the above docker command, my .yml file will create a container named cache using the image named redis with the tag of 6.0.8. This container has internal port 6379 connecting to the external port 11000, and it also mounts two directories of ./redis.conf and /etc/redis.conf. So, the components that should be included in my .yml file are version, services, web, image, ports, and volumes.

First, version is to define which version of docker compose that I am using. Services is used to define all different containers that I want to create. Web is use to present the container name, in this case, I will replace web with cache. Image will represent which image is used to create the container (redis:6.0.8). Ports is used to map the external port with the internal port (11000:6379). Volume is used to mount the source directory, ./redis.conf, with the destination directory, /etc/redis.conf.

In short, in my opinion, I believe the website that I found is a good resource, because from it, I can find really useful information about docker compose, such as definition of docker compose, how to write .yml file, and docker-compose commands. Thanks to this resource, I am more familiar with .yml file and docker-compose commands. Especially, I used what I learned from this website to do my homework 3.

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

Design Patterns

  • Creational
  • Structural
  • Behavioral

In what is called software engineering, a design model describes a solution that is determined by the problems found in the design of the software. It makes it possible to represent practices that are best and which evolve over a longer period of time through gaming but also testing that is done by software experienced developers.

1)Creational Design Patterns are patterns that explain how an object can be created. These models make it possible to reduce the complexity but also the instability that they have by making the creation of objects in a more controlled way.

In most cases, the new operator is often considered harmful as it distributes objects throughout the application. This can become even more challenging over time, in order to change the implementation, for the sole reason that the classes have a very close relationship with each other.

Creative design models address this issue here by making the client disconnect from the initialization process that is currently underway.

1. Singleton – Makes it possible to provide a single instance of an object that exists during an application.

2. Factory Method – It is possible to create different objects of different classes that are related, but without making specifications in the exact object that can be created.

3. Abstract Factory – Makes possible the creation of families that are dependent but also connected together.

4. Builder – Has the ability to build complex objects using one approach after another, or in other words step by step.

2) Structural design patterns– These are models that have to do with what is called the organization of objects and classes that are different, but also that change the formation of structures from the largest, but at the same time to make it possible to provide the functionality of ri.

Explain how the structural design model is used-

At the moment when we have two interfaces that have an incompatibility with each other but also that want to have a relationship between them by having adaptation with each other, it is also called as the adapter design model. This model, also known as the adapter model, converts an interface of a class to an interface or another class that the client expects. In other words, what is called adaptability somehow allows the classes to work together, which at another point due to incompatibility could not have happened otherwise.

3)Behavioral design patterns represent the responsibility but also the interaction of different objects.

By generalizing these design models, the interaction that takes place through objects should be in such a way that they too can talk smoothly to each other.

Translated into simpler words, in order to avoid dependencies but also difficult coding, the application and the client at the same time should be connected as loosely as possible.

Behavioral design models have 12 types usable for this model:

1. Enterprise chain model

2.Command model

3.Performer model

4.Iterator Models

5.Broker model

6.The model of memories

7.Observer model

8.The state model

9.Strategy Model

10.Template model

11.Visitor model

12.Object Null

References:

https://www.gofpatterns.com/design-patterns/module2/three-types-design-patterns.php

https://howtodoinjava.com/design-patterns/creational/

https://howtodoinjava.com/design-patterns/structural/

https://www.ifourtechnolab.com/blog/a-complete-guide-on-behavioral-design-pattern-and-chain-of-responsibility-pattern-in-java

From the blog CS@worcester – Xhulja's Blogs by xmurati and used with permission of the author. All other rights reserved by the author.

UML Diagramming

Unified Modeling Language otherwise known as UML is one of many different modeling languages/types used in programming. The purpose of modeling languages such as UML is to show the structure of code in order to better understand it. Widespread use of UML started in 1997 when it was adopted as a “standard”. UML is used with object oriented programming and is separated into two different categories (Structural and Behavioral Diagrams). Structural Diagrams show static aspects of code while Behavior diagrams show the dynamic parts of code. 

Some concepts listed that are a big part of UML are Class, objects, inheritance, abstraction, encapsulation, and polymorphism; all of these are directly related to object oriented programming. A few types of structural uml diagrams are class diagrams which show static structure, composite diagrams which show internal code structure and show how the code being analyzed acts when it comes to the rest of the program, an object diagram shows what instances are in code and their relations/associations, component diagrams show the organization of a systems physical components. Some Behavior diagrams from uml are state machine diagrams which represent the “state” of the system, Activity diagrams show a systems control, sequence diagrams show interactions between the objects. 

I chose this article as we have worked on UML diagrams in class and this article is structured well and tells the readers what exactly UML is without overloading them with information. Readers are presented with what UML is and different ways it is used to show many different things involved in object oriented programming. The site which the article is on also has multiple other articles which show readers more complex aspects of UML so if they want to dive deeper into the subject they are free and able to do so without having to look for another website for the desired information. 

I liked this article because of its simple format and feel that it helped me when working on assignments regarding uml even though we mainly went over class diagrams knowing the other types of diagrams and what they are used for was interesting and even helpful to me in understanding the significance of class diagrams. Each diagram in UML has a “specialty” you could say as each different diagram type maps out something different and even with class diagrams being rather simple they can help you understand the benefits that UML provides for software based fields.

https://www.geeksforgeeks.org/unified-modeling-language-uml-introduction/?ref=lbp

From the blog CS@Worcester – Dylan Brown Computer Science by dylanbrowncs and used with permission of the author. All other rights reserved by the author.

Docker, and why it is so important

Docker is a relatively new way of software delivery. With Docker, all that is needed is the image for the dependencies and software needed, and Docker does the rest. This is huge as before you would need to download and install specific versions of software on each and every computer you wanted to work on, but with Docker, you say you want X, Y, and Z and Docker does the rest for you, making life much easier.

The way Docker does this is through what are called “Containers”. Containers allow developers to package an application with everything that it needs, like dependencies and libraries, and then ship it out as one package. This is where the magic happens, as it means that the application will run on any other machine regardless of any customized settings that machine may have that might differ from the main machine that is being used for writing and testing the application. Docker is, in a way, like a virtual machine in this sense, but instead of running an entire virtual operating system, Docker allows applications to run the same kernel as the system they are running on, and only needs applications to be shipped with things not already on the host computer, instead of having to send out everything. This translates to a big performance increase in the speed of the application and reduces the overall size of the application as well.

Docker is also open source, one of the most important things, in my opinion, software can be these days. This means that anyone can contribute to Docker and modify it to their own needs if they need something Docker does not provide by default. This also means that since anyone can modify it, they can also see the inner workings and ensure that nothing is going on that’s not supposed to, like recording private information to sell to advertisers, for example. Docker makes life easy for developers, allowing them to not have to worry about the system that their program will be running on. Docker also gives flexibility in it’s containers and can reduce the number of systems needed for the program to run.

Source

I choose the above article because it gave a good look into what Docker is and how it is useful for software development in today’s world. It explained the key aspects of Docker and what they are useful for compared to past methods. In addition, the article gave a good analogy to Docker by comparing transporting cargo prior to the standardization of using shipping containers to make transporting good easier, as that roughly translates to what Docker does with their containers.

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

API Creation, Why Simple is Better

Whenever you interact with a program it is usually done through an API. Every website you visit, most programs you use, even your own operating system uses APIs to communicate with application. APIs are very prominent in modern computing and are essential to establishing the connection between programs and users alike.

Seeing as every programmer will interact with an API at some point or another, it is important to understand their place and how to create a good API should you need to do so. It is important to realize that characteristics such as being easy to work with, complete, and concise must be met when creating an API. Doing so can result in many gains not just in the finished product, but in other aspects of coding projects. Keshav Vasudevan put it, good API design can lead to “improved developer experience, faster documentation, and higher adoption for your API.

As the author puts it, an API must be extremely simple to use while achieving its goals. To that end Vasudevan has outlined key aspects of API design that one should take into account when creating an API. Much of it comes down to proper organization and the use of consistency to avoid confusion while utilizing the API. Small changes such as keeping URLs short and simple along with setting up resource functionality with HTTP methods can make the process much easier. Methods such as GET, POST, PUT, PATCH, AND DELETE are commonly used in these APIs along with many other methods commonly used in HTTP.

Along with proper organization while building the API, it is just as important to ensure that it is not indecipherable by others. A problem that often occurs with developers and product owners is that the developers might the meaning of a feature and implement incorrect functionality. Developers should check that all GET commands needed are implemented and have an example where one can expect a specific output on a successful run. It is important to give and receive feedback for the developers due to the disconnect that can occur between the target audience of a program and the developers creating it.

An example of the GET response as follows:

responses:
200:
description: Successfully returned information about users
schema:
type: array
items:
type: object
properties:
username:
type: “string”
example: “kesh92”
created_time:
type: “dateTime”
example: “2010-01-12T05:23:19+0000”

Once all this is done, it is important to remember that complexity should be handled ‘elegantly’ as Vasudevan puts it. This entails that there are likely large amounts of different data and information that must be accessed. A lot of these are common and it makes no sense from an efficiency standpoint to create a resource for each piece of data, therefore it is important to keep the ability of resources broad. You should keep the retrieval process simple, down to a query and parameters when searching or using a resource. Overall the API must be as user friendly as possible to ensure that it works well with future users who don’t know the API like you.

Bibliography

Vasudevan, Keshav. “Best Practices in API Design.” SmartBear.com, https://swagger.io/blog/api-design/api-design-best-practices/.

https://swagger.io/blog/api-design/api-design-best-practices/

From the blog CS@Worcester – George Chyoghly CS-343 by gchyoghly and used with permission of the author. All other rights reserved by the author.

K8 Crash Course

Blog Discovery

As a newcomer to the software industry, Kubernetes was foreign to me. This is also an article on the K8s, so please indulge me.

Applications: developers who provide a predefined service to stakeholders, Docker is a well-known runtime environment for building and building applications in containers. Creating a sample Go app; let’s create a basic Go app that we’ll use to deploy to our minikube cluster.

Kubernetes: The Kubernetes Engineering Manager is an open source container management and deployment platform. It orchestrates the clusters of virtual machines and schedules the containers to run on those virtual machines based on their available compute resources and the resource requirements of the container.

What are Pods?

A Kubernetes pod is a group of one or more containers, linked together for the purpose of Nodes and clusters: workstation that provides resources to developers a node can be thought of as the workstation that provides these resources and Kubernetes, the manager that allocates these positions to employees. In Kubernetes, a node is a working computer that can be virtual or physical. A node can have many pods, and Kubernetes automatically manages the scheduling of pods among the nodes in the cluster.

Deployment: the team’s objectives and structure defined at the start of the year a deployment provides declarative updates for Pods and ReplicaSets. In a deployment, we set a desired state and the deployment controller gradually converts the current state to the desired state. Take a look at the deployment file below deployment. The above deployment file is like a declarative template for Pods and Replicas.

The above deployment named myapp in {metadata.name}, creates a replica set to display two pods of myapp.

What are ReplicaSets?

Creating a K8s deployment kubectl apply -f deploy. Kubernetes Services: The SPOC team that routes relevant external communications to developer pods are ephemeral resources. In Kubernetes, a service is an abstraction that defines a logical set of pods and a policy for accessing them. Kubernetes services provide addresses through which associated pods can be accessed. Create a Kubernetes service kubectl apply -f service. The minikube tunnel command can be used to expose LoadBalancer services. The Minikube tunnel runs as a process on the host and creates a network route to the cluster CIDR service using the cluster IP address as a gateway. You can now use this IP address to open the service in the browser. The section on services is incomplete without an analogy with the life of developers. Imagine an external team uncertain or confused about the use of a feature developed by the development team. With that, we come to the end of the article on K8s and the Adventures of the Freshest Day One.

https://betterprogramming.pub/relating-with-docker-and-kubernetes-as-developers-an-analogue-5e662b1f817b

From the blog CS@Worcester – The Dive by gonzalezwsu22 and used with permission of the author. All other rights reserved by the author.