Category Archives: CS-343

Week 11 Blog Post

The article I read this week was called “The Art of Writing Amazing REST APIs” by Joy Ebertz. In this article, Joy explores the principles for designing effective REST APIs. It discusses key practices such as naming conventions, including IDs and types, ensuring resource stability, and bridging gaps between current and ideal API states. I’m going to get into some interesting points or ideas she has, and talk a little bit more about them. To wrap it up, I will explain how I think it could be beneficial to take, or at least consider, the principles she describes and apply them to a project down the road.

The first thing she talks about, which I believe is one of the more important things she brings up as well, is consistency. It is the foundation to writing great REST APIs. Consistency can be, and should be, applied to every aspect of writing REST APIs as, when everything is consistent, confusion will be kept to a minimum which should be what everyone is aiming for. If one endpoint returns user_ID while another returns simply ID, you can see where confusion could occur. Thus, standardizing these things can make everything much more efficient.

Another point she mentions is that every resource should include a unique ID and Type field to ensure clarity/stability. Unique IDs prevent ambiguity, enabling resources to be fetched or referenced consistently and effectively. Including a type prepares APIs for future flexibility, such as supporting multiple resource types in a single response.

Joy talks about many different principles and ideas to writing REST APIs but the previously mentioned principles were a couple of the more important ones I believe, as well as just my favorite ones in general.

Career-wise, I think applying these principles would be very smart to do. Shooting for an extremely consistent REST API benefits everyone involved with it, and using unique IDs and Type fields only produces further benefits. Applying all the principles she mentions in the article would certainly be the best way, or likely one of the best ways, to write REST API, but obviously different people may find different things they like better so there may always be some differences in opinion over writing a good REST API. If anything, you should at least take from the article the principles she presents and try to apply them, in one way or another, to future writing as it would really only advance your skill on the matter regardless. This is certainly something I will try to apply given the opportunity.

https://jkebertz.medium.com/the-art-of-writing-amazing-rest-apis-dc4c4100478d

From the blog CS@Worcester – RBradleyBlog by Ryan Bradley and used with permission of the author. All other rights reserved by the author.

Time to REST

In the past few weeks, we’ve been learning and working with REST and how it ties into the larger picture of software architecture. I found this section confusing at times but mainly interesting thanks to the connection to personal experience. Once I realized that this is essentially the behind-the-scenes of those HTTP errors I’ve seen all my life, I was excited to learn more. 

Web services that adhere to REST are called RESTful APIs or REST APIs for short. REST API is a UI (uniform interface) “that is used to make data, content, algorithms, media, and other digital resources available through web URLs” (Postman). They are defined by three main aspects: a base url, a media type for any data to be sent to the server, and standard HTTP methods. There are four HTTP methods that are generally used in REST APIs:

  • GET: This method allows for the server to find the data you requested and sends it back to you.
  • PUT: If you perform the ‘PUT’ request, then the server will update an entry in the database.
  • POST: This method permits the server to create a new entry in the database.
  • DELETE: This method allows the server to delete an entry in the database.

These methods will have different effects depending on whether it is used to address a collection or an element (Postman). 

The part of REST that I found most interesting and that I’ve seen before were the HTTP response codes. In the case that one tries to go to a website and all they are met with is a white screen with black text stating “404: Error” followed by some details, that is a response code. Response codes will slightly differ depending on the HTTP methods used but most common ones include: 

  • 200 OK
  • 404 Not Found
  • 400 Bad Request
  • 500 Internal Server Error

I found this topic to be pretty interesting and honestly necessary in the case that one works with the web. Knowing the internet and my luck, I’m sure to encounter many of these errors for the foreseeable future and it’ll serve as a reminder to what I’ve learned about REST.

Side Note: Just the other day, when I was trying to log into Blackboard, I was met with a 404 error. I thought I could just reload the page or open a new tab and get into Blackboard but I was still getting the error. It took about five minutes before I could actually log in. I realized that knowing the details of these HTTP responses doesn’t make them any less annoying.

Source: https://blog.postman.com/rest-api-examples/

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

A Reflection on Brygar’s Principles and OOD

Brygar’s principle of Simplicity resonates with Abstraction, as both focus on reducing complexity and emphasizing essential features. For example, an abstract Shape class might define a method draw(), but the specific implementation (how a circle or square is drawn) is handled in the subclasses Circle and Square. This simplifies the user interface by exposing only the necessary functionality.

Consistency aligns with Encapsulation, which involves bundling data and the methods that operate on it into a single unit and controlling access to the object’s internal state. For example, a Student class might have private fields like name and age. These fields are accessed or modified only through controlled public methods like getName() or setName(), ensuring that the class remains consistent in its behavior.

