Category Archives: Week-2

DESIGN SMELLS AND PATTERNS: WHY QUALITY CODE MATTERS

Writing code involves more than just making it functional, it focuses on creating solutions that are understandable, maintainable, and flexible. Yet, as deadlines approach and requirements change, our codebases frequently reveal subtle indicators that they may not be as robust as they appear. These indicators are commonly referred to as code smells and anti-patterns. In this blog today, we will explore the meanings of these terms, their significance, and how software developers can begin to identify and tackle them in their own projects.

What Are Code Smells vs Anti-Patterns?

A code smell is like a little red flag. It doesn’t necessarily mean your code is broken, but something might be off. Think of it as an indicator of hidden trouble.
An anti-pattern is a commonly used approach or structure that seems reasonable but tends to lead to problems. It’s like following the “wrong recipe” because it looks familiar.
In short, we shall term code smells are symptoms and anti-patterns are traps. Recognizing both helps keep your codebase healthy, especially as your projects grow or you work with others

Five Common Code Smells

Here are five code smells to be aware of, along with simple examples:

1. Duplicated Code

If you notice the same logic appearing in multiple locations, that’s a code smell. For example

def calculate_area_rectangle(length, width):
return length * width

def calculate_area_square(side):
return side * side

Here, calculate_area_square merely duplicates logic. Duplicated code complicates maintenance if a bug is present in one instance, it is likely present in others as well.

2. Large Class / Method

When a class or method attempts to handle too many responsibilities, it becomes difficult to comprehend, test, or maintain. For example, a User class that also manages discount calculations breaches the single responsibility principle. Instead, that functionality could be placed in a separate DiscountCalculator.

3. Long Parameter List

These are methods that require numerous parameters are harder to read and invoke correctly. For example:

def create_user(name, age, address, phone, email, gender, occupation):
pass

Organizing related parameters or encapsulating them within an object can simplify the process.

4. Feature Envy

When a method in one class predominantly interacts with the data of another class, the logic likely belongs in the latter. For example, a get_full_address method in the User class that extensively accesses data from the Address class should probably reside in the Address class.

5. Data Clumps

This refers to a collection of variables that consistently appear together such as street, city, state, postal code and indicates a lack of abstraction. Instead, they should be grouped into an Address class or struct. Having ungrouped data results in redundancy and inconsistencies.

Common Anti-Patterns to Avoid

Here are several prevalent anti-patterns and the reasons they pose risks:

1. Golden Hammer

Dependence on a familiar tool due to personal preference, even when it is inappropriate for the task at hand. For instance, utilizing a list comprehension for side effects such as printing in Python solely because of a fondness for list comprehensions.

2. Cargo Cult Programming

Imitating structures, patterns, or frameworks that you have observed without comprehending their purpose or applicability. For example, incorporating a decorator in Python that serves no significant function merely because other code examples included decorators.

3. Analysis Paralysis

Allocating excessive time to planning, resulting in no actual progress. While planning is beneficial, there comes a time when one must construct, test, and iterate. Over-analysis can hinder advancement.

4. God Object

A class or module that encompasses all functionalities—managing data, processing, displaying, logging, etc. This centralization undermines modularity and increases the risk associated with changes. An example would be a SystemControl class that logs errors, saves data, processes data, displays data, and so forth.

5. Spaghetti Code

Code lacking a clear structure or modularity, characterized by numerous nested loops and conditionals. This complexity makes debugging or extending the code exceedingly challenging. An example includes deeply nested if statements and loops within a single function.

Here’s why you should care as a aspiring developer or even as someone interested in code;

When you write code applying these ideas makes your work cleaner, more maintainable, and often higher quality.
When you show up for internships or team projects, knowing about code smells and anti-patterns gives you a professional edge,you’ll write code that is easier for others to work with. If you eventually lead or participate in code reviews, you’ll be able to spot and explain refactoring opportunities and not just “it works”, but “it works and is maintainable”. As your projects grow, technical debt can bite hard. Early awareness helps you avoid getting overwhelmed by messy code in bigger projects.

Conclusion

