Monthly Archives: October 2024

Design Patterns

Design patterns are essential tools for software developers, providing standardized, reusable solutions to common coding challenges. Rather than developing unique solutions every time a familiar problem arises, developers use these templates to write organized, efficient, and adaptable code. Design patterns are not complete blocks of code but instead serve as blueprints, guiding the structure of code in object-oriented programming and enhancing overall project organization.

according to the published article on GeeksForGeeks, the article mentions about A key advantage of design patterns which is reusability. Patterns can be applied across different projects, which saves time and effort by eliminating the need to repeatedly solve similar issues. This flexibility also allows developers to apply patterns quickly in various scenarios, accelerating development. Another benefit is standardization; design patterns create a common vocabulary among developers, which simplifies communication and collaboration within a team. By recognizing these patterns, all team members can quickly understand and follow the structure of the codebase.

Design patterns further promote efficiency by offering solutions that have been tested and refined over time. Since developers do not need to invent new solutions for frequently encountered problems, they can progress faster with fewer errors. Additionally, design patterns are designed to be flexible. They are adaptable templates, meaning they can be customized to fit specific project needs, making them a versatile tool for a variety of applications.

Types of Design Patterns

Design patterns fall into three main categories: Creational, Structural, and Behavioral.

  1. Creational Patterns focus on managing object creation to keep systems flexible and independent of object-specific creation logic. Examples include:
    • Factory Method: Allows creation of objects without specifying the exact class.
    • Singleton: Ensures only one instance of a class exists globally.
    • Builder: Breaks down complex object construction into simpler steps.
  2. Structural Patterns emphasize organizing classes and objects to create efficient, larger structures. Examples include:
    • Adapter: Enables incompatible classes to work together by adjusting their interfaces.
    • Facade: Simplifies complex systems by providing a unified interface.
    • Decorator: Adds extra functionality to objects without altering other instances.
  3. Behavioral Patterns focus on defining how classes and objects interact within a system, streamlining communication in complex applications.

In summary, design patterns help developers produce clear, maintainable, and scalable code. By adopting these patterns, developers can approach recurring problems with reliable solutions, improving collaboration, reducing development time, and creating codebases that are easy to expand and adapt. In the fast-paced world of software development, design patterns serve as a stable foundation for building robust, flexible applications

Reference: https://www.geeksforgeeks.org/software-design-patterns/

From the blog CS@Worcester – The Bits & Bytes Universe by skarkonan and used with permission of the author. All other rights reserved by the author.

Why Python Is So Popular Even Though It’s Super Slow

This week, while exploring some articles, I found one that really caught my attention: Happy Patel’s article titled, “Why Python Is So Popular Even Though It’s Super Slow.” Patel’s post dives into Python’s popularity in the programming world, even though it’s known for being slower than other languages. After a quick look into Patel’s background, I found that he’s a knowledgeable voice in tech, sharing insights into why developers choose Python despite its limitations. His article offers a well rounded look at the unique benefits of Python, such as its simplicity, versatility, and productivity, which contribute to its wide usage in various fields like web development, data science, and automation.

Patel kicks things off by breaking down why Python is generally considered “slow.” For instance, he mentions that Python’s code is interpreted rather than compiled, which can make it lag behind other languages in execution speed. Another reason for this lag is Python’s Global Interpreter Lock (GIL), which only allows one thread to execute at a time within a process. Although these details may seem like drawbacks, Patel points out that these traits also make Python flexible and user-friendly. Its high level syntax closely mirrors human thought, allowing developers to think more about problem-solving than strict coding rules. Patel sums it up well by explaining that Python essentially lets computers handle the heavy lifting, letting humans focus on creative coding.

Then, Patel goes on to highlight the reasons for Python’s enduring popularity, despite the speed limitations. One key factor he points out is that Python’s simplicity and readability make it incredibly productive. Development cycles are often much shorter, which can be a huge plus for companies where employee time is one of the most valuable resources. He argues that for many businesses, development speed and efficiency matter more than code execution speed. Patel also emphasizes that Python’s scaling capabilities, like horizontal scaling, let developers manage performance limitations, making Python adaptable for many real-world applications.

I chose this article because it not only aligns with our course material but also sheds light on Python’s “personality” in the coding world. I liked Patel’s casual and practical tone it’s informative without being overly technical. His points gave me a new perspective on how Python’s user-friendliness outweighs its slower speed, especially in environments where development time is critical. Patel’s discussion encouraged me to think about how Python’s design might be useful in my own coding projects, as it shows how the language’s efficiency and adaptability make it great for rapid prototyping.

