Category Archives: Quarter-1

Understanding and Embracing YAGNI

Link: https://codibly.com/blog/articles/yagni-how-to-do-things-when-you-actually-need-them-to-be-done

The blog post “YAGNI – how to do things WHEN you actually need them to be done” goes over the YAGNI (You Ain’t Gonna Need It) principle and why it is necessary as a guardrail against over-engineering in software development. The blog starts off by explaining the origins of YAGNI, as it originated from eXtreme Programming (XP) used in agile software development teams. Essentially, YAGNI should be used so that developers can resist the urge to implement features that are not necessary or needed. The blog compares YAGNI to KISS (Keep It Simple, Stupid), as while KISS advocates for more simplicity overall, YAGNI is more focused on discouraging unnecessary functionalities. The blog also goes over the risks of over-engineering, as it can lead to more bugs and simply be a burden when it comes to maintenance. Furthermore, it can also just lead to making your code way more complex for no reason. In the end though, in order to apply YAGNI in a responsible way it requires good judgement, as some additions are harmless as long as they don’t increase the complexity, but generally speaking it is better to keep it clean and simple.

I picked this blog post because I think that this is very important practice that will apply to a workplace environment. You always want to plan ahead and implement features that may be needed in the future, but overdoing it is not good. It is very important to find a balance, as doing too much of either can lead to big problems. For our course, this blog post also covers other software design principles, as well as some agile practices too. I think that all of these principles are very important for when it comes to working in a team environment, which is something that I will most likely have to do in the future. In a team environment, it is important to make sure your code is not complex, as other people will have to read it and potentially debug it as well.

Going forward, I plan on applying YAGNI principles to my current code as well as any code that I work on in the future. This blog gave me a good reminder that just because we might need an abstraction in the future, that doesn’t mean that we have to add it now. This can just lead to more maintenance, bugs, and just unnecessary complexity. I can apply these principles favoring simple versions of programs, as well as consistently reevaulating the requirements of a program. Overall, this blog post on YAGNI gives a great view and perspective on a principle that is very important in software design.

From the blog CS@Worcester – Coding Canvas by Sean Wang and used with permission of the author. All other rights reserved by the author.

Mastering OOP Fundamentals with SOLID Principles – ByteByteGo

The blog post/article I choose to read and write about is Mastering OOP Fundamentals with SOLID Principles from the ByteByteGo blog page. This blogpost goes into many aspects of the OOP programming, some of which we’ve discusses in class. The first portion delves into Encapsulation, Abstraction, Inheritance, and Polymorphism. It explores some key concepts like single inheritance, multiple inheritance, multilevel inheritance, hierarchical inheritance, method overloading, method overriding, etc. It explains how these 4 fundamentals are important for creating and utilizing OOP effectively, but in and of itself doesn’t necessarily create code that is easy to work with and maintain.

That’s why it introduces the principles of SOLID, which according to the syllabus is something we will eventually touch on in the future. The S is for Single Responsibility Principle, stating that classes should only have a single reason to change. This ensures better organization, easier debugging, and improved testability, so it’s better to split a complex class into multiple simplified classes. The O stands for Open/Closed Principle, stating that classes should be open for extension, but closed for modification. Essentially, if we want to add new behaviors to a class, new subclasses or interfaces should be added without changing what already exists. The L stands for Liskov Substitution Principle, stating that “objects of a derived class must be replaceable by objects of the bass class without altering the program’s correctness.” A subclass shouldn’t break existing functionality while behaving like it’s parent class. This somewhat relates to the interface portion of what we did in class. The I stands for Interface Segregation Principle, stating that clients should not be forced to depend on unused interfaces. Essentially, interfaces should be small and specific, with only relevant methods. Finally, the D of SOLID stands for Dependency Inversion Principle. This states that high-level modules and low-level modules should depend on abstractions, rather than each other. This can help improve flexibility and mobility, so that it’s easier to test and work with without making as many modifications.

The reason I chose this blogpost/article is because it directly relates to what we’ve learned with the fundamentals of OOP so far, as well as introducing me to something that’s planned for the syllabus. I also saw it as a good primer for Java and OOP thinking to help me better understand the general ideas and concepts that hold it up.

