Category Archives: CS-343

CS343 Blog Post for Week of November 13

This week I wanted to write a post about the last SOLID design principle, Dependency Inversion. This principle deals with the relationship between interfaces that operate at a high system level and low system level interfaces.

Composed of two parts, the Dependency Inversion Principle as stated by Robert C. Martin is:

  1. High-level modules should not depend on low-level modules. Both should depend on abstractions.
  2. Abstractions should not depend on details. Details should depend on abstractions.

While the name “Dependency Inversion” might imply inverting the dependency relationship between modules, applying this principle actually involves building both high-level and low-level modules from the same abstraction. Constructing your code to abide by the previous SOLID principles, particularly the Open/Closed Principle and the Liskov Substitution Principle, should implicitly also result in code that abides by the Dependency Inversion Principle. The Open/Closed Principle states that a software module should be open for extension, but closed for modification, and the Liskov Substitution Principle states that an interface should be able to be replaced by a separate implementation of the same parent interface without compromising the functioning of the software.

The author includes another coffee machine themed example, detailing how to apply the SOLID design principles to two separate classes of coffee machine. Starting with two classes, BasicCoffeeMachine and PremiumCoffeeMachine. The classes are very similar, with the only differences being an extra class variable representing a coffee bean grinder and a method to brew espresso for the PremiumCoffeeMachine class. The author describes their process for defining suitable abstractions for a piece of software representing coffee machines, including their decision to have the methods for brewing filter coffee and espresso split into two interfaces. A potential coffee machine class representing a machine with the capability to brew either filter or ground coffee can easily be built by implementing both of these interfaces and overriding the methods within the concrete classes.

Refactoring the code this way enables independence between interfaces and implementations and makes expanding on the code base easier and safer. With fewer dependencies between modules, the effects of any changes to existing code won’t ripple out to other parts of your software.

I wanted to review this principle specifically because I wanted to refactor the interfaces from some old projects of mine. I wrote some Java classes meant to represent characters in a fantasy role-playing game, complete with character levels and statistics. As I left it though, the code is only capable of creating characters meant for the user, and not any non-playable characters or any other sort of entities. I want to go back and redesign my code so that I have fewer methods that only function with specific classes, and more functionality to create and edit characters. I remember I had a lot of trouble trying to increment a character’s level by 1 and increasing their stats accordingly, and I get the feeling that refactoring my code with the SOLID principles in mind will help me get it to a place I am happier with.

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

BLOG #3

Hello everyone, my name is Abdullah Farouk, and this is my third blog so far this semester (hoping I can get to 6 before the semester ends). I am going to be talking about comments in this blog because I saw this interesting article about it, and I just wanted to learn more and be better educated on the topic. When I started out with coding, I always ignored typing comments in my code because I didn’t really get the point of it other than wasting my time. But as things got more advanced, and I kept getting errors in my code and I knew what the error was, but I just didn’t know where the methods were in my code and what their function was. That’s when I started thinking about comments, I told myself comments would been helpful here instead of reading every line of the method to see what it does. In the article that I tagged down below, the author explains the importance of software technical documentation and how it should be used, with some examples to show you.

I have learned a lot about software technical documentation from this article including what are some examples of unnecessary comments. You don’t need to write an English translation of your software code; you just need a high-level overview of your method or an explanation to a complex logic. Back when I started with coding, I used to comment out some of my code that I didn’t need anymore, and I just kept it there, but I learned quickly that it wasn’t good because it just makes my code look messy. Don’t put comments like “fix this bug” but instead put something more useful like what needs to be fixed. I also learned that there is a lot of redundant and excessive comments. For example, you don’t need to write a comment explaining what i++ does because that is unnecessary as the code is self-explanatory.  Add comments that add value to your code, not make it useless and just clutter the code.

Some people say that a good code should not need comments to explain it, but I just disagree because I like reading information about the method before I start reading each line of it. If you don’t like to put comments on your code, then at least make a schema for your code so others can understand the relationship between codes better. The author shows plenty of example diagrams that show you what a code schema looks like.

Reference article : https://medium.com/@VincentOliveira/how-to-write-good-software-technical-documentation-41880a0e7814

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

Cloud Infrastructures – GitPod vs. Coder