Reading this article reinforced why Python is considered beginner friendly and why its productivity makes it so popular across industries. I’m excited to apply what I’ve learned, especially Python’s fast development approach, in future projects where flexibility and quick prototyping will be valuable. Patel’s article makes a strong case for why Python is more than just “slow” it’s practical, versatile, and adaptable, which are all reasons I’d recommend Python to anyone entering the programming field.

Link to the post: https://medium.com/@innvonixtechsolutions/why-python-is-so-popular-even-though-its-super-slow-cedfa2b8fe68

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.

Constructing Software

I recently had a talk with one of my friends about certain ways that software should be constructed. One of the main points of discussion was the structure of classes in Object Oriented Programming, we also spoke about storage systems such as SQL and Flat File storage systems. I wanted to talk about this because it has actually had a huge impact on how I structure most of my projects made in java/C# now. For a while now the format of my code didn’t that visually appealing in the case of class structure and naming conventions. My naming conventions for the past few personal projects were very vague and once my friend gave me feedback on the code, it made me realize that when I re-read the code it came off as confusing, even though it was my project. Every project I’ve made so far after this discussion has come out to be exceptionally clean from my view point, the naming conventions are specific to their use case, the structure for classes interacting with each other is also very efficient now. I plan on continuing to use this methodology for more projects if it can fit into the scope of the project. The reason we discussed storage systems is because for a good amount of projects I’ve done terrible storage management, it was inefficient and quite ugly overall. With some projects needing a lot of data to be handled without anything being lost I would sometimes use YML, overall it is very easy to use but it was slower than other options such as JSON. Once I was shown how to implement JSON instead of YML I noticed significant changes in performance and the along with that process the code became much more readable. In regards to flat file storage, it seems to be very useful for smaller scale projects which is mostly what I work on, but in terms of larger data sets I was shown how to easily use SQL and a little bit of Prometheus to format the project even better. Since configuring and setting up flat files in a project takes a decent amount of code, setting up the database itself was way better. Using tables to grab information instead of having to manually create getters for each entry and key in a flat file was a very good quality of life update that was implemented into most of my other projects that had larger data. All I know now is that for any future projects depending on the data sets, I will be using JSON and SQL as their performance is a significant upgrade.

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

UML Diagrams

One of the first topics we were introduced to was UML diagrams, which are diagrams that represent something, like the order or the makeup in a visual way. In class, we learned UML class and sequence diagrams. The class diagrams visualize the code files, listing off necessary information, like variables and methods, whether they are private, public, static, abstract, and can have notes for things with special cases. The sequence diagram visualizes the sequence of lines of code in main. UML was also used in making diagrams to explain the architecture of systems.

In this blog post, by Nishadha, they go into detail about types of diagrams and provide examples. UML stands for Unified Modeling Language, and is used to model “software solutions, application structures, system behavior and business processes.” There are 14 types of diagrams, which can be organized into 2 kinds, structure diagrams and behavioral diagrams. The structure diagrams “show different objects in a system.” The class diagrams and architecture diagrams belong to this group. The behavioral diagrams “show what should happen in a system.” The sequence diagrams belong in this group.

Structure diagrams are used to show the relationship between classes and/or objects in a software system. There are seven different diagrams, class, component, deployment, object, package, profile, and composite structure. Each offers something a little different from the other, but do essentially the same thing. Class diagrams show the relationship of classes in software, but object diagrams show the relationship of objects in a real life setting. Finding one to use that matches the situation you need it for is not hard. 

Behavioral diagrams are used to show how things are supposed to work. Like structure, there are also seven, use case, activity, state machine, sequence, communication, interaction overview, and timing. Each are more unique compared to each other than the structure diagrams are, but also do the same thing, showing the flow of it. The flow of logging into an account, the flow of shopping, the flow of code, etc. By visualizing the flow, it can allow you to see what is happening, spots that could have issues, and maximize it to be the best it can be. The post includes examples and templates of each type of diagram in case someone is interested in seeing more or if someone wants to use one. 

I chose this particular blog post because I did not know that there were this many types of UML diagrams. With this broad amount, I can see it being used not just for software and businesses, but for other things as well. Visualizing things out is very beneficial, allowing you to keep track of things and make things concrete, instead of just picturing it in your head. I think UML is cool, it is certainly different from what I have learned in the past, but I will use it whenever I need to. It is also not that hard to learn, making it a little bit more accessible.

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