Even though a good portion of what was written is just reiterating some of what we’ve discussed in class, I found it really helpful to have things explained another way with the examples the blogpost gave. It helped me better grasp the purposes behind these fundamental principles and ideas in a way that felt easily digestible. The SOLID portion was also interesting, and everything intuitively makes sense. I can definitely see myself referring back to this and sticking to these ideas as I do OOP programming in the future, because it genuinely does seem to make the code easier to work with and easier to understand.

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

Design Patterns in Software Construction

Hi, 

For this blog post I have chosen the topic design patterns in software construction. I watched the video linked below which is titled Design Patterns in Plain English | Mosh Hamedani by Mosh which does a great job of showing how design patterns in software construction work. https://youtu.be/NU_1StN5Tkk?si=aFdc2v01YIvoGq0m

Firstly, we must understand what exactly a design pattern is with respect to code. Design patterns are reusable solutions to common problems in code. From here we can make the inference that the goal of a design pattern is to build reusable and extensible software. To help us achieve this, there are three main categories which are creational, structural and behavioral patterns. Creational patterns regard different ways to create objects. Structural patterns are about the relationship between those objects. Behavioral patterns are about the interaction/communication between objects. From these categories we would choose which one to use based on the specific problem to implement the design pattern.

To help with the process of a design pattern, you would want to use a UML diagram to better visualize and understand the whole code. This way you will be able to see the type of relationships from one body to another; whether it’s inheritance, composition, and/or dependency to name a few. Something you may see on the UML diagram could be an interface.

An interface is a powerful tool that is often used in design patterns. Furthermore, they promote loosely coupled apps and flexibility. With an interface in the design pattern it strives substantially towards the overall goal which is to build reusable and extensible software.

Mosh then goes on to discuss and show the four principles of object-oriented programming, which are encapsulation, abstraction, inheritance, and polymorphism. Encapsulation deals with bundling data and the methods that operate on it into a single unit or class and hiding the values or state of an object within a class. In coding, abstraction is in regards to reducing complexities by hiding unnecessary details in classes. A great example of abstraction to better understand is thinking of a tv remote control; it shows only what you need to see. The next one is inheritance. Inheritance is a mechanism for reusing code across classes including common behavior. Try thinking of a parent to a child class. The child class inherits the parent class, but also has instances and methods of their own. Polymorphism is the ability of a single object to take many different forms. Mosh stresses that you must know and understand these principles as they are crucial to building design patterns.

Some takeaways are understand the problem you are facing first, have a strong foundation in OOP, and know when not to use a design pattern. Furthermore, creating multiple classes or a new interface just for one or two actions of a given state is simply not worth it; go with the else if statement.

From the blog CS@Worcester – Programming with Santiago by Santiago Donadio and used with permission of the author. All other rights reserved by the author.

Week 1 CS-343 Blog: Strategy Pattern

I want to introduce a powerful tool in the arsenal of software engineers aiming to write clean, flexible, and maintainable code. The tool that most developers would need to upgrade the code without modifying the existing client code , and it is particularly helpful in scenarios involving algorithms of your code. The tool is called “Strategy Pattern“.

What is Strategy Pattern?

Strategy Pattern is a behavioral pattern that enables the selection of algorithms at runtime. This tool is crucial for developing flexible, maintainable, and modular code. Especially when multiple algorithms are applied to solve a problem. The key goal is to allow software entites be open for extension but closed for modification, meaning without having any impact or changed on the client code, but modifying and extending it.

Type of Strategy Pattern

  1. Context – Holds a reference to a Strategy, delgates work to it. The Context doesn’t implent algorithm logic itself.
  2. Strategy Interface – Defines a common method (or set of methods) that all strategies must implement, so they’re interchangeable.
  3. Concrete Strategies: Classes implementing the Strategy interface, each providing a different algorithm implementation.

Benefits

  1. Flexibility – New strategies can be added without modifying existing code.
  2. Seperation of Concerns – Context is freed from algorithm details; each strategy handles its own logic
  3. Easy to test: You can test each strategy class independently.

Disadvantage scenario

  • Using pattern strategy creates more classes to manage, which can complicate desgin
  • Some abstraction layers which may or may not be worth it in simpler scenarios.

Conclusion

The startegy patterns is useful when you have multiple algorithms or behaviors that needs to be added or swaped dynamically, in order to solve problem without impacting the existing code. It helps you build modular, maintainable, and extensible systems. But you should be mindful about the extra complexity it comes with.

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

Unlocking Encapsulation: Why Data Hiding Matters

