Category Archives: CS-343

Do You Smell That?

In software development, code smells are subtle yet significant indicators of potential problems within a codebase. Much like how an unpleasant odor hints at deeper issues, code smells signal areas in the code that might lead to bigger challenges if left unaddressed. The article linked below is exploration of this concept, highlighting the importance of […]

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

Semantics Antics

Recently, I came across an interesting blog post titled “A Beginner’s Guide to Semantic Versioning” by Victor Pierre. It caught my attention because I’ve been learning about software development best practices, and versioning is a fundamental yet often overlooked topic. The blog simplifies a concept that is vital for managing software releases and ensuring compatibility across systems. I selected this post because, in my current coursework, semantic versioning keeps appearing in discussions about software maintenance and deployment. I’ve encountered terms like “major,” “minor,” and “patch” versions while working on team projects, but I didn’t fully understand their significance or how to apply them effectively. This guide promised to break down the topic in a beginner-friendly way, and it delivered.

The blog explains semantic versioning as a standardized system for labeling software updates. Versions follow a MAJOR.MINOR.PATCH format, where:

  • MAJOR: Introduces changes that break backward compatibility.
  • MINOR: Adds new features in a backward-compatible way.
  • PATCH: Fixes bugs without changing existing functionality.

The post emphasizes how semantic versioning helps both developers and users by setting clear expectations. For example, a “2.1.0” update means the software gained new features while remaining compatible with “2.0.0,” whereas “3.0.0” signals significant changes requiring adjustments. The author also highlights best practices, such as adhering to this structure for open-source projects and communicating changes through release notes.

Reading this blog clarified a lot for me. One key takeaway is how semantic versioning minimizes confusion during development. I realized that in my past group projects, we sometimes struggled to track changes because we didn’t use a structured versioning approach. If a teammate updated a module, we often didn’t know if it introduced breaking changes or just fixed minor issues. Incorporating semantic versioning could have streamlined our collaboration.

I also appreciated the blog’s simplicity. By breaking down each component of a version number and providing examples, the post made a somewhat abstract topic relatable. It reminded me that software development isn’t just about writing code but also about maintaining and communicating it effectively.

Moving forward, I plan to adopt semantic versioning in my personal projects and advocate for it in team settings. Using clear version numbers will make my code more maintainable and professional, especially as I contribute to open-source projects. If you’re looking to deepen your understanding of software versioning or improve your development workflow, I highly recommend checking out Victor Pierre’s blog. It’s a quick, insightful read that makes a technical topic approachable.

Resource:

https://victorpierre.dev/blog/beginners-guide-semantic-versioning/

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.

Creating a Smooth Web Experience: Frontend Best Practices

A key aspect of frontend development is creating websites that perform well and provide a seamless user experience. However, due to time constraints in class, we didn’t have many opportunities to dive deeply into frontend implementation techniques. To fill this gap, I explored the blog Frontend Development Best Practices: Boost Your Website’s Performance. It’s clear explanations, organized structure, and bold highlights made it an excellent resource for enhancing my understanding of this crucial topic.

The blog provides a detailed guide on optimizing website performance using effective frontend development techniques. Key recommendations include using appropriate image formats like JPEG for photos, compressing files with tools like TinyPNG, and utilizing lazy loading to improve speed and save bandwidth. It stresses reducing HTTP requests by combining CSS and JavaScript files and using CSS sprites to streamline server interactions and boost loading speed. Another important strategy is enabling browser caching, which allows browsers to locally store static assets, reducing redundant data transfers and improving load times. The blog also suggests optimizing CSS and JavaScript by making files smaller, loading non-essential scripts only when needed, and using critical CSS to improve initial rendering speed. Additional practices include leveraging content delivery networks (CDNs) to deliver files from servers closer to users and employing responsive design principles, such as flexible layouts and mobile-first approaches, to create adaptable websites.