Integrative softwares and tools like Dev Containers and GitPod can be invaluable for development teams/tasks, commonly used for its benefits in ensuring portability and uniformity in team based development environments – amongst others. However setting these tools up to be ready to begin working can be time consuming; furthermore, development projects often require running several hardware-intensive applications simultaneously which can cause delays due to hardware constraints and inconsistencies across teammates. These factors can quickly eat into time allocated for team/project work and create a weak link in a team if one (or more) teammates are falling behind trying to get set up. 

Recently, this is something that I’ve experienced and observed frequently in class as we incorporate more toolkits and work on more intensive projects. With Dr. Wurst’s suggestion of implementing GitPod as a way of addressing these difficulties, I decided to do some reading into what GitPod is and other solutions. 

Coder is another cloud-based developer environment which is an alternative to GitPod with some key differences. In Coder vs. GitPod: Which is Better for Your Team? Computer Science professionals Ben Potter and Mark Milligan consider the pros and cons of both with a focus on helping readers choose the best fit for their development teams. GitPod targets individuals and small teams with SaaS offerings focusing on an easy start and integration with several IDEs and containers, making it a great fit for web application development. Plus, with their current offering of 50 hours free monthly (and modestly affordable packages if this isn’t enough) there’s minimal price barrier.

On the other hand, Coder is oriented towards large-scale teams and organizations/enterprises, offering a self-hosted solution for on-premises or public cloud deployment. It prioritizes security and flexibility, allowing workspaces to be operated on a variety of infrastructures like Docker and other VMs. Being business-focused, Coder also provides several enterprise related features like single-sign-on, audit logs, usage metrics and more while supporting several IDE’s and containers, VM’s, etc.

It’s important to keep in mind that the original post was hosted on the Coder blog medium and may be biased as such, though the authors seem to try to take a fair stance and highlight the cases where GitPod would likely be more applicable than Coder. This comparison helped me get a better understanding of some of the capabilities and advantages of tools like GitPod/Coder. Plus, learning about Coder as an alternative to GitPod focused on large-scale enterprises that may be geographically spread out is awesome as an individual who intends on entering the CS field after graduating this coming Spring. 

Check out more on Coder here: https://coder.com/why

Resources:
1. https://coder.com/blog/coder-or-gitpod-which-is-better-for-your-team

From the blog CS@Worcester – Tech. Worth Talking About by jelbirt and used with permission of the author. All other rights reserved by the author.

Blog Post Title: Exploring the World of REST APIs: A Journey Through Modern Web Development


In the realm of computer science and web development, understanding the intricacies of Application Programming Interfaces (APIs) is indispensable. My recent exploration into this subject led me to an enlightening IBM article about REST APIs, a cornerstone of modern web services and architecture. This article, fittingly titled “What is a REST API?” (IBM Article Link), delves into the principles and practices of RESTful APIs, offering a comprehensive overview that resonates deeply with our course material.

Selecting this resource was a no-brainer for me. The blend of theoretical concepts and practical applications it offers aligns perfectly with our current coursework on web development and API integration. The article’s clear delineation of REST API characteristics, alongside examples of their use in microservices architecture, provided a solid foundation for understanding their role in contemporary web development.

The six foundational principles of REST APIs, as elucidated in the article, were particularly enlightening. They include uniform interface, client-server decoupling, statelessness, cacheability, layered system architecture, and code on demand. Each principle contributes to the overall functionality and efficiency of web services, emphasizing the importance of a well-structured API.

What struck me most was the concept of statelessness in REST APIs. The idea that each request from a client to a server must contain all the information needed for the server to respond, without relying on any stored context, highlighted the need for efficient data management and transfer in web applications. This insight has reshaped my understanding of client-server interactions and will undoubtedly influence my future projects.

Furthermore, the article’s discussion on the importance of security in REST APIs, such as using OAuth 2.0 for authorization and HTTPS for secure data transmission, was particularly relevant. It underscored the critical nature of protecting data and maintaining user privacy, aspects I intend to prioritize in my future work.

In summary, this IBM article not only broadened my knowledge of REST APIs but also reinforced the importance of secure, efficient web development practices. The principles of RESTful design will be an integral part of my toolkit as I progress in my computer science career. I strongly recommend this resource to my peers for its clarity, depth, and relevance to our course.