“Cheating” Is Okay, as Long as You Are Learnin

This week, I will be talking about “cheating,” or at least what some consider to be such when solving problems. Looking at the answer to a problem while learning, especially as a beginner, can be a valuable tool when used with thought and care. While some might argue that relying on solutions stifles problem-solving skills, it is important to recognize that learning is a repetitive process. When approached with the right mindset, checking the answer can enhance your understanding of the material and increase your chances of retaining that information.

First, looking at the answer can help clarify misunderstandings. Sometimes, learners might approach a problem with a misconception, incomplete understanding, or flawed method, which often leads to frustration and confusion. I can recall several times where I was required to solve a tough problem and hitting a wall when everything that I knew didn’t work for me. However, by reviewing the correct solution, they can pinpoint where their approach went wrong, gaining insight into both the problem-solving process and the underlying concept. This prevents the reinforcement of bad methods and allows for a more efficient learning experience.

In the podcast, John says, “If you’re trying to ride a bike, you’re not going to go without the training wheels on for the very first couple of runs–it’s totally okay to peek at the solution to get past whatever wall, or to see what new technology you just weren’t even looking at because you didn’t know it was a thing.” Additionally, seeing the correct answer like this can serve as a model for solving future problems. It provides an example of how to think critically and apply things in practice.

However, for this to be truly beneficial, you need to treat looking at the answer as part of the learning process, not the end. It’s important for learners to first make an honest attempt to solve the problem on their own. After reviewing the answer, they should take the time to understand each step fully, perhaps reworking the problem from scratch without referring to the solution. This ensures that they’re not just memorizing answers but are internalizing the concepts and strategies necessary for independent problem-solving.

In conclusion, looking at the answer to a problem is okay, and even beneficial, as long as the goal is learning. When used properly, it helps clarify misunderstandings, serves as a guide for future problems, and promotes deeper understanding. The key is to approach it with curiosity and a willingness to engage deeply with the material, ensuring that it enhances, rather than replaces the learning process.

This episode can be watched in full, for free here on YouTube: https://www.youtube.com/watch?v=T7AaBcNj-mA&ab_channel=noobs%2F%2FaNetworkChuckPodcast

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

Crafting Clean Code

Link to blog: https://codingsans.com/blog/clean-code

Clean code has been a major topic in our discussions for the past few weeks, as we’ve seen plenty of examples of both clean and bad code. We’ve learned the reasonings for why someone would write bad code, as well as the importantance of clean code. While those discussions enhanced my understanding of clean code, I wanted to take a deeper dive into it and get another person’s viewpoint on the topic. Through my research, I found Clean Code: The Manager’s Guide to Building Quality Software by Gábor Zöld.

Throughout his blog, Zöld provides a deep dive into what clean code is and why it is important, as well as general principles one should follow when writing code. He also provides advice for managers who may be looking for ways to encourage their team members to prioritize the use of clean code in their projects. He also provides an overview on the current state of software development as well as the ethics that a developer should be following when writing code.

I chose this resource because it applies to what we have been learning for the past few weeks, and it provides insight on how clean code operates in a workplace. The blog is based off of the clean code principles from Robert C. Martin, which we went over in class. This blog is also very well organized and easy to read, which shows that Zöld clearly knows what he’s talking about.

The key takeaways that I would have from reading this blog post would be to esnure that the functions that I write are as small as possible and contain descriptive variable names. I also came away with the fact that clean code actually makes you work faster, as if you are trying to push code out to meet a deadline you won’t be as efficient coding in an unorganized workspace. From an employee’s point of view, it is very important to focus on the quality of your code, as well as to understand the human aspect of it and to be trustful and understanding of other developers.

This material made me more aware of some of the bad habits that I have when writing code. I now notice that sometimes I will rush code just to try to finish it fast, but it ends up leaving a messy chunk of code that I have to reorganize later. However, if I followed the principles of clean code from the beginning, it would’ve saved a lot of time and also would’ve been more beneficial to my learning. Moving forward, I’m going to apply these principles to all of my future coding projects by focusing on the names and sizes of functions, ensuring that the names are descriptive and that they don’t take up too much space. I’m also going to apply some of Zöld’s comments regarding the workplace in the future, specifically his points of being understanding towards your other developers and coworkers.

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

Uncovering Other Types of Software Architecture

Link to blog: https://dzone.com/articles/top-10-software-architecture-patterns-to-follow