I chose this blog because it addresses frontend implementation topics that were not deeply explored in our course. Its organized layout, with bold headings and step-by-step instructions, makes the content accessible and actionable. As someone who plans to build a website in the future, I found its advice easy to understand.

Reading this blog was incredibly insightful. I learned how even small adjustments—such as choosing the right image format or enabling lazy loading—can significantly improve website performance. For example, understanding browser caching taught me how to make websites load faster and enhance the experience for returning users. The section on responsive web design stood out, emphasizing the importance of creating layouts that work seamlessly across different devices. The blog’s focus on performance monitoring and continuous optimization also aligned with best practices for maintaining high-performing websites. Tools like Google PageSpeed Insights and A/B testing offer valuable feedback to help keep websites efficient and user-focused over time.

In my future web development projects, I plan to implement the best practices outlined in the blog. This includes using image compression tools and lazy loading to improve loading times, combining and minifying CSS and JavaScript files to reduce HTTP requests, and utilizing CDNs alongside browser caching for faster delivery of static assets. I will also adopt a mobile-first approach to ensure websites function smoothly across all devices.

This blog has provided invaluable insights into frontend development, equipping me with practical strategies to optimize website performance. By applying these techniques, I aim to create websites that not only look appealing but also deliver an exceptional user experience.

From the blog CS@Worcester – Live Laugh Code by Shamarah Ramirez and used with permission of the author. All other rights reserved by the author.

YAGNI – It could be a matter of life or death (or profits)

YAGNI – You aren’t going to need it. In the simplest terms, the principle (initially created by Ron Jefferies) means don’t overengineer before it is necessary. It means to find the solution that works for what is needed today without engineering for POTENTIAL future scenarios. Outside of software engineering, this principle is applicable to everyday […]

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

The Backend Communication Necessity: REST APIs

Introduction

APIs are the most important piece of communication between software applications. REST APIs, in particular, have emerged as the standard for building web services due to their simplicity and scalability. This blog by John Au-Yeung explores best practices for efficient REST APIs, a topic that is essential for modern software development.

Summary Of The Source

  1. Accept and Respond with JSON: JSON is the standard format for APIs due to its readability and compatibility with most programming languages.
  2. Use Nouns Instead of Verbs in Endpoint Paths: Resources should be represented as nouns in endpoint paths, such as /users or /orders, for clarity and consistency.
  3. Handle Errors Gracefully and Return Standard Error Codes: APIs should provide clear error messages and use appropriate status codes, like 404 for not found or 500 for server errors.
  4. Maintain Good Security Practices: Implement authentication methods such as OAuth, encrypt sensitive data, and use rate limiting to prevent abuse.
  5. Versioning Our APIs: Proper versioning, such as including the version in the URL (/v1/users), allows APIs to evolve without disrupting existing integrations.

Why I Chose This Blog

I selected this blog because REST APIs are integral to modern software development, and understanding their design is essential for building scalable and maintainable systems. The blog provides a good understanding of REST APIs for developers at all levels.

Reflection On The Blog

The blog went over the standards when designing REST APIs. One aspect that resonated with me was the emphasis on clarity and simplicity in API structure. For instance, using nouns like /users instead of verbs like /getUsers for endpoint paths. Another valuable takeaway was the focus on error handling and standard status codes. Before reading this, I hadn’t fully appreciated how critical it is to provide meaningful error responses to help developers debug issues. I now recognize how returning clear messages and consistent codes can improve the user experience and reduce confusion for developers. The section on API versioning was also particularly insightful, as I hadn’t previously considered how unversioned APIs could lead to breaking changes when updates are made. This made me realize the importance of planning for future iterations during the initial API design process.

Future Application

By adopting JSON as the default format and carefully designing resource-based endpoints, I aim to create APIs that are in line with all that standards laid out in this blog. I will also make sure to maintain good security practices, such as implementing authentication. Additionally, I will incorporate API versioning to ensure compatibility with older clients as updates are introduced.

Citation

Best practices for REST API design by John Au-Yeung

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.

Whats that smell