I came across an article on Titled “Encapsulation in Object Oriented Programming”. It Explores in detail about the core principles of object-oriented Programming (OOP): encapsulations. Although I had already heard about this concept in computer science class, that time just covered the minor details and definition without really understanding why it is so important in practice. Reading this article helped me see encapsulation in a new way, especially through real-world examples and comparisons that made the idea much easier to grasp.

               Encapsulation is explained as hiding the internal details of a class and only allowing controlled access through methods. This is usually done by keeping variables private and providing getters and setters for interaction. According to the article, errors can easily occur when other program pieces change an object’s state directly in the absence of encapsulation. However, with encapsulation, updates are subject to predetermined guidelines, maintaining the system’s unity and security.

               One of the examples that stood out to me compared encapsulation to locking a house. If all the doors and windows are left open, anyone can come in and move things around. In programming terms, that would be like exposing all fields of a class as public. By contrast, encapsulation is like keeping the house locked and only providing a few keys for safe entry. In the same way that you wouldn’t give full write access to everyone on a GitHub repository, you don’t want every part of a program to freely change the internal state of your objects. Instead, you provide limited access—like adding collaborators with specific permissions or using pull requests for controlled changes. This analogy helped me understand why developers stress the importance of data hiding: it keeps things organized, prevents misuse, and ensures that changes happen in a safe, predictable way.

               The article provided an actual scenario using a bank account class. Any piece of code might set a balanced variable to a negative value if it is public, which would go against the program’s logic. However, the application may set restrictions like “balance cannot go below zero” if the balance is private and is only accessible via the deposit() or withdraw() methods. This demonstrated to me how encapsulation guarantees that critical rules are always observed while also hiding information.

               What I learned from the article is that encapsulation goes beyond coding style—it’s about safeguarding data and ensuring programs behave correctly. A helpful way to picture it is how GitHub handles collaboration. Instead of letting everyone edit the main project directly, contributors usually fork the repository, make changes in their own copy, and then open a pull request for review. This process keeps the main branch stable while still allowing improvements, like what we practiced in our CS343 and CS348 classes at WSU.

               Overall, the article provides the details we need to practice and build stronger knowledge in the basics of the field.

References:

“Encapsulation in Object Oriented Programming” by AKshay Raut (Medium)
↪ https://akshayraut.medium.com/encapsulation-in-object-oriented-programming-4cfb0ee28f12

FreeCodeCamp. (n.d.). The Four Pillars of Object-Oriented Programming. https://www.freecodecamp.org/news/four-pillars-of-object-oriented-programming/

From the blog CS@Worcester – Pre-Learner —> A Blog Introduction by Aksh Patel and used with permission of the author. All other rights reserved by the author.

Understanding Project Management

The blog post by David Hartshorne begins with covering the basics of what project management is. Project management covers the overall facets of how to meet and achieve the deadlines of a project such as setting goals, meetings, and communicating and collaborating the the stakeholders/customers. This is all done in order to insure that tasks are completed in an efficient and timely manner to avoid mistakes or possible challenges from popping up. The blog then moves into have many different types of companies from software to construction as examples that use project management. The main types of projects are,

Predictive: Follow a linear timeline between phases

Adaptive: Short periods of work with frequent check-ins and feedback

Hybrid: A blend of the two

There are also five main phases to the process of a project which are,

Initiating: Laying the foundation of the project including understanding the project scope, main overview and budget

Planning: Define members roles, goals, time tables, and needed resources

Executing: The start of the project, institute changes and suggestions as needed

Monitoring: Check-ins and consistent communication, keep and eye on the goals and overall task at hand

Closing: Deliver the project, Conduct overview on the project on what went good and bad and where to improve

I chose this blog post due to its depth on the topic of what project management is. The blog focuses on the overall scope of the project and all of the possible avenues that need to be considered from tools to aid the process, team members and their roles, phases, tips, and the main areas of management. I also was attracted to this topic due to its application to industry as having a key understanding of project management is needed when either running a project or being the best team member that you can be. Having read the blog, there has been a fundamental shift in how I view projects and my role in them and my other team members. The need to constant communication has only been further reinforced as the backbone of a solid project. Clear defining of roles and goals is also needed to ensure that everyone knows what they need to do. With goals, something that also stuck with me is to keep the prioritization of the goals that need to be completed all within a realistic scope. This stuck out to me as I often feel like and find that scope creep can quickly seep into projects and teams and take hold. I have also begun looking into and pursing how to apply the suggested team-based tools like roadmaps and time management software to help keep me on task and use on future projects such as some of the suggested software like “Waterfall” and “Agile”. This blog was an excellent source on information on the management process and I encourage everyone to read it for themselves.