Modularity is closely related to Polymorphism, which enables objects of different classes to be treated as objects of a common superclass. By treating different objects as instances of the same class or interface, we can add new types without modifying existing code. For example, the Shape interface could allow the addition of new shapes (like Rectangle or Triangle) without altering the code for existing shapes.

Finally, Reusability directly connects with Inheritance, as inheritance allows one class to inherit properties and behaviors from another, making it easier to reuse and extend code. For instance, a Bird class could serve as a parent for Parrot and Eagle classes, where the child classes inherit common attributes like wingspan and methods like fly().

This blog post helped me understand how these design principles connect to each other. The assignment’s focus on defining the OOD principles and understanding their importance has deepened my appreciation for Abstraction and Encapsulation as tools for simplifying and protecting code. I now feel more confident in applying these principles to make my software designs both flexible and maintainable.

This blog post made me understand how it all connects. I now have a clearer understanding of how to approach system design in a more structured and efficient way. By focusing on Reusability and Simplicity, I’ll be able to write code that is easier to maintain and scale over time.

Link to the Resource:
Four Design Principles by Ivan Brygar

From the blog SoftwareDiary by Oanh Nguyen and used with permission of the author. All other rights reserved by the author.

Intel’s 13th and 14th gen issue

CS-343, CS@Worcester

This November 17th recap in the tech world details Intel’s major crisis this year. It affected the company’s reputation and its consumers. Let me explain further Intel 13th and 14th gen consumer CPUs were degrading rapidly. Even though this issue was not really known for a while since November 2022. First let us break down their response to the issue. Then we will go further on what Intel did to fix this issue.

To clarify Intel’s 13th and 14 gen CPUs were degrading as a result of microcoding issues. At that time, many odms and motherboard manufacturers provided custom bios options. These options would send a lot of volts to the CPUs. The issue is that due to Intel’s microcode issues it can not handle these high volts from the motherboards. That certain CPUs cores would get too much electricity that it would cause those cores to degrade. As a result, this caused the CPUs to become more unstable and lose performance over time. 

Under those circumstances Intel had to respond to these issues horribly. Intel did not want to be blamed for this issue because obviously this would affect the company’s sales and reputation. So they would push the blame onto other companies like motherboard manufacturers. Once the motherboard companies tried to help users with these issues were still happening. Many customers would try to move their responsibilities multiple times that angered consumers and motherboard companies. As a result, consumers went to Intel for their CPU issues. Eventually, Intel ran out of new CPUs for all these repairs. To be honest, Intel did a lot more underhanded ways to get out of their responsibility in this issue.

Lastly Intel’s solution to their 13th and 14th gen issue. To solve this issue, Intel would send out a microcode update. They did this after multiple bios updates to fix users’ instability issues. Intel set microcode for specific bios, which they called ultra, for their 15th gen CPUs. This was intended for motherboard manufacturers to use. They did this so that motherboard manufacturers do not make the CPUs take high volts to compete with each other. On the other hand, ODMs can slightly exceed these restrictions. This is because they are selling Intel CPUs in their laptops or desktops. There are 2 amazing content creators who explore this topic in more depth. Their names are Jayz2cents and Gamers Nexus. They explain everything from the timeline of all these events. They also describe the reasons why Intel took the actions they did in all these events. 

Sources used for this blog

Jayz2cents, Intel’s weapon against motherboard companies… will it work?, published on October 15, 2024, Youtube, accessed on November 17th, 2024

Gamers Nexus, Scumbag Intel: Shady Practices, Terrible Responses,& Failure to Act, published on August 12th, 2024, Youtube, accessed on November 17th, 2024

From the blog CS@Worcester – Site Title by Ben Santos and used with permission of the author. All other rights reserved by the author.

Design Smells – Decreasing Poor Design

While writing software it is important to know, how to maintain clean and understandable code. Despite best efforts, developers can unintentionally introduce code design smells precise indicators of deeper design problems. While these smells don’t directly cause bugs, they reduce code readability, maintainability, and scalability.

In class we learned the 6 common Design Smells, so I referenced the class materials and found an helpful article on Refactoring Guru. This webpage offers a practical explanation of common smells such as long methods, large classes, feature envy, and shotgun surgery.

Why I Selected This Resource

The reason why I chose this resource resonates with the principles we’ve covered in our class on software design and architecture. Its structured, accessible approach demystifies complex design issues, offering developers clear steps to refactor and improve their code. I’ve often seen myself facing challenges and struggling with tangled code where debugging or adding features feels almost somewhat overwhelming. These tools and insights help a and provide a roadmap for addressing such challenges systematically, and thoughtfully throughout the design process.