As I continue my journey in computer science at Worcester, I am excited to apply these concepts in practical scenarios, especially in web development projects. This article has been a stepping stone in my understanding of how web technologies work in harmony to create seamless user experiences and secure, efficient web services.

Citation: “What is a REST API?” IBM. https://www.ibm.com/topics/rest-apis

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

CS343 – Week 9

Front-end development is focused on the user experience with the site. They design the elements of the application that the user interacts with and ensures that the interface is fast and easy to use. As technology continues to grow with different devices with varying screen sizes, a challenge that has arisen for front-end development is the accommodation for the different screen sizes that want to access the same site or application. There are different programming languages for front-end development, including HTML, CSS, and JavaScript. HTML (HyperText Markup Language) allows browsers to display text or load elements, rendering webpages for users. CSS (Cascading Style Sheets) is the standard language to identify how HTML content will be displayed, such as fonts, foreground and background colors. JavaScript (JS) extends the functionality of websites beyond HTML and CSS. This gives websites the ability to refresh themselves dynamically and respond to user actions without page reloads. You can also model UI components like pop-ups and interactive sliders.

While the front-end interface draws a lot of attention to the general audience due to the visual interaction with it, the back-end forms the backbone of any online program. It includes the logic, data storage, and security features required to create a fully functional and reliable application. It is also responsible for processing client requests, interacting with databases, and generating responses to be delivered back to the client. There are several different responses that can be generated depending on the quality of the request. Examples of some responses include 200, 201, 400, 404, and 500. 200 OK indicates the request was successful and returns the requested data. 201 Created indicates another successful request but creates a new resource rather than displaying an existing one. 400 Bad Request indicates the server could not understand the request due to malformed syntax. 404 Not Found is a different type of client error response which indicates the requested resource could not be found. 500 Internal Server Error indicates the server encountered an unexpected condition which prevented a successful request.

The use of databases is important when it comes to designing the back end for several reasons. Data persistence is a positive outcome from databases and ensures that information is not lost when an application is closed or is restarting. It also allows for better data management and efficient mechanisms for inserting, updating, deleting, and retrieving information. Concurrency control is allowed through the use of databases, meaning multiple users or applications can access and modify data simultaneously.

Front-End Development: The Complete Guide (cloudinary.com)

Back-End Web Architecture | AppMaster

From the blog CS@Worcester – Jason Lee Computer Science Blog by jlee3811 and used with permission of the author. All other rights reserved by the author.

The DRY Principle

One of many important programming principles is what is called ‘Don’t Repeat Yourself’ or ‘DRY’.

The DRY principle focuses on reducing the number of unnecessary repetitions in code. This goal can be achieved through multiple methods detailed in Tahmeed Tarek’s article Understanding the DRY Principle — the three most common being:

  1. Abstraction
  2. Automation
  3. Normalization

Abstraction is often used in Object-Oriented Programming. The strategy is to create a super-class containing the necessary attributes and methods which each class can then inherit. This reduces the number of times common attributes and methods have to be defined.

Automation focuses on communication within the team and between teams working on a project. Cross-functionality between team members and different teams is vital as it gives everyone an opportunity to discuss mutual problems and thereby capable of formulating a mutual solution.

Normalization is often used in designing databases to prevent the occurrence of redundant data. It works by “extracting duplicates into a separate entity” (Tarek), ensuring that the data is consistent and properly distributed so the data’s integrity is maintained at a single source and the database is flexible and scalable.

In addition to the three methods, there are some important things to keep in mind to practice the DRY principle.

The first is to design code that is easy to reuse. This includes elements of clean code such as abstraction and documentation. Code that is simple and easy to read and understand is also easier to reuse. Sometimes, however, this process can be long and tedious, which bring up the next point to keep in mind.

The second is that shortcuts make for long delays. While they may save time in the present, shortcuts introduce what is called ‘technical debt’ which causes problems later in the future. Failing to discover and resolve technical debt early on can be a costly mistake for a project.

The third is to focus on active communication and project awareness. I have personal experience with this point relating to my research project. While still a learning intern, I found myself focusing in on the singular task assigned to me and failing to see the project in its wider scope. This became a problem because I did not think to write my code in a reusable manner for later steps in the project, creating areas of unnecessary redundancy that led to an accumulation of technical debt.

While not a seriously costly mistake — thanks to my advisor — I still had to go back and redesign my code to remove the redundancies. From then on, I learned to apply the DRY principle to my code to prevent the same scenario from happening again.