Recognizing code smells and anti-patterns isn’t about perfection, it’s about awareness and intentional improvement. By spotting the subtle indicators, you give your codebase and yourself a chance to evolve gracefully rather than crumble under its own complexity. If you want to take a next step: pick one small project maybe an assignment, or one module of your Android app and identify one smell you can fix. Refactor it. See how your code feels afterwards. Because when you clean up smells and avoid traps, your code becomes more than just a working program it becomes something you’re proud of.

References:

https://blog.codacy.com/code-smells-and-anti-patterns

From the blog CS@Worcester – MY_BLOG_ by Serah Matovu and used with permission of the author. All other rights reserved by the author.

Building Secure and Scalable APIs

For my second blog, I read “Best Practices for Building a Secure and Scalable API” from MuleSoft’s API University. The article goes over how developers can build APIs that don’t crash when traffic grows and that keep user data safe at the same time. It focuses on two things every developer worries about: scalability and security, and how good design decisions affect both.

It explains that scalability is all about how well your API handles growth. Vertical scaling means giving one server more power, while horizontal scaling spreads the load across multiple servers. The author also talks about caching, async processing, and rate limiting to help APIs run smoothly when there’s a lot of traffic. That part made me think about our Microservices Activities in class, where we created REST endpoints and thought about how requests would move through the system. The same design choices we made like organizing resources clearly and using the right HTTP methods are what help APIs scale better in the real world.

Then it shifts to security. It breaks down the basics: use HTTPS for encryption, OAuth 2.0 for authentication, and proper logging to track activity. What stuck with me most was how it said security should be built into the design from the start, not added on later. That lined up with what we’ve been learning about maintainable design in CS-343. If you think about security and structure early, your system stays reliable long term.

I picked this article because it directly connects to what we’re doing in class. We’ve been designing REST APIs and talking about microservice architecture, and this blog felt like a real world version of that. It also ties into the design principles we’ve covered, keeping systems modular and loosely coupled so updates and security changes don’t break everything else.

After reading it, I realized scalability and security go hand in hand. You can’t have one without the other. A system that handles tons of traffic but isn’t secure is a problem, and the same goes for one that’s super secure but slow or unreliable. My main takeaway is that good API design is about balance, thinking ahead so what you build keeps working and stays safe as it grows.

Link: https://www.mulesoft.com/api-university/best-practices-building-secure-and-scalable-api

From the blog CS@Worcester – Harley Philippe's Tech Journal by Harley Philippe and used with permission of the author. All other rights reserved by the author.

BLOG 2 – Agile vs Scrum

There are many different methodologies that can be used for project management. The two that I would like the most are Agile methodology and Scrum methodology. So, what are the differences between these two methodologies, and when is choosing the right one? In this article, I want to summarize the key differences between agile and Scrum methodologies based on what I just read from Northeastern University Graduate Programs. Their article is really helpful for me and you to understand what they are and their differences. The article link is posted below. Feel free to check it out for further information: 

Agile vs. Scrum: What’s the Difference?

Agile vs. Scrum: What’s the Difference?

By Shayna Jouber

What is Agile Project Management? 

People say that Agile is a way of thinking about project management that focuses on delivering in small steps, being in touch with customers, and being able to adapt to change. Agile doesn’t tell you what process to use; instead, it gives you ideals and principles (like those in the Agile Manifesto) that you may use with other methods (like Scrum, Kanban, XP, etc.).\

Important traits: constant communication with customers and end users, willingness to change the scope of work, and delivering work in small steps.

What is Scrum Project Management?

One such approach in the Agile family is Scrum. It offers a clear procedure for handling tasks, including who completes them, how they are arranged, and when they are finished.

Typical Scrum responsibilities include a cross-functional team, a product owner who is in charge of optimizing the product’s value, and a scrum master who makes sure the team follows Scrum procedures.

Work is divided into sprints, which typically last two to four weeks. The team decides which subset of the scope to finish at a sprint planning meeting. Every sprint concludes with a review and retrospective to consider what was accomplished and make improvements.

Frequent delivery of “shippable” increments as opposed to waiting until the project is finished to provide everything is one of the clear benefits.

Agile vs Scrum – Key differences 

Agile is the underlying idea or strategy, and Scrum is a way to put Agile into practice.

Scrum is always Agile since it adheres to Agile principles, but utilizing Agile does not imply using Scrum; you may choose to use another Agile methodology instead.