Works Cited

Hartshorne, David. “A Guide to Project Management.” Monday.com Blog, 20 Dec. 2020, monday.com/blog/project-management/guide-to-project-management/

From the blog CS@Worcester – Dan's Blog by Daniel Fung-A-Fat and used with permission of the author. All other rights reserved by the author.

Polymorphism in Object-Oriented Programming

Polymorphism was one of those programming words that used to sound scary the first time I ever heard of it. It literally means “many forms” but in OOP, it’s not as scary-sounding as it is. It’s basically when the same method or function can be something different based on what object it’s being called from. As soon as I started reading over some examples, it made a lot more sense.

Think of it like this: an individual might be a class student, a home sibling, and maybe a work employee. Same person, various role depending on context. In programming, polymorphism enables us to do one thing with one function that changes its behavior depending on the object.

There are two main forms of polymorphism. Compile-time polymorphism (or static) is solved before the program ever runs. That generally happens with method overloading, where you have multiple versions on the same method name with different parameters. The compiler figures out which one to invoke. Operator overloading is another example, like using “+” for numbers and strings too.

Then there is runtime polymorphism (dynamic), resolved as the program is running. That is what happens with method overriding. A case in point is a parent class Shape that has a method draw(). Subclasses such as Circle and Square override draw() to do something else. When you call draw(), the program picks one that matches the actual object.

First of all, I used to confuse this with inheritance. They definitely go hand in hand, but they are not one and the same. Inheritance is when you are copying another class’s code. Polymorphism is when you have the same method name but have different action.

A lot of people also think that using polymorphism, especially the runtime kind, makes programs really slow. I used to believe that too, but it turns out that’s not really the case anymore. Modern compilers are built to handle this kind of thing quickly with tricks like virtual tables, so the performance hit is tiny. The trade-off is worth it because you get cleaner code and way more flexibility, so worrying about speed here feels kind of outdated.

I’ve read about this and it struck me how many times I’ve made my own code overly complicated. In Java, for example, I used to create a whole bunch of methods with unique names when I could have done overloading. I also blocked overriding in subclasses because I believed that it would be slow. Now I know that not just is that fine, it’s the correct thing to do most of the time.

In the future, I’d like to use polymorphism more intentionally, especially in my Android applications. It’ll be a tremendous assistance if new functionality is introduced in the future because I won’t need to begin anew. That, to me, is the beauty of OOP, it’s not just about making things function, but making them simpler to maintain and extend in the long run.

Resources:

https://www.cincom.com/blog/smalltalk/polymorphism-in-object-oriented-programming/

From the blog Maria Delia by Maria Delia and used with permission of the author. All other rights reserved by the author.

Git and Its Significance in Modern Software Development

I decided to write my first self-directed post about a blog I found regarding Git and its significance in software development. During our course thus far, we have spent quite the amount of time learning Git; more importantly, why it exists and how to use it. This blog summarizes the importance of Git in modern software development. Prior to its creation, there was not a feasible or reliable way to maintain code amongst developers. This led to inefficient workflows and harder collaboration that may have impeded a developer’s ability to contribute effectively to a project. The blog claims that 85% of developers believe that Git’s introduction and adoption have made collaboration much easier than it was before. It later talks about what Git is, how to set it up and some basic use cases. The author writes about some common issues with Git such as merge conflicts and how to integrate it into your IDE. Later on, the article highlights some best practices such as meaningful commit messages or committing small changes, rather than many large changes at once.

For beginners to Git like me, this was useful to reinforce what we have learned in class so far. I chose this resource to learn more about Git outside of class. I had previously heard of Git and GitHub from prior usage of the Internet, though, I had no idea how it was used or how prevalent it would be within the computer science field. Since Git was a newer topic for me and one that I had not touched upon in my 7 years of studying information technology and computer science, I wanted to look more into it outside of class to get a better grasp on it. I feel that after reading this blog, I am more comfortable using Git than I was before. For me, I love to learn new things, and I find that learning something from multiple different angles is often most effective for me. Using this in combination with the lectures and practice from class has been a useful resource for me to improve my Git skills. Within the realm of software development, knowing Git, or at least how version control systems work, is imperative to being successful within the field. Even outside the field, knowing collaboration, effective communication, and teamwork is essential, since computer science is rarely an independent field. I also feel more confident after reading this article, knowing the best practices and common issues that I may run into while working in the field. Overall, this article was extremely effective in expanding my understanding on Git and version control systems.