As I learned from my personal experience, the DRY method is an important principle that guides programmers to develop code that reusable and scalable, making life a lot easier.

Source: https://www.plutora.com/blog/understanding-the-dry-dont-repeat-yourself-principle

From the blog Stories by Namson Nguyen on Medium by Namson Nguyen and used with permission of the author. All other rights reserved by the author.

Open Source Software in Education

     In recent times I have started a job as a computer teacher for a private school, and as such I have had to become familiar with a variety of educational software. As an educator, it is important for there to be a plethora of accessible software to teach children digital literacy, as computers have become increasingly incorporated into more facets of modern society Open-source software is one avenue that allows young students access to important tools to learn and create, without incurring a hefty price tag for their school. This is especially true for those learning how to code since it is not exactly a subject that comes naturally to everyone. While there are certainly many free IDEs out there for any aspiring adult programmer to use, I am more concerned with young children who may not be able to understand all the complex operations of standard IDEs. The best answer I have found is the educational coding software Scratch, created by MIT. Licensed under the “Creative Commons Share Alike” license, Scratch provides a drag and drop block-based coding environment that is easily understood and accessible to children. This allows teachers to easily demonstrate basic coding concepts like if-then-else statements and assigning variables. There’s even Scratch jr., available on tablets, that has an even more simplistic UI designed for even younger audiences. MIT has also released App Inventor, a free open-source software for creating mobile applications. These coding applications highlight the ability of open-source software to easily adapt to changes in social needs. But educational software does not just encompass programming and mobile apps, it also extends to various tools needed for academic success. Software such as ONLYOFFICE and LibreOffice, which provides a free alternative to Microsoft Office, is appreciated by students who cannot afford the more popular and expensive version. Not only are these applications useful within the U.S. education system, but another benefit they provide is their international reach. Since they are online and free for anyone to download and copy, they can be distributed to anyone globally with an internet connection. This opens new avenues for providing education to those in need. Education is a sector in need of accessible tools so that we can better teach the next generation and expand access to reliable education within our own borders and beyond. Not only that, but in this modern time where the importance of digital literacy is at an all-time high, we need to start laying the groundwork for future developers. 

https://scratch.mit.edu/faq

https://elearningindustry.com/open-source-tools-to-boost-digital-learning

From the blog CS@Worcester Alejandro Professional Blog by amontesdeoca and used with permission of the author. All other rights reserved by the author.

Open Source Software in Education

     In recent times I have started a job as a computer teacher for a private school, and as such I have had to become familiar with a variety of educational software. As an educator, it is important for there to be a plethora of accessible software to teach children digital literacy, as computers have become increasingly incorporated into more facets of modern society Open-source software is one avenue that allows young students access to important tools to learn and create, without incurring a hefty price tag for their school. This is especially true for those learning how to code since it is not exactly a subject that comes naturally to everyone. While there are certainly many free IDEs out there for any aspiring adult programmer to use, I am more concerned with young children who may not be able to understand all the complex operations of standard IDEs. The best answer I have found is the educational coding software Scratch, created by MIT. Licensed under the “Creative Commons Share Alike” license, Scratch provides a drag and drop block-based coding environment that is easily understood and accessible to children. This allows teachers to easily demonstrate basic coding concepts like if-then-else statements and assigning variables. There’s even Scratch jr., available on tablets, that has an even more simplistic UI designed for even younger audiences. MIT has also released App Inventor, a free open-source software for creating mobile applications. These coding applications highlight the ability of open-source software to easily adapt to changes in social needs. But educational software does not just encompass programming and mobile apps, it also extends to various tools needed for academic success. Software such as ONLYOFFICE and LibreOffice, which provides a free alternative to Microsoft Office, is appreciated by students who cannot afford the more popular and expensive version. Not only are these applications useful within the U.S. education system, but another benefit they provide is their international reach. Since they are online and free for anyone to download and copy, they can be distributed to anyone globally with an internet connection. This opens new avenues for providing education to those in need. Education is a sector in need of accessible tools so that we can better teach the next generation and expand access to reliable education within our own borders and beyond. Not only that, but in this modern time where the importance of digital literacy is at an all-time high, we need to start laying the groundwork for future developers. 

https://scratch.mit.edu/faq