Choosing the Right Methodology 

  • Agile: Agile makes sense if the project requires flexibility, frequent testing, stakeholder feedback, and shifting requirements.
  • Scrum: Scrum usually works well in situations with a lot of uncertainty, rapid changes, and the ability to arrange into sprint cycles.

Selecting the approach is only one aspect of it; another is having strong communication, leadership, critical thinking, project management, and organizational dynamics skills.

Conclusion 

Don’t use “Agile” and “Scrum” interchangeably; Agile is more comprehensive, and Scrum is one way to achieve it.

Before choosing Agile, consider the context of your project; if you decide on Agile, select the appropriate approach.

Methodology is only one aspect of successful project management; other factors include teamwork, stakeholder engagement, effective leadership, and flexibility.

From the blog CS@Worcester – Nguyen Technique by Nguyen Vuong and used with permission of the author. All other rights reserved by the author.

Week 2-CS 343 blog: SOAP API

During class, I went over the topic of REST API and how amazing it was to understand and analyze how it works. However, there are many types of API, including REST API, GraphQL APIS, RPC APIS, and SOAP APIs. Today, I would like to go through what catches my attention the most is SOAP APIS. I read an article about explaining how SOAP API work, when to use them, and how they compare with modern REST APIS, and I would love to share it with you. The article is posted below, and feel free to check it out for further information (all the information is according to the article) 

https://blog.postman.com/soap-api-definition/

WHAT is SOAP? 

In the late 1900s, SOAP, a messaging protocol that was developed to enable different systems running on multiple operating systems, languages, and networks, with the purpose is to exchanging structured information reliably 

Unlike REST, SOAP focuses on messages rather than resources. 

SOAP messages are formatted in XML and usually contain: 

  • Envelope – defines the start and end of the message 
  • Header – contains optional information like authentication or transaction details 
  • Body – holds the actual request or response data 
  • Fault – handles errors 

How SOAP works?  

A SOAP client sends an XML request to a server, which also responds with another XML message. These communications often occur over HTTP (but sometimes also SMTP, TCP, or UDP) 

  • SOAP messages are defined by the Web Services Description Language (WSDL) to describe the operations, parameters, and return types

Advantages of SOAP

  • Platform independent – works across languages and OS. 
  • Protocol flexible – not limited to HTTPS 
  • Strong security – supports encryption and authentication 
  • Error handling – display clear fault messages 
  • The ideal workplace, where rigid relationships and dependability are essential 

Disadvantages of SOAP 

  • More complex and verbose than REST 
  • Harder to evolve or version 
  • Slower performance due to XML analysis 
  • It is less appropriate for web applications because of its limited catching support. 

Common Use Cases 

SOAP API is commonly used in banking, telecommunications, transportation, and enterprise systems – these cases require reliability, structured data, and strict security. 

  • Examples: 

In banking, SOAP API is used for bank transfers.

In transportation, flight booking systems 

ETC, ….

Shipping and logistics services 

Conclusion 

SOAP API is a great protocol, robust and standardized, but compared to REST, it’s less flexible. REST is better for modern web applications and faster iteration. SOAP API is always needed and valuable for many applications that prioritize security, reliability, and formal structure.

From the blog CS@Worcester – Nguyen Technique by Nguyen Vuong and used with permission of the author. All other rights reserved by the author.

Improving Design Communication with PlantUML (Reposted)

Why I chose this?