My Reflections on the Resource

The discussion on bloaters, like long methods and large classes, I think this was particularly something worth learning. These smells arise when a method or class tries to handle too much, violating the Single Responsibility Principle. I realized that in past projects, I’ve struggled with methods growing unmanageably large as features were added. Refactoring Guru suggests breaking these methods into smaller, more focused ones using techniques like extract method, improving both readability and reusability.

Another key takeaway was the concept of change preventers, such as shotgun surgery, where making a small change requires altering code in multiple places. This often signals that responsibilities are poorly distributed across the system. The resource recommends consolidating functionality into a single class or method, reducing the risk of errors and making future updates more straightforward.

Applications for Future Practices

Refactoring Guru’s emphasis on identifying smells early and refactoring incrementally aligns well with agile development practices. Moving forward, I plan to use this more than one of these materials as a checklist during code reviews to spot and address issues proactively. Techniques like extract method, extract class, and move method will hopefully become part of my tools for tackling coupled code. By continuing improving my skills to detect and refactor code smells, I want to create cleaner, more sustainable codebases that will be easier for both my team and future developers to work with. Thank you for reading my blog post and I hope you learned some

https://refactoring.guru/refactoring

https://refactoring.guru/refactoring/smells

From the blog CS@Worcester – function & form by Nathan Bui and used with permission of the author. All other rights reserved by the author.

The Secret To Maintainable and Scalable Software: SOLID Principles

Intro

Imagine inheriting a massive, poorly designed codebase. Every change you make breaks something else. For software developers, such nightmares can be avoided by adhering to the SOLID principles, a foundational guideline for creating maintainable, scalable systems. These principles are a must-know for any software developer seeking to improve the quality of their work. They provide a roadmap for developers to create cleaner, more maintainable codebases, which is why I was drawn to this resource

Blog Summary

The blog goes through each of the five principles, explaining what they are, why they are important, and giving a code examples utilizing each one.

1. Single Responsibility Principle (SRP): A class should have only one reason to change, ensuring focused and cohesive functionality. The blog illustrates SRP with an example of separating user management from content creation, showing how this approach simplifies debugging and enhances code clarity.

2. Open-Closed Principle (OCP): Software entities should be open for extension but closed for modification, promoting adaptability without risking existing functionality. For OCP, the blog demonstrates how using inheritance and interfaces allows developers to add new functionality, using Square and Rectangle classes inheriting from the Shape base class.

3. Liskov Substitution Principle (LSP): Subtypes must be substitutable for their base types without altering the correctness of the program. The example provided for LSP highlights how properly designed subclasses, such as an Eagle and a Penguin inheriting from a Bird class, ensure seamless substitution without breaking the program.

4. Interface Segregation Principle (ISP): Clients should not be forced to depend on interfaces they do not use, encouraging lean and specific interfaces. In discussing ISP, the blog uses an example of splitting a large interface into smaller, more specific ones, ensuring that classes only implement what they actually need.

5. Dependency Inversion Principle (DIP): High-level modules should not depend on low-level modules but instead rely on abstractions. For DIP, the blog explains how decoupling high-level modules from low-level details using abstraction layers, like interfaces, makes the codebase more flexible and easier to maintain.

Why I chose this resource

I selected this blog to write about because it breaks down each principle in a concise way, clearly explaining each one in a way that is easy to understand at all levels. It’s a great resource to quickly go back to when you need a refresher on any of the principles.

Reflection on SOLID

After learning about SOLID, I see that it might take an extra step of thinking to adhere to the principles at first, but I think it’s well worth it for the resulting code structure. The easy way to code is messily throwing together code that works without a second thought, but doing that is very dangerous for the longevity of a program. I believe that after following SOLID for a while it will become second nature and will become the natural way of coding, which is why I think it’s important to learn about SOLID early and consciously until it does become a subconscious practice. In one of my past projects, I struggled with messy code that implemented multiple responsibilities in one class. Debugging it was a nightmare, but had I known about the SRP principle it could have been avoided entirely. Reflecting on these principles has already influenced how I plan on approaching my code, and I’m eager to incorporate them into my future work.

Future Application

Given the importance of SOLID principles for large-scale software, I believe it’s essential to internalize and apply them in future projects to thrive in the software development space. By crafting modular classes and reducing dependency, I aim to create services and systems that are easy to maintain and adapt as requirements expand and evolve.

Citation

“Essential Software Design Principles You Should Know Before the Interview” By Arslan Ahmad

https://www.designgurus.io/blog/essential-software-design-principles-you-should-know-before-the-interview