Writing good clean code is a work of art that takes a lot of practice and understanding. One of the first practices you should use is what’s called design smells. Design smells are indicators of possible poor design principles that will eventually impact the quality of your project.

We’ve all had that point when we first started learning how to write code where we wrote some pretty ugly “spaghetti”  code. To start, the names of these smells are rigidity, fragility, immobility, viscosity, needless complexity, needless repetition and opacity. Most of these tend to go hand in hand or could stand alone. 

It’s good to know their meanings before talking about their importance.

Rigidity: when your software is difficult to change in even the simplest ways. 

Fragility: having a tendency for your program to break in other places when you make a change.

Immobility: having useful code that could be used in other systems, but can’t be integrated very easily

Viscosity: when it’s not easy to make only one change.

Needless complexity: containing things that don’t really have any use yet.

Needless repetition: repeated code that could be abstracted instead or written over and over.

Opacity: not visually clear.

While the use of being able to identify these design smells may be obvious to some. We will start with some examples before ending with why identifying these smells will be helpful in the long run.

When first starting a project sometimes it’s hard to know where to really start. That is why developers have tools such as class diagrams, but that is for another blog. Starting off with no real design in mind it’s easy to have needless repetition pop up. Once you’ve identified you can break certain things off and turn them into their own methods, you may also realize it has caused rigidity and fragility. Moving those lines might be much harder than you think. Those problems also lead into viscosity if you end up with a big enough mess (speaking from experience).

Next is the problem of needless complexity. Without having a class diagram you might find yourself jumping ahead to try and fix a problem or do something you don’t have a need for yet. The problem is exacerbated if you don’t end up needing it at all. No one likes useless code. This can lead to opacity when your code is making the goals and intents of your work unclear.

With the previously discussed class diagrams (see previous blog) to guide you. Along with an understanding of poor design principles it’s easy to see how being able to identify these smells can keep your work in much better shape for yourself and others. We have stuck with the design process for now, a future blog topic will cover how to make the code itself “cleaner”.

From the blog Mikes CS 343 by Michael St. Germain and used with permission of the author. All other rights reserved by the author.

API Endpoints, just so you know.

If you’re studying or working with Rest APIs, the chances of you running into endpoints are extremely high. I struggled a bit to wrap my head around them, so here’s a casual breakdown. It’s not as scary as it sounds.

What Are API Endpoints?

Let’s start with the basics. An API (Application Programming Interface) is like a menu at a restaurant(HOW MANY TIMES MUST I SAY THIS?). It tells you what’s available (services or data) and how to ask for it (requests). Endpoints are specific URLs on that menu where you go to get what you need.

Imagine you’re at a pizza place. You want to order a pizza with extra cheese and pepperoni. The endpoint is like the part of the menu that says, “Build Your Own Pizza.” It’s where your request (extra cheese, pepperoni) is processed and sent to the kitchen (server), and then your pizza (data) comes back to you.

In tech terms, an endpoint is a specific location on a server where an app interacts with the API to get or send information. For example:

https://api.pizzaplace.com/orders

Here, /orders is the endpoint where you place or check your pizza order.

How Do They Work?

Endpoints use URLs and HTTP methods to define what action you’re taking. These methods are the “verbs” of APIs:

  • GET: Asking, “What’s on the menu?” You’re retrieving information.
  • POST: Placing your pizza order. You’re creating something new.
  • PUT or PATCH: Updating your order, like adding mushrooms.
  • DELETE: Canceling your order. Sad day.

When your request hits the endpoint, the server processes it and sends back a response, often in JSON (an easy-to-read data format).

Why Do They Matter?

Endpoints make modern apps and websites possible. For instance, when you check Instagram, there’s an API endpoint fetching your posts. When you order on Amazon, there’s an endpoint processing your purchase. They’re everywhere!

Endpoints keep things organized. Instead of exposing a server’s entire functionality, APIs provide specific endpoints for specific actions. It’s like keeping the kitchen off-limits in a restaurant—you just see the front counter.