Recently, we have covered a few different types of software architecture, namely Monolith, Client-Server, and Microservices. While these each have their respective use-cases, I wanted to explore more possibilities for the architecture of a software. Because of this, I have found the Top 10 Software Architecture Patterns to Follow in 2024 by Lucas Lagone. 

Lagone establishes a format to his top ten list by describing the overview, benefits, and use-case for each item. His number 1 software architecture pattern is layered architecture. According to Lagone, layered architecture (or the N-tier architecture), divides the software into several layers each responsible for their own functionalities (Lagone). This type of architecture encourages modularity, allowing for independent development of different layers of the software,  and can be utilized for a variety of types of applications (Lagone).

Lagone continues his list, discussing the rest of the architectures below:

  • Serverless Architecture
  • Hexagonal Architecture
  • Event Sourcing
  • Model-View-Controller
  • Microservices Architecture (covered!)
  • Service-Oriented Architecture
  • Event-Driven Architecture
  • Repository Pattern
  • Reactive Architecture

Lastly, Lagone writes about how one can choose the right architecture for their needs, and what factors come into play. Some of these factors include the complexity of the problem domain, the project’s requirements and goals, the scalability of the project, security, team expertise, etc. (Lagone). 

I selected this resource because it is a recently written (November 2023) article that is a good reference for an updated list of software architectures currently in use. It’s a great resource that clearly gets the point across for each item in the top 10, whilst being a short enough read to be a good refresher for those unfamiliar with the information. 

Personally, I found this to be the perfect article for me to quickly learn more software architecture patterns. It doesn’t go too deep into the software jargon and terminology that only an experienced professional would know, yet it still talks to you in a way that assumes you are an educated yet learning individual. I really liked the formatting of the top 10 list, as it gave organization, purpose, and distinction to each of the items. I learned many other types of architecture, and specifically what to consider when selecting a software architecture pattern for your project/team. This is probably the most important part, as choosing an incompatible pattern for your needs could set you back even further than you were before. I hope to apply this to future jobs where I can contribute to the selection of an architecture based on this knowledge.

From the blog CS@Worcester – Josh's Coding Journey by joshuafife and used with permission of the author. All other rights reserved by the author.

Exploring REST API Calls

In the realm of web development, the importance of REST (Representational State Transfer) APIs cannot be overstated. They serve as the backbone of communication between client and server applications, facilitating the seamless exchange of data. My recent exploration of the article “Understanding REST APIs: A Comprehensive Guide” on Medium provided a deep dive into the intricacies of RESTful architecture, the principles behind it, and practical examples of its implementation.

I chose this article because it offers a holistic view of REST APIs, making it suitable for both beginners and seasoned developers looking to refine their understanding. The author does a commendable job of breaking down complex concepts into digestible sections, ensuring readers can follow along easily. The article not only covers the technical aspects of REST APIs but also emphasizes best practices and common pitfalls, which are crucial for anyone working with APIs.

One of the key takeaways from the article was the emphasis on statelessness in REST. Each API call is independent; the server does not store any client context between requests. This design choice simplifies scalability and reliability, allowing systems to handle multiple requests without the overhead of session management. Understanding this principle has reshaped my approach to API design. I now recognize the importance of making each API call self-contained and meaningful.

Additionally, the article highlighted the significance of HTTP methods—GET, POST, PUT, DELETE—and their respective roles in interacting with resources. This reinforced my understanding of how to use these methods appropriately to perform CRUD (Create, Read, Update, Delete) operations effectively. The practical examples provided illustrated how to structure requests and handle responses, making the learning experience both informative and applicable.

This material significantly impacted my perspective on API integration in my projects. Previously, I approached APIs with a surface-level understanding, often overlooking essential details that could enhance my applications. Now, I feel equipped to design and implement more robust and efficient RESTful services. In my future practice, I plan to apply these principles not just in personal projects but also in collaborative environments, where clear communication with APIs is crucial for successful integration.

In conclusion, “Understanding REST APIs: A Comprehensive Guide” served as an invaluable resource that deepened my understanding of RESTful architecture. The insights gained will undoubtedly influence my future work as I continue to navigate the complex world of web development and API integration.

For more details, you can read the article here: Understanding REST APIs: A Comprehensive Guide.

From the blog Discoveries in CS world by mgl1990 and used with permission of the author. All other rights reserved by the author.

Looking Through Someone Else’s Code