The link to the article can be found here: https://blog.rheinwerk-computing.com/gits-significance-in-software-development

CS-348
CS@Worcester
Quarter-1

ZG

From the blog CS@Worcester – zach goddard by Zach Goddard and used with permission of the author. All other rights reserved by the author.

Why Polymorphism is so Important in Programming

Polymorphism is one of those terms you hear in Computer Science that sounds confusing at first and overly complicated, until you find out you’ve probably been using it this whole time. “Polymorphism in Programming” by Johnathan Johnson is a great blog detailing exactly what it is and how it works. It gives a nice clear definition that’s easy to understand and then lists out the different types you’ll encounter along your programming journey.

Polymorphism is essentially just a process that can perform multiple tasks depending on the context of the situation. There are many forms of polymorphism as well such as Subtype (Runtime), Ad hoc (Compile-time), Parametric (Overloading), and Coercion (Casting). I won’t get too in-depth on each of these as Johnson has already done a great job of this in his blog.

The key takeaway here is that polymorphism allows you to program an interface, not just an implementation. What I mean is by creating an interface or superclass it doesn’t matter what type the object being called is you can just call the method on it. For example, you could have a list of Shape objects that can hold a circle or a square or whatever shape you want, and you can call draw() without caring which specific subclass you’re dealing with. Because of this code duplication can be severely cut down due to multiple objects using the same method all stored in the superclass.

This is similar to what we saw in class with the Duck superclass and all the subclasses with different duck types. As long as you were calling a method stored within the superclass it didn’t matter which subclass you were calling it on. Even if the subclass had overridden the method, you would just be running into ad hoc polymorphism as the program would be switching the version of the method used to that of the one stored in that particular subclass.

Even though I’ve been using polymorphism for years through my career here at Worcester State it’s good to finally learn what this practice is actually called. It’s also good to learn that there are forms of it I wasn’t always using when I could of and instead took the less efficient route to solve my problem. The concept is integral to time efficiency and when programming time is incredibly important in a lot of ways.

I plan on taking this newfound knowledge with me through the rest of my career here as well as whatever the future holds for me.

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

Object Oriented Principles

This blog is based on “OOP Principles: What is Object Oriented Programming?” from Full Stack Foundations. The article has a clear understanding of the four core pillars of object-oriented programming. That being encapsulation, abstraction, inheritance, and polymorphism. It also explores how these principles tie into more advanced design ideas such as composition over inheritance and more.

The article begins by explaining why OOP is valuable, emphasizing that it organizes code into modular blocks that bundle together data. OOP helps developers manage complexity in large systems. It then talks about encapsulation as the practice of hiding code and exposing only interfaces, which helps reduce unintended interactions. Abstraction is explained as representing concepts with simplified models. Inheritance is presented as a practice that allows new classes to build upon existing ones, enabling reuse of behavior. Finally, polymorphism is described as the ability to treat different classes as instances of a common base type, making systems more flexible and adaptable. Later in the article, the author connects these principles to design patterns, noting that good object design avoids fragile hierarchies.

I chose this article because it’s connection to our class, discussing design concepts. OOP is a key topic in this course, from abstraction and encapsulation to design principles and patterns, and I thought this blog was a good representation of OOP. It struck a good balance between the basics of OOP and the many ideas that are needed to think about design in a professional way.

Reading this article reminded me that OOP is more than just syntax like classes and methods. The discussion on abstraction and encapsulation stood out the most to me because in my past projects and classes I often never thought about the exposure of too many details of a class, either through public fields or otherwise. The article emphasized that clean abstraction is essential for maintainability. I also appreciated the warning about inheritance. The article shared the idea that using composition over inheritance can prevent problems and lead to more flexible ideas.

The main takeaway for me is that OOP is an idea that allows code to be built clean and modular rather than something that has to be perfected up front. In future assignments and projects, I want to be more aware about the principles of clean OOP coding. I also plan to make better use of interfaces and encapsulation so that classes depend less on concrete implementations. This resource gave me a refresher on these ideas and hopefully I can build systems that are easier to maintain and improve upon.

https://www.fullstackfoundations.com/blog/oop-principles?

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