Real-World Example

Let’s say you’re building a library app. You might have API endpoints like these:

  • GET /books: Retrieve a list of all books.
  • GET /books/42: Get details about book #42.
  • POST /books: Add a new book.
  • DELETE /books/42: Remove book #42.

Each endpoint serves a purpose, and together they make the app functional.

Wrapping It Up

API endpoints are the way apps and servers talk to each other. They’re like doorways leading to the data and services you need. Understanding endpoints is crucial because they’re the foundation of so much of what we build. Whether you’re connecting a frontend to a backend or building your own API, endpoints are the unsung heroes of the digital world.

Next time someone mentions an “endpoint,” you’ll know it’s just a fancy name for a digital doorway.

References
https://www.geeksforgeeks.org/what-is-an-api-endpoint/
https://www.ibm.com/topics/api-endpoint

From the blog CS@Worcester – Anairdo's WSU Computer Science Blog by anairdoduri and used with permission of the author. All other rights reserved by the author.

Best Practices of REST API Design

I chose the blog post, “Best Practices for REST API Design” by John Au-Yeung because it addresses the best practices developers should be following when it comes to utilizing REST API. The blog shows us strategies that we can use so we can create items to the best of our abilities. In class, we have been using the REST API since Thea’s Pantry utilizes it. Due to this, while we have been learning a lot about it due to classwork and homework, it was interesting to be able to read other perspectives such as this blog. This is really our first introduction in our computer science classes on design like this so the more we can read and learn the better.

In the blog, the author focuses on creating user-friendly APIs that adhere to widely accepted principles. The foundation of REST API design is using nouns in endpoints to represent resources, such as /users or /orders, rather than actions like /getUser. This approach keeps the API intuitive and aligns with REST conventions. HTTP methods play a vital role, with verbs like GET , POST , PUT , and DELETE defining the operations on these endpoints. The principle of statelessness is key to this design, meaning each request from a client must contain all the necessary information for the server to fulfill it. This avoids maintaining client-specific state on the server, simplifying scaling and debugging. Error handling is another essential practice. APIs should return meaningful and consistent HTTP status codes, such as 404 for “not found” or 400 for “bad request,” paired with descriptive error messages to guide users on fixing issues. For managing large datasets, pagination, filtering, and sorting should be supported. These features enhance performance by limiting the data returned and allowing clients to specify exactly what they need. APIs should adopt JSON as the standard response format, as it’s widely used and easy to parse. Including appropriate content-type headers ensures compatibility across platforms. These practices foster better user experiences, maintainability, and scalability. By following them, developers can create APIs that are reliable, predictable, and efficient, promoting successful integrations across diverse client applications.

From the blog, I was able to learn the best practices when it comes to designing using REST API. Going forward, I plan to incorporate these practices as I continue to learn more about front end work. After reading, I feel like I will be able to increase my learning in this area as well as be able to share these practices with my peers.

https://stackoverflow.blog/2020/03/02/best-practices-for-rest-api-design/

From the blog CS@Worcester – Giovanni Casiano – Software Development by Giovanni Casiano and used with permission of the author. All other rights reserved by the author.

Object Oriented Programming – Abstraction, Encapsulation, Polymorphism, and Inheritance

Within object oriented programming, there are four main pillars. These are known as abstraction, encapsulation, polymorphism, and inheritance. These four are essential in understanding object oriented programming and why it is important. While researching, I found a blog called “Encapsulation, Abstraction, Inheritance, and Polymorphism” by Cole Davis which I believe does a great job at explaining all four of the pillars as well as why they are important. I chose to write about this topic as I use object oriented programming all the time, and I plan to do it in the future. Because of this, I wanted to help share some information that I find to be very useful in understanding how it works in case anyone else wants to do the same.