https://elearningindustry.com/open-source-tools-to-boost-digital-learning

From the blog CS@Worcester Alejandro Professional Blog by amontesdeoca and used with permission of the author. All other rights reserved by the author.

Open Source Software in Education

     In recent times I have started a job as a computer teacher for a private school, and as such I have had to become familiar with a variety of educational software. As an educator, it is important for there to be a plethora of accessible software to teach children digital literacy, as computers have become increasingly incorporated into more facets of modern society Open-source software is one avenue that allows young students access to important tools to learn and create, without incurring a hefty price tag for their school. This is especially true for those learning how to code since it is not exactly a subject that comes naturally to everyone. While there are certainly many free IDEs out there for any aspiring adult programmer to use, I am more concerned with young children who may not be able to understand all the complex operations of standard IDEs. The best answer I have found is the educational coding software Scratch, created by MIT. Licensed under the “Creative Commons Share Alike” license, Scratch provides a drag and drop block-based coding environment that is easily understood and accessible to children. This allows teachers to easily demonstrate basic coding concepts like if-then-else statements and assigning variables. There’s even Scratch jr., available on tablets, that has an even more simplistic UI designed for even younger audiences. MIT has also released App Inventor, a free open-source software for creating mobile applications. These coding applications highlight the ability of open-source software to easily adapt to changes in social needs. But educational software does not just encompass programming and mobile apps, it also extends to various tools needed for academic success. Software such as ONLYOFFICE and LibreOffice, which provides a free alternative to Microsoft Office, is appreciated by students who cannot afford the more popular and expensive version. Not only are these applications useful within the U.S. education system, but another benefit they provide is their international reach. Since they are online and free for anyone to download and copy, they can be distributed to anyone globally with an internet connection. This opens new avenues for providing education to those in need. Education is a sector in need of accessible tools so that we can better teach the next generation and expand access to reliable education within our own borders and beyond. Not only that, but in this modern time where the importance of digital literacy is at an all-time high, we need to start laying the groundwork for future developers. 

https://scratch.mit.edu/faq

https://elearningindustry.com/open-source-tools-to-boost-digital-learning

From the blog CS@Worcester Alejandro Professional Blog by amontesdeoca and used with permission of the author. All other rights reserved by the author.

Open Source Software in Education

     In recent times I have started a job as a computer teacher for a private school, and as such I have had to become familiar with a variety of educational software. As an educator, it is important for there to be a plethora of accessible software to teach children digital literacy, as computers have become increasingly incorporated into more facets of modern society Open-source software is one avenue that allows young students access to important tools to learn and create, without incurring a hefty price tag for their school. This is especially true for those learning how to code since it is not exactly a subject that comes naturally to everyone. While there are certainly many free IDEs out there for any aspiring adult programmer to use, I am more concerned with young children who may not be able to understand all the complex operations of standard IDEs. The best answer I have found is the educational coding software Scratch, created by MIT. Licensed under the “Creative Commons Share Alike” license, Scratch provides a drag and drop block-based coding environment that is easily understood and accessible to children. This allows teachers to easily demonstrate basic coding concepts like if-then-else statements and assigning variables. There’s even Scratch jr., available on tablets, that has an even more simplistic UI designed for even younger audiences. MIT has also released App Inventor, a free open-source software for creating mobile applications. These coding applications highlight the ability of open-source software to easily adapt to changes in social needs. But educational software does not just encompass programming and mobile apps, it also extends to various tools needed for academic success. Software such as ONLYOFFICE and LibreOffice, which provides a free alternative to Microsoft Office, is appreciated by students who cannot afford the more popular and expensive version. Not only are these applications useful within the U.S. education system, but another benefit they provide is their international reach. Since they are online and free for anyone to download and copy, they can be distributed to anyone globally with an internet connection. This opens new avenues for providing education to those in need. Education is a sector in need of accessible tools so that we can better teach the next generation and expand access to reliable education within our own borders and beyond. Not only that, but in this modern time where the importance of digital literacy is at an all-time high, we need to start laying the groundwork for future developers. 

https://scratch.mit.edu/faq

https://elearningindustry.com/open-source-tools-to-boost-digital-learning

From the blog CS@Worcester Alejandro Professional Blog by amontesdeoca and used with permission of the author. All other rights reserved by the author.