Recently, I have been learning about clean code. It is a way of coding that prevents cluttering and confusion which is very important since coding is a collaborative effort. Without clean code mistakes would be constantly made, time would be wasted trying to understand each teammates code and most importantly nothing would get done.

It got me thinking about a developer. He’s infamous for his poor coding skills. It has gotten so bad to the point that he was wasted years coding one game even with volunteers’ aid. So, I would like to use my newfound knowledge to see how bad his code is and offer ways to clean it up.

I will be using an uploaded replication of his code from GitHub:GitHub – LordEnma/YandereSimulatorDecompiled: Decompiled Code from the game Yandere Simulator.

There are many parts of the code that need to be fixed but I will start in the ActiveAnimation.cs file. It dictates when a game cutscene is supposed to happen. One thing that stands out to me is the void function play. It contains a lot if statements (10 in fact). First, play is a vague name. It does not clearly explain what the code does. One can conclude that it plays the cutscene but there’s already a function that does this. Second, this function should be separated into smaller functions. One could play the cutscenes. Another could adjust animation components. Another could allow for earlier execution which would get rid of the else if statements. The computer would go, these conditions are met execute this or another set of conditions are met execute that. It would also make changing code easier which tends to be a problem for the developer.

Next, I want to discuss the AIControllers.cs file. It is part of a minigame where the player works in a cafe to make in game currency. Looking at the name one can assume that it only deals with player controls but that is not true. It also controls nonplayable characters which does not make sense. If something goes wrong with the nonplayable characters, it will be a pain to find where their code is. It is a little amusing since there are two files for the chairs of the minigame and all they do is move left and right. The main fix would be to take out the nonplayable characters’ code and put it with the chairs’ code since they both rely on each other. Overall, this file seems to be an improvement from the previous one but in general it should just focus on player controls. Remove everything else and put them in their own files.

To conclude, I understand why this game is taking a while to complete. From looking at two files one can see that the code is a mess. I think the developer and his volunteers should stop and focus on organizing the code. So in the end I learned one thing: do not code like this developer.

From the blog CS@Worcester – My Journey through Comp Sci by Joanna Presume and used with permission of the author. All other rights reserved by the author.

On the subject of Development Environments…

This week’s blog post is about the differences between Visual Studio and Visual Studio Code. I wrote about this topic because we just started exploring development environments, and prior to Thursday’s class, I didn’t know these were even two different software packages. I had previously installed Visual Studio on my personal computer, and when asked to install Visual Studio Code, I thought I had it already. Upon realizing they are different suites, I realized that that distinction may have been the source of a lot of confusion and issues I was running into during a previous project, and therefore is an important enough distinction to discuss in the blog post. The resource I will be referencing is an entire thread I read through on StackOverflow, which was wildly helpful in understanding some of the key differences between the two. For anybody that (somehow) isn’t familiar with StackOverflow, it is a public forum where all kinds of tech people discuss code, useful field concepts, or really anything. This specific thread was a discussion about the two software applications and the differences between them, which I chose because StackOverflow has never failed me in a time of technical need. Here are some of the key distinctions I found.

Firstly, Visual Studio is a comprehensive Integrated Development Environment (IDE) designed  for larger applications, specifically those built with .NET languages like C# and VB.NET. It offers a ton of built-in tools for debugging, checking performance, and designing user interfaces. In contrast, Visual Studio Code is a lightweight, open-source code editor that supports a bunch of programming languages through extensions. It trades off some of the advanced features found in Visual Studio in exchange for flexibility and simplicity. VS Code is well-suited for web development, Python scripting, or small coding projects. It runs efficiently on less powerful machines, which makes it accessible for developers who may not need everything provided by Visual Studio.

One of the largest distinctions is in their intended use cases. Visual Studio is much better suited for working on complex applications that require extensive debugging and testing. For example, if you’re building a massive application with multiple dependencies and a need for thorough testing, Visual Studio’s comprehensive toolset can be extremely useful. Visual Studio Code is much better suited towards working with a variety of programming languages or with a more minimalistic setup. Visual Studio Code allows you to tailor your environment exactly to your needs through extensions and customizable settings.

Additionally, they differ largely in resource requirements. Visual Studio is bulky and requires a significant amount of storage and resources. Visual Studio Code is smaller and quick to install, making it a practical choice if you don’t need a full IDE.

In conclusion, choosing Visual Studio or Visual Studio Code largely depends on your project requirements and personal preferences. Each has its strengths and drawbacks. Moving forward personally, I will be using Visual Studio Code until a need for Visual Studio arises.

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.