From the blog CS@Worcester – The Science of Computation by Adam Jacher and used with permission of the author. All other rights reserved by the author.

Smelly and Debt

I recently read an article on Opsera titled What Is Code Smell? that explores the concept of code smells and how they relate to technical debt. The article explains that code smells are indicators of deeper issues in software design, like redundant code, overly complex functions, or lack of proper documentation. While these smells don’t necessarily cause bugs, they can make the code harder to maintain or extend in the future. Technical debt, on the other hand, refers to the trade-off between short-term efficiency and long-term code quality. It’s like borrowing from the future to meet deadlines now, but it eventually has to be repaid with interest—usually in the form of extra work to fix the issues caused by the shortcuts taken.

I chose this resource because it gives a practical explanation of two topics that I’ve encountered in my software engineering classes: design smells and technical debt. These are concepts that seemed theoretical at first, but this article helped me understand how they show up in real-world projects. As I start working on my own coding assignments, I can see how these issues might impact my projects if I don’t pay attention to them early on.

The article made me realize just how crucial it is to identify and address code smells early in the development process. For example, the article points out that long methods and duplicated code can be a sign of poor design that will slow down future changes. At first, I thought that refactoring or improving code design was something only necessary when a project was nearing completion. But now I understand that addressing these problems early can save a lot of time and effort in the long run.

What really stood out to me was the connection between technical debt and long-term project maintenance. As a student, it’s easy to think that as long as the code works, it’s good enough. But this article emphasized that taking shortcuts to meet deadlines may create technical debt that leads to problems later, such as bugs or a codebase that’s difficult to work with. I’ve already seen this in my own projects—trying to push through a solution quickly, only to realize later that the code is harder to manage than I expected.

In the future, I plan to pay more attention to clean code practices. I’ll aim to refactor code regularly and avoid taking shortcuts that might seem like a quick fix but could lead to bigger problems. This approach will not only improve my coding skills but also make my future projects more maintainable.

Resource:

What Is Code Smell? – Opsera Blog

From the blog Computer Science From a Basketball Fan by Brandon Njuguna and used with permission of the author. All other rights reserved by the author.

Understanding SOLID Principles: A Guide

As a student learning software design, I’ve heard about the SOLID principles in class, but I wanted to dive deeper to understand how to actually use them. I came across a blog post called “SOLID Principles — The Definitive Guide” by Midhun Vincent on Medium, which breaks down each of the five principles in a way that makes sense for someone new to object-oriented design. The guide was really helpful and lined up well with what we’re covering in my course, so I thought it would be a good opportunity to see how these principles could improve my coding now and in the future.

The article explains the SOLID principles, which are five important guidelines for creating object-oriented software that’s easier to understand, maintain, and extend. The first principle, the Single Responsibility Principle (SRP), says that each class should do only one thing, making it easier to maintain and modify. The Open/Closed Principle (OCP) suggests that classes should be open for extension but closed for modification, meaning you can add features without changing the original code. The Liskov Substitution Principle (LSP) ensures that subclasses can replace their parent class without breaking the system. The Interface Segregation Principle (ISP) advises creating small, specific interfaces rather than large, general ones. Finally, the Dependency Inversion Principle (DIP) suggests that high-level modules should depend on abstractions, not low-level modules, which makes the code more flexible. These principles help make code cleaner, more modular, and easier to adapt over time.

I picked this article because, while the SOLID principles are useful, they can seem pretty abstract at first. The post explains them in a way that feels practical, with examples that make it easier to apply the principles to real-world coding problems. Plus, the examples connected well with the projects I’ve worked on in my course, especially when it comes to organizing code and making it easier to debug. Seeing how these principles prevent code from becoming too messy gave me a new way of thinking about my own assignments.

My Takeaways and Reflection

Before reading this post, I knew the basic ideas behind SOLID, but I wasn’t sure how to apply them in my own code. Now, I get why each principle is important and how they can save time by reducing debugging and refactoring. For example, the Single Responsibility Principle made me realize that I often give classes too many responsibilities, which complicates fixing bugs. By applying SRP, I can keep things simpler and reduce errors.

Looking ahead, I plan to use these principles in my projects, especially the Open/Closed Principle and Interface Segregation Principle. I can see how they’ll help me write code that’s easier to update and adapt. Understanding SOLID will definitely give me a strong foundation as I take on more complex projects in the future.

Resource:

View at Medium.com

From the blog Computer Science From a Basketball Fan by Brandon Njuguna and used with permission of the author. All other rights reserved by the author.

Anti-Patterns