So for this week’s professional development blog, i decided to go with this resource regarding UML diagrams(https://miro.com/diagramming/what-is-plantuml/#what-is-plantuml) considering we’ve been working on this in class for the better part of a few class days now. While syntax is important, I wanted a resource that went beyond the basics and emphasized best practices — specifically, how to make diagrams more readable and effective as communication tools. Which ties back to what we were doing for the classwork activity, the learning objectives of the activity we did in-class together includes identifying parts of UML diagrams, being able to connect them to Java implementation or even being able to draw the diagrams using Markdown with PlantUML.

What did I learn?
The article did help me with solidifying my understanding of the lifelines, the messages and the activation bars within the UML sequence diagrams, but in general from the article, i learned how PlantUML treats diagrams as code: by writing simple text scripts, you can generate UML diagrams consistently and efficiently. This can help out in collaborative environments, where diagrams kind of have to evolve along with the codebase. The section on best practices i find the most interesting since the article highlights that diagrams should focus on clarity over completeness.

For example, a UML sequence diagram should emphasize the key messages between objects rather than every small detail. The guide also pointed out how to use colors, notes, and layout to improve readability — so them giving pointers on how to use those things is good in case we want to make things look more pretty or neat-looking. I do appreciate the explanation of how PlantUML integrates with version control systems although it’s not something i found particularly too significant. Since diagrams are stored as text, they can be tracked and managed in Git just like source code. This makes them much easier to update collaboratively, compared to traditional tools where diagrams are static images.

Reflection and Application?

I thought it might be something i’d forget about in a month or two, i do think it helped with reinforcing the core concept that the UML designs aren’t just academic exercises that we were doing in class, it can be a practical tool for teams collaborating with each other compared to the traditional tools where it’s like the diagrams are just static images alongside the fact that it isn’t just checking a box but being able to make sure everyone understands, I guess i’d say for any future projects that come to mind, i’ll apply what i’ve learned by keeping my diagrams somewhat simple and try to make it with an audience in mind since there will be people i’ll interact with and get feedback when it comes to my PlantUML code. I also wouldn’t mind experimenting with Markdown and Git so that the diagrams can evolve with the codebase, becoming almost like living documents as opposed to a static artifact.

From the blog CS@Worcester – CSTips by Jamaal Gedeon and used with permission of the author. All other rights reserved by the author.

Improving Design Communication with PlantUML

Improving Design Communication with PlantUML
I guess when it comes to software engineering, code is usually the arbiter of truth, although it isn’t always the best avenue for communicating a design for your average person/laymen considering developers and computers can parse through lines of code like it’s nothing- but trying to understand the higher-level structure or interactions within a system can be somewhat challenging without some kind of abstraction to it, which is why UML diagrams have a great deal of utility to them as they strip-away the low-level implementation details that the layperson in question doesn’t have to deal with- allowing us to focus on the essential interactions.

Why I chose this?

So for this week’s professional development blog, i decided to go with this resource regarding UML diagrams(https://miro.com/diagramming/what-is-plantuml/#what-is-plantuml) considering we’ve been working on this in class for the better part of a few class days now. While syntax is important, I wanted a resource that went beyond the basics and emphasized best practices — specifically, how to make diagrams more readable and effective as communication tools. Which ties back to what we were doing for the classwork activity, the learning objectives of the activity we did in-class together includes identifying parts of UML diagrams, being able to connect them to Java implementation or even being able to draw the diagrams using Markdown with PlantUML.

What did I learn?
The article did help me with solidifying my understanding of the lifelines, the messages and the activation bars within the UML sequence diagrams, but in general from the article, i learned how PlantUML treats diagrams as code: by writing simple text scripts, you can generate UML diagrams consistently and efficiently. This can help out somewhat in collaborative environments, where diagrams kind of have to evolve along with the codebase. The section on best practices i think i find the most interesting since the article highlights that diagrams should focus on clarity over completeness.

For example, a UML sequence diagram should emphasize the key messages between objects rather than every small detail. The guide also pointed out how to use colors, notes, and layout to improve readability — some things that you don’t really pay too much attention to(at least for myself) so them giving pointers on how to use those things is good in case we want to make things look more pretty or neat-looking. I do appreciate the explanation of how PlantUML integrates with version control systems although it’s not something i found particularly too significant. Since diagrams are stored as text, they can be tracked and managed in Git just like source code. This makes them much easier to update collaboratively if need be, compared to traditional tools where diagrams are static images.

Reflection and Application?

At first i thought it might be something i’d forget about in a month or two(if i’m being just honest with the article), i do think it helped with reinforcing the core concept that the UML designs aren’t just academic exercises that we were doing in class, but it can be a practical tool for teams collaborating with each other compared to the traditional tools where it’s like the diagrams are just static images alongside the fact that it isn’t just checking a box but being able to make sure everyone understands, between the code and the people. I guess i’d say for any future projects that come to mind, i’ll apply what i’ve learned by keeping my diagrams somewhat simple and try to make it with an audience in mind since there will be people i’ll interact with and get feedback when it comes to my PlantUML code. I also wouldn’t mind experimenting with Markdown and Git so that the diagrams can evolve with the codebase, becoming almost like living documents as opposed to a static artifact.

From the blog CS@Worcester – CSTips by Jamaal Gedeon and used with permission of the author. All other rights reserved by the author.

The downfall of “Scrum”

This week, I will discuss the subject that was recently discussed in class. The topic is “Scrum”, understanding its purpose, application, and limitations compared to Agile. Understanding the specifics of Scrum can enhance teamwork within projects, particularly in software development, where it is a widely utilized project management approach.

The information I researched offered a detailed explanation of the factors that could lead to the failure of Scrum. An essential realization was that following Scrum rules without adapting them to a team’s specific needs could result in too much inflexibility. This really affected me because I have seen situations where teams got stuck in processes and forgot the main objective: delivering value to customers. It caused me to think about past projects in which team members prioritized adhering to protocols over achieving the end goal of creating a useful, practical product. The resource I examined offered a detailed explanation of the factors contributing to the possible downfall of Scrum. One crucial finding was that adhering strictly to Scrum guidelines without adapting them to suit a team’s specific needs could result in too much rigidity. This had a significant effect on me as I have seen situations where teams got stuck in processes, ignoring the main objective of delivering value to customers. It led me to think about past projects where team members prioritized following procedures over delivering a successful, useful end product.

I found out that Scrum offers a structured way of working, but its success depends on teams embracing Agile principles, not just following a set of tasks. The article pointed out that even the best-designed Scrum plans may fail if team members lack commitment or the necessary skills. This has emphasized the significance of establishing a solid team environment in which every member is valued and motivated to take part. The article also delved into how focusing too much on Scrum practices could result in unnecessary bureaucracy, hindering efficiency and restricting innovation.

I chose this blog because I plan to incorporate these lessons by promoting a culture of flexibility in my team. I intend to prioritize the Agile principles of collaboration, customer focus, and adaptability over strictly adhering to Scrum methodologies in our process. Regularly meeting with the team to evaluate our advancement and adaptability will be of utmost importance. Effective communication will allow us to adapt our strategies according to the project’s objectives and the team’s abilities.

Reflecting on the Scrum blog, I discovered its thoughts on the restrictions of the framework to be very informative. It highlighted how sticking strictly to Scrum may impede success, underscoring the need for flexibility. This mirrored my own experiences, as a lack of flexibility frequently resulted in difficulties. I discovered that emphasizing teamwork and transparent communication is essential for providing value. In the future, I intend to foster a flexible culture among my team, consistently communicating to ensure our practices are in line with our goals. This research has enhanced my comprehension of Agile methods and emphasized the importance of flexibility and dedication in project management.

Blog URL: https://medium.com/better-programming/why-scrum-fails-ac92cab05c6a

From the blog CS@Worcester – Matchaman10 by tam nguyen and used with permission of the author. All other rights reserved by the author.

On the subject of Output-Oriented Software Design…

This week, I am going to discuss some of the benefits of the output-oriented software development methodologies we have been studying in class, like Scrum and Agile. I have built many projects both on my own and for my career from the ground up, which is where the value of these methodologies is most apparent to me. The blog post I will be referencing throughout this discussion can be found here. This post provides an in-depth overview of the Agile methodology, including lower-level analysis of different stages of the process, benefits and purposes of each stage, and various best practices for different stages. I chose this post because it correctly emphasizes the importance the Agile methodology places on continuous delivery, which is something that has been a cornerstone for me in various projects.

A project that comes to mind is actually the same project I discussed in this week’s post for CS-343. A friend came to me and asked for something way above my skill level, and it was daunting to imagine planning out the whole project and implementing/deploying some large framework in any reasonable amount of time. If I hadn’t remembered something an old professional connection had said to me years prior, I don’t think I ever could have known where to start: “your code has to exist before it can be made better.” I think that is what the heart of these continuous delivery methodologies is really about, and it really is a true statement for many reasons. The first, which this blog touches on and which we have discussed briefly in class, is that your perspective will always be better or wider after the work is started. Another reason that statement holds true, and perhaps the most practical reason (at least in my case), is that half the time, I don’t even know what I am doing when I start. It would be impossible for me to design anything, because I don’t know anything. For me, learning my way through a project is almost all the fun, and that is not really an option without methodologies like Scrum and Agile, even if I don’t know I’m using them. This blog post discusses release management a lot, which is not so applicable to personal projects, but I think it connects nicely if you compare a release to a checkpoint or successful implementation of a new feature. In my project, as I built it, I started with: what. Then, I said, I guess I could try that. Then, I implemented a single shoddy feature. I saw my feature and saw a way to make it better. Compound that a hundred times, and I had a full framework that I had approached incrementally, following Agile principles and release management without even knowing it. I think that is a testament to the elegance of these continuous delivery oriented methodologies, and I will more consciously follow these principles moving forward.

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

On the subject of Abstraction…

In this post, I will be discussing some basic concepts about abstraction in object-oriented programming. The resource I reference can be found here. I chose this topic because in the first few group activities, I was made aware that I had forgotten some of the key differences between kinds of abstraction (at least in Java), such as the difference between an abstract class and an interface. Though we reviewed these differences in class, I wanted to continue to find specific examples that would allow me to better understand the concept. Abu’s blog post briefly explains what abstraction in object-oriented programming is, some of its benefits/purposes, and some elementary examples of how to implement (no pun intended) abstract classes and interfaces.

The largest point of note I want to discuss is the benefit of modularity when abstraction is implemented. I recently finished up a personal coding project, in which modular development was a necessity. The project involved a central framework capable of ingesting a very specific kind of data from different websites, but each of the websites had a different way of providing that data. The most efficient answer I could think of was to make the central framework independent of the websites themselves, and to make it deal only with the data after it was obtained. I then created a module for each website that held the data, and implemented whatever logic I needed to in order to get the data and pass it to the central framework. I used Python for this project, but in hindsight, I may have been better suited to implement an object-oriented programming language like Java. Each module could have been a concrete class that extends some abstract class Parser, as each of my parser modules in my Python project used the same methods anyways. Each module had a get_url_and_interactions() function, a get_parse_function() function, and an stm() function (we can leave that abstract for now). It would have been very simple to use an object-oriented programming language, as I could have abstracted what it means to be a parser.

Now, this worked fine; since I was the only developer on the project, and had full visibility over all of the code, I didn’t need to check if a module implemented, for example, the get_url_and_interactions() function. I knew that it did. Moving forward, if I were coding more collaboratively with anyone else, or even if I just wanted to code according to some better practices moving forward, I could have used abstraction to standardize the parsers to ensure they all implemented certain methods or functions.

Though a little cliche, I do think it is very nice and elegant that the same thing can be accomplished in so many different ways. I think it is a good metaphor for most problems worth solving.

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

Sustainable Motivations

The pattern I chose to write about from Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman by Dave Hoover and Adewale Oshineye is in chapter 3: Sustainable Motivations. I chose this as my first pattern to touch on because I find that motivation is something that I struggle with constantly. I already face days where I question my commitment. I did it today. Imposter syndrome got to me and I questioned whether I was cut out for this field. 

I agree with the argument that “it is crucial that your motivations to program are aligned with walking The Long Road”. Two of the examples of unsustainable motivations were money and thinking of programming as fun. Initially, my primary motivation for getting into this field was money; I did think it was somewhat fun to write code and think of solutions but I was thinking about a career path that would pay decently well. My line of thinking was impacted by how expensive it is to live and enjoy life. I figured that it’s best to just become a software developer because “It’s not like I hate it and it pays well”. After reading, I want to try figuring out what motivates me to stay in this field. I’m motivated by something that isn’t money or how fun it is because I’m still studying software development despite my struggles. 

I couldn’t find something in this pattern that I disagreed with but I don’t exactly understand the task from the action part. It instructed to “Write down at least 15 things that motivate you. Wait a little while, then write down another five. How many of your motivations are about what other people think rather than what you feel? Are the percentages different between your first 15 and the final 5? How many of the motivating factors can you do without? Now write down a list of the five most important things that motivate you”. I don’t understand the practice of writing down an initial 15 and then another 5 when you can keep the questions in mind as you write the last important 5. Maybe I’ll try it and figure it out.

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.