Abstraction: One of the first major pillars you’ll learn about is known as abstraction. Cole Davis does a great job at explaining this pillar, as shown in a quote from his blog: “Abstraction is the process of combining many functions into one. Think of a thermostat. Typically, a thermostat allows the user to change the target temperature, select different modes such as heating, cooling, or fan, and turn the unit on or off. When we use a thermostat, we are unaware of the intricacies that create these functionalities under the hood. By exposing only the necessary abstracted functions to the user, we make it easier for the user to use our programs.” I really enjoyed reading this example as it relates abstraction to real-life terms instead of just using coding terms, making it a lot easier to understand. Essentially, abstraction does the same thing. It makes our code easier to understand, allowing others to get a high-level understanding of our program.

Encapsulation: The second main pillar is known as encapsulation. Encapsulation is the idea of hiding and restricting access to the implementation details of our objects. Basically, this protects the data and functions of our code from being improperly accessed by things other than our objects. It makes our code more robust and predictable, allowing others to see its purpose more clearly. Another major benefit of encapsulation is it allows us to see precisely where we can change implementation details, allowing us to safely change our program.

Inheritance: The third main pillar is known as inheritance. According to the blog “Inheritance is a technique that involves a child class “inheriting” functionality from a parent or super class.” This increases usability in our code as well as stops it from being redundant.

Polymorphism: The four main pillar is known as polymorphism. Polymorphism is a hard one to explain, but its very easy to show. Essentially, it is when child classes run the same inherited method that returns different values. They use the same method, but can return different values based on what they do. Polymorphism allows us to have a more dynamic inheritance, which enables us to use inheritance more for its values that it provides.

Link: https://medium.com/@colebuildanddevelop/encapsulation-abstraction-inheritance-and-polymorphism-26aa98042d41

From the blog CS@Worcester – One pixel at a time by gizmo10203 and used with permission of the author. All other rights reserved by the author.

Exploring REST API Implementation

In this blog, I’ll talk about the process of implementing REST APIs, their significance, and the key considerations for building good APIs. REST API implementation involves creating a structured interface for applications to interact with. Using HTTP methods like GET, POST, PUT, DELETE, and PATCH, REST APIs facilitate operations on resources. These resources are typically represented as URLs for example /users, /products, and the interactions follow stateless communication principles where each request is independent and self-contained. A simple example of a REST API might include GET /users: Retrieve a list of users. POST /users: Create a new user. PUT /users/{id}: Update details of a user with a specific ID. DELETE /users/{id}: Remove a user. It’s important to know why REST API implementation is important.Communication. REST APIs provide a consistent framework for systems to interact, regardless of their underlying technologies. This universality enables integration across diverse applications and platforms. Scalability and Performance.REST APIs are designed to scale easily, as their statelessness allows servers to handle multiple requests without maintaining client-specific sessions. This makes REST ideal for cloud-based applications. Business Value
Exposing services through REST APIs enables businesses to monetize their platforms by integrating with third-party applications or creating ecosystems like app marketplaces.

Some key steps in implementing REST APIs include Defining Resources and Endpoints. Identify the data and operations required by the API. For example, a library system might need endpoints like /books, /authors, and /borrowers. Choose the Right Tools
Use frameworks like Express.js (Node.js), Django (Python), or Spring Boot (Java) to streamline development. Ensure Proper Security.Implement authentication and authorization mechanisms like OAuth, API keys, or JWT to protect sensitive data. Document the API. Tools like Swagger can help generate comprehensive, developer-friendly documentation. Test and optimize.
Use automated testing tools to verify functionality, and monitor performance to identify bottlenecks. Some of the best practices for building REST APIs include Designing clean and meaningful resource URLs. Properly utilizing HTTP methods for specific actions. Using status codes to convey response status and errors. Implementing authentication and authorization mechanisms. I chose this topic because it talks about different aspects of implementing REST APIs. In conclusion, by understanding the key principles and specifications of REST APIs, developers can design APIs that facilitate seamless communication between clients and servers.

References.https://medium.com/@zappy_cordovan_shark_864/exploring-restful-apis-building-implementing-and-best-practices-4003a19df798

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