Source: https://www.freecodecamp.org/news/antipatterns-to-avoid-in-code/

This article is titled “Anti-patterns You Should Avoid in Your Code.” It specifically mentions six of them, being: Spaghetti Code, Golden Hammer, Boat Anchor, Dead Code, Proliferation of Code, and the God Object. An anti-pattern, in regards to software development, is an example of how not to solve a problem in a codebase. They are not a positive thing, they are examples of practices to avoid in the development process. Anti-patterns lead to technical debt, code that you have to eventually come back to and properly fix later. Spaghetti Code is the most common, it is code that doesn’t have much structure. It is called Spaghetti Code because everything is difficult to follow, files are located in random places, and when visualized in a diagram, it appears to be a jumbled mess, much like spaghetti. Golden Hammer references a scenario where you follow a certain process that doesn’t necessarily align perfectly with the project but still works well enough. This may not seem like a large issue, but is obviously not the best practice to follow because it’ll cause performance issues in the long run. You should always use a process that is the best fit for your project, even if you need to teach yourself or learn something new. Boat Anchor is when developers leave code in the codebase that isn’t actively being used in the hopes of it being needed later and thus not requiring much effort to implement when it is eventually needed. The main problem with this is when it comes to maintaining the code. It leads to the question of what code in the codebase is unused and what is being actively used. Trying to fix a bug in the system on code that isn’t even being used is a time waster. Dead code is code that doesn’t look like it’s really doing anything, but it is being called from many different places. This leads to problems when trying to modify the code because no one is unsure what is actually dead. Proliferation of Code is about objects that have the purpose of invoking a more important object, meaning it doesn’t really do anything on its own. The action of invoking the more important object should be set to the calling object. Lastly, the God Object is an example of an object that does too much. Objects should only be responsible for doing one thing, referencing the Single Responsibility principle in SOLID. 

I chose this particular source because I appreciated the way examples were clearly given along with the 6 examples of anti-patterns, and upon reviewing the syllabus the topic “anti-patterns” seemed interesting. When you’re learning computer science a lot of the time you’re learning about things that you should do and not about things that you shouldn’t do. I really enjoyed reading about these 6 examples of common mistakes that developers make in industry. It’s important to both recognize good and bad practices to ensure that your projects are properly optimized. I can definitely see myself referencing anti-patterns when designing code in the future so my code can easily be maintained. 

From the blog CS@Worcester – Shawn In Tech by Shawn Budzinski and used with permission of the author. All other rights reserved by the author.

How REST API’s Shift Front-end Development

11/16/2024

REST is a crucial topic in APIs in which I just began to learn about this semester. Before this, I had never heard of REST API so I assumed it would be a challenging concept to grasp since I had no prior knowledge regarding this style.

This text dives into the definition, explanation, and exploration of what REST is, how it is used, and how we can get the most out of it in certain services. The text highlights the importance and nuances of REST API’s while still idolizing their importance of implementation.

Initially, during classes I found the material hard to grasp since I had no idea as to what Rest was and how it worked. However, everything began to make more sense when we started working with the hands-on assignments involving actual API calls.

I learned that with certain API calls you are able to retrieve, post, edit or delete information from the backend. These important methods are called HTTP methods which play a key role in manipulation, addition, or removal of information.

A couple key concepts that I learned based off of the reading are that REST APIs are cacheable, which are essential for improving performance and managing network traffic due to its cache technique. The reading also gives insights into how API’S are considered a layered system, in which it allows you to add proxies and gateways. These are very important concepts to keep a mental note on for the future as working in a frontend environment, especially when accessing backend data.

I expect to use these resources for building websites or even mobile applications, ideally when scalability and flexibility play an important role on what I am working on. I also learned that Resp API’s work alongside Node.Js and Express.Js. Node.Js is a back-end JavaScript runtime environment, while Express.Js is a web application framework for Node.Js. This relatively new information to me, due to my experience only using C++, Java, and Python for specific applications.

Rest API’s can be tested by integrating parameters and seeing how the output compares to the expected output, while also ensuring the correct error codes are being returned for methods like GET, POST, and others. The text also mentioned endpoints, and while I grasp the basic understanding, there is still more to learn in order to increase my confidence with this REST APIs Overall, I expect to use this knowledge and information in future jobs, as per my interest in software development, and in my personal projects. Additionally, I learned a bit more about swagger, which was introduced in class to demonstrate the GET, PUT, DELETE, and POST methods of the Rest API.

Source: The REST API Handbook – How to Build, Test, Consume, and Document REST APIs

From the blog CS@Worcester – Cinnamon Codes by CinnamonCodes and used with permission of the author. All other rights reserved by the author.