Category Archives: CS-343

Intentions and Goals Part 2: Defining Needs

Setting goals allows me to take things one at a time and move over those self-imposed barriers effortlessly, but it is the learning and the love of the process that don’t even allow me to put those barriers there in the first place.
Now on to one of the actual goals, I have been wanting to use what I am learning as a computer science major to implement into my current workplace. I think that it has been a great opportunity to work there and they have provided a good environment for self-development similar to that of being in school. As a token of appreciation, it would mean a lot to me to be able to leave something useful behind. That something useful would be in the form of Software. In the past year or so I have had a level of engagement in my courses that I haven’t had in a while and that is most likely due to recognizing the practical application of what I’m being taught. This has led me to be vigilant at my workplace and observe problems that can be solved with software. After figuring out what the problems are and defining those issues
For a while, I have been stuck on what to do now after defining the problems from the software development class, and based on the topic of my last two blog posts it is clear to me that figuring out suitable architecture is important to a well-developed software system. To do this, I need to understand the important requirements of the users involved. Currently, I am under the impression that microservices architecture would be most suitable as many of its defining characteristics would fulfill the requirements of the business. Within this process of developing software, I am learning that there is a lot of picking and choosing systems that are specific to the needs of the business. Although it can still be overwhelming, I am relieved that there are already many preexisting systems and that picking and choosing make it a little easier instead of having to completely create something from scratch. On the aspect of picking already developed systems, the topic of API comes into mind I found this useful article outlining different APIs and their use cases and how some are still in use today and fit specific needs. The article points to the idea that even though some APIs might seemingly be outdated that they still have a use case that only requires such an API and nothing more.

I understand that I still have a lot to look out and plenty to learn but recognizing that there is a direct application to what I am learning provides some great motivation and hope that will allow me to continue to get over whatever barriers may be in the way whether self-imposed or not.

https://www.altexsoft.com/blog/soap-vs-rest-vs-graphql-vs-rpc/

From the blog CS@Worcester – Sovibol's Glass Case by Sovibol Keo and used with permission of the author. All other rights reserved by the author.

Bridge Structural Design Pattern

A bridge is a structural design pattern that lets you split a large class or a set of closely related classes into two separate hierarchical abstractions and implementation- which can be developed independently of each other. The blog from refactoring guru explains bridges a way of using more object composition rather than inheritance. Which means that we can extract one of the dimensions into a separate class hierarchy, so that the original classes will reference an object of the new hierarchy, instead of having all the behaviors with in one class.

Using this design principle, we can extract the code into its own class with two subclasses. And then we can have a reference field pointing to one of objects. That reference field will act as a bridge between one class to another and let’s say we needed to add another color for a shape, then we don’t have to go out of our way to create a PurpleCircle Class, we can just add the color, reference it with the shape and we’re done.

The blog has gone out of its way to explain real world applications for the Bridge pattern. One being used to help divide the monolithic code of an app that mages devices and their controls. The Device classes act as the implementation, whereas the Remotes act as the abstraction. The remote-control class declares a reference as explained in the description and that links it with a device object. All remotes work with the device via the general device interface.

Bridges are important because sometimes it can get hard to see what is contained with in a class especially if the class is gigantic. And making changes with one aspect of the class could require you to make changes in other aspects of the class. So, the bridge helps split the monolithic class into several class hierarchies. Which makes it different then most patterns like the Factory Design pattern or the Singleton pattern. The Bridge pattern would be mostly compared to the Strategy pattern where it plays a bigger role in how the code is being structured rather than adding some small commodities. It’s important to use the Bridge pattern to help extend the class in several orthogonal (independent) dimensions. It helps delegate the original class into related work to the objects belonging to those hierarchies instead of doing everything on its own.

The Bridge is very useful to help organizations within the code, I always tend to fill my classes with code with the use of implementations or inheritance so this would be a good way to get myself started on it.

Link to Blog: “https://refactoring.guru/design-patterns/bridge”

From the blog CS@Worcester – FindKelvin by Kelvin Nina and used with permission of the author. All other rights reserved by the author.

Get a (rewriting) hat!

One thing that stuck out to me is the concept of a refactoring hat! It is the idea that if you’re refactoring your code and you feel tempted to change the meaning of the code, don’t! So get that hat and remember to keep things intact when you start cleaning up!

For me, this was something that felt very important, since I often have a distinct issue where as I’m going back on old code, I realize that I could do something an entirely different way because of a new perspective. This often makes the code a bit better, but at the same time, I often change the functionality of it, so not only do I have to edit that one portion, but all the portions of my code! It isn’t that my code is too coupled together or that it’s rigid, but because my intent changed and this is hopefully where my refactoring hat comes in!

As noted in the website, a good way to recognize if you’re changing the intent of the code is to make sure that you are not rewriting Unit Test. If you’re refactoring and your Unit Test seems to still work without any changes, then that means you’re on the right track! But if you refactor and find that there are things you need to change in your Unit Test, you better put your hat on more securely because you’re past the point of refactoring!

This is essentially the concept of Rewriting vs Refactoring! To paraphrase MarnixKlooster, refactoring is cleaning things up, so you have more wiggle room when designing your code. In essence, making more design space! While Rewriting is creating code that meets new specifications and implements algorithms and data structures that are more efficient than the previous ones.

Though both of these seem similar, they are very different! From my understanding, Refactoring is like cleaning up your room, you know, sweeping it, mopping it, etc! But Rewriting is rearranging your room entirely! Move your bed, your table, add a new desk, all the little bits and bobs! Though they do seem similar, they are very different!

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

Learning About Frameworks

This week I read about frameworks by reading “What’s a framework? All about software frameworks” by Lucas Stahl and Sean Higgins. Sean and Lucas did a great explaining what a framework is by making it easy to understand and giving many examples.

A framework is like a template that can be used to build your code on top of. Frameworks are premade code that take care of some aspects of the program. They are also reusable functions that make programming easier. Most programming languages have at least one framework that use them. The content of a framework can be very different, and it depends on the needs of the programmer for which one they should use. Many frameworks are open source that are maintained by the community of programmers but there are some from large companies like Microsoft or Meta. Frameworks might sound like code libraries but there is a difference. A quote by David Fateh helps explain the difference. Fateh said, “A framework,” he says, “is like a construction blueprint: A template that defines a basic structure for your build. A code library is more like a carpenter’s tool belt: It has tools designed to perform specific tasks”.  Lucas and Sean go on to explain the benefits of using a framework. Some of the benefits are being able to focus on one area of development, easier testing, development speed, reliability, documentation, and better security. There are many benefits to using frameworks but there are a few challenges as well. These challenges are structural limitations because frame works can’t do everything, having to learn the framework and the language it is based on, as well as having to pick from the many frameworks that are available today.

I learned a lot from this article, and I think frameworks could be a useful tool to use when programming. The diverse selection available seems like they could help in many situations. Being able to use a framework to cover a part of a program like the backend for example so another part like the front end can be focused on sounds interesting. Being able to focus on your area of expertise is a major benefit of frameworks. Although there are some limitations of frameworks the benefits seem to outweigh the cons. After reading this article I am now curious about all these frameworks and how I could use them to better my development skills. In the future I suspect that frameworks will be a common use for me.

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

Week 9 – GRASP

This week, I decided to look at an article based on the GRASP principles, and found this insightful article from Kamil Grzybek, an experienced designer in the .NET Framework. The GRASP concepts essentially explain how to assign certain responsibilities to different classes within a project. Each principle is derived from a problem, and the principle solves the problem. The first principle, Information Expert, decides which class will take the responsibility for a certain operation. In his example, his Customer class takes the responsibility of compiling an order since it has all the necessary information to do this. The next principle is Creator, which asks the question who creates an object? The answer according to the principle to assign a class to create this object, only if said class is closely related to the object. The next principle Controller decides who is the first object beyond the UI to control a systems operation and delegate information. The fourth and fifth principles are Low Coupling and High Cohesion, which solve the issue of keeping classes independent and to keep them focused on minimal tasks. The sixth principle is Indirection, which solves the issue of avoiding direct coupling between objects. The seventh principle is Polymorphism, which helps control flexibility within the code. The eighth principle, Pure Fabrication, solves the issues of what do to when there is an intermittent task that needs to be completed and avoiding more direct coupling between classes. The final principle, Protected Variants, is argued to be the most important principle. It helps to keep code available to change.

After reading this article, it seems to be a more expanded version of principles and concepts we have learned earlier in the class. Most of the principles within the GRASP lineup are connected to either another set of principles like SOLID, or directly correlate to a specific concept like loose coupling. The main reason I selected this article was the nice use of physical code examples to show off the principles. Throughout the whole article, Kamil used a Customer project that tracked orders. Each concept was show in a different section of the project, which makes it easier to visualize when thinking about how to apply it to code that I create. This article seems more to be for more experienced software designers, which I enjoyed. Learning new concepts with descriptions that are easy to understand can be helpful, but having a more challenging description given to me challenges me to understand the concepts deeper.

To use these principles in the future I must remember a two different ideas.
1.) All aspects of the code need to be individual and loosely related to avoid breaking the code when adding change
2.) It is easier to assign certain tasks to a separate class than to jam pack a single class with all of the functions

Link:http://www.kamilgrzybek.com/design/grasp-explained/

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

BLOG POST 2

This weeks blog read of choice was a blog called “ Polymorphism in Programming” by Jonathan Johnson. This blog goes throught what is polymorphism, how to use them and also the different types that there are. One thing I thought was funny is that it compares ciderella after midnight m and before as polymorphism. Since polymorphism is when the object undergoes transformation. In programming the oject tranforms in compile time and dynamic and what does the transfmation is the method and object. Polymorphism is very essential to object oriented programming. Four different types of polymorphism are subtypes polymorphisms, parametric polymorphisms, and hoc polymorphisms and coercion polymorphisms. Subtype polymorphisms is the most common kind, it uses of class name to refrenece multiple kinds of subtypes at once. Parametric polymorphism which is also describe as overloading specially provides a way to use one of its functions to interact with multiple types. Ad hoc polymorphism also known as compile time the function with the same name acts differently for different types and lastly there is coescion polymorphism is the direct tranfomation of one type to another this happens when one type gets cast into another type. The reason why I picked this blog post was because we went over polymorphism in class a while back but I personally did not take the time to dig deeper into the subject so this was a good opportunity to dive a little deeper. Which is what I was able to achieve with this blog post. It refreshed what I learned about the different types of polymorphism and really helped me grasp the concept into a more deeper level. The reason why I picked this blog post is because I like the way it was formatted and how it is organized with its information. I also like the graphics that they used to explain it. It brought a simple and a more clear picture. Especially when they used Disney to connect to reader. I really appreciated that, it brought a sense of light weight to the read. There was a lot of information but it was easy to intake because of the organization. I hope to take a lot from this blog post, and use polymorphism to reuse code more effectively, to also use same variable for multiple date types. And also to reduce coupling with differently functionality types. Hopefully these clarification with different types help me excel in this so that when I do need to reuse code I can do it in the best format possible using all the architecture structures that I am learning. 

https://www.bmc.com/blogs/polymorphism-programming/

From the blog CS@Worcester – CS- Raquel Penha by raqpenha and used with permission of the author. All other rights reserved by the author.

Processing Architecture

When absorbing information, I find that it can often be overwhelming, sometimes leading to a point of disconnect. I see this occurring when you start asking questions like “Why am I learning this?” and “In what world would I ever need to use this?”. In the case of software architecture, I had a similar moment where I wondered how one would approach designing architecture.

 I found an article that suggest a solution to all my prior questions and in my previous blog post regarding the designing of software architecture, in which I questioned how one would create a design that suites a specific purpose. This article from 2006 suggest a general model for software architecture design that was derived from 5 other preexisting design approaches that were used within the industry. The article identifies that because software architecture design methods shares a basic problem that all these methods have much in common and can be derived, the basic problem being; “maintaining intellectual control over the design of software systems that: require involvement of and negotiation among multiple stakeholders; are often developed by large, distributed teams over extended periods of time; must address multiple possibly conflicting goals and concerns; and must be maintained for a long period of time.” Through this article I was introduced to 5 new design methods: Attribute-Driven Design, Siemens’ 4 views, RUP’s 4+1 views, Business architecture process and organization, and Architectural separation of concerns. This article also provide insight in the scale at which software architecture design is applicable. Whether large or small scale what remains is that there is a basic problem to be solved, and that it can be solved with an architecture design.

Below, I have included a link to the article where you can find the concluded derivations of the models. What stood out to me was the concept of workflow and backlogs. I was vaguely familiar with the idea of a back log from a previous CS course, Software Project Management. So, it is good to see that it can also be applied to architecture as well. On the idea of a workflow, I find that they offer notable insight into what is to be expected of someone in the industry.

It is important to follow through with a thought or question and to do that one must put in the work and find what you’re looking for yourself. When you don’t take action, you remain in that state of disconnect. This blog gives me an outlet to explore and I feel as though I am starting to reap the benefits of such a medium. It has allowed me to develop my own enthusiasm along with maintaining a vigilance for practicality.

https://d1wqtxts1xzle7.cloudfront.net/39793224/F9-ADMethods-HofmeisterJSS07-with-cover-page-v2.pdf?Expires=1667621789&Signature=TArjhgKXwq-QDqTf4Mcq2KsDpT93x-wPaeNtzpKxYdFsCWBgxd9Hu70e6Qy7yOnGRBpe4AJqrnozjy4enC5~niMz5AhxWYLEw3VJdjShD3jEUEPHDFO8qHGIPQCdyt-qa3U4t3vfi6bYlLej21j0nKexdpp40btwQ0W~wnRCQ1cPV8sdSu5PfqaGnj-CiFUEqelon6ovMcpWNBPw~BCzLScbrxFm60tC1Qm2M91ISU1jdtMakWktI8DZz8261Jp~0UIosYFKudJORu5fJiPcccCnXqL1d4dXx~TDPtSGQrHJ-cDIgH-IfjxQO7ii0aZiBDMzfZrbimivFfrsfBsRaQ__&Key-Pair-Id=APKAJLOHF5GGSLRBV4ZA

https://www.sciencedirect.com/science/article/abs/pii/S0164121206001634

From the blog CS@Worcester – Sovibol's Glass Case by Sovibol Keo and used with permission of the author. All other rights reserved by the author.

Week 8 – Law of Demeter

This article from InfoWars main goal is to explain the Law of Demeter, which is something that I have never heard about before this class. The basic premise of the Law Of Demeter is to ensure that classes and objects should never know the internal design and content of other classes. This promotes loose coupling and allowing code to be easily modified and changed in the future. First discussed in 1987 at Northeastern University, the law was developed to help software designers create code that can be understood and modified easily. This seems to be the main goal for most design laws. With more coupling, there is more confusion. The Law of Demeter will ensure that there is minimal complexity within code from restricting classes to have excess knowledge of the inner workings of other classes.

The main reason I selected this article for this weeks blog post was because it again showed some visual examples of code being used in the Law of Demeter, instead of just plain text. As I stated in another blog post, I enjoy seeing pieces of code that show the principle being used, and showing its violations. This article was also another free resource for many beginner coders to utilize to enhance and optimize their code. This is a concept I did not know about before taking this class. Reading the article, I connected the main points of the Law of Demeter to concepts we have learned in class, such as loose coupling. I’ve never realized that those small concepts we learned in class had much bigger implications in the world of software design, such as having a whole law dedicated to it.

In the future, knowing the Law of Demeter exists will help me make sure my code utilizes loose coupling, so that my code can be easily understood and ready by my co-workers on the project. Having code that is easy to read and understand is important when working in a team environment, as you can write something that you personally understand easily, but if a co-workers takes over your work, they are left in the dark as to what they are reading. This also promotes communication in the work environment, such as having standards for writing code so that everyone is on the same page when it comes to creating code, and allows for a more fluid and effective work environment.

Link: https://www.infoworld.com/article/3136224/demystifying-the-law-of-demeter-principle.html#:~:text=The%20Law%20of%20Demeter%20principle%20states%20that%20a%20module%20should,of%20other%20objects%20or%20components.

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

Software Solutions

As software designers and developers, we can often run into errors and issues during our development process. Design patterns however, provide a general reusable solution for the common problems that occur in software design. These patterns are known to typically show relationships between classes or objects. The overall idea is to speed up the development process by providing well tested, proven development/design paradigms. We can even use patterns in our own designs as it will only make our design more flexible, more resilient to change, and even easier to maintain. There are multiple different types of patterns that are extremely well known to designers and developers across the globe. These patterns are categorized into three different types, Creational, Structural, and Behavioral.

The Creational design patterns are all about object creation or class instantiation. The benefit of creational design patterns is that they enable a design to become more flexible and applying a creational pattern removes hard coded behavior or can move it into a higher level interface. Class creation uses inheritance in the instantiation process and defers creation to subclasses. Object creation uses delegation in the instantiation process and defers some of the creation to other objects. Some of the most common creational design patterns include the Factory Method, Abstract Factory, Builder, Prototype, and Singleton. Structural design patterns are a little different from the creational patterns, but they allow us to create large, flexible, and efficient structures. This pattern eases the design process by identifying a simple way to realize relationships. Some common types of Structural patterns may include, Adapter, Bridge, Composite, Flyweight, Proxy, and many more. More than often this design pattern will result in some form of abstraction and inheritance between two objects. Lastly, Behavioral design patterns is a pattern that strictly defines communication between objects, as well as classes. This pattern is solely for the purpose of increasing the flexibility of communication. There are many behavioral design patterns but some may include, Command, Iterator, Meditator, Memento, Observer, Strategy, and many more.

Design patterns are extremely useful and important to learn about as they can help accelerate the development process and help save time without needing to reinvent a new pattern every time a problem arises. They can especially be useful when you’re at the beginning of your journey as design patterns are a good starting point. Even if you won’t use them right away in your first projects, getting to know them will help you understand the existing solutions you’re using. The simplest and most complex solutions are all made up of different patterns.

https://jtearl188.medium.com/the-3-types-of-design-patterns-6138e353715b

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

REST API Design!

This week in CS-343 I’ve been getting familiar with REST APIs. This is not the only time I’ve had to use a REST API; I had to use them in my project last year for operating systems. REST APIS as explained in the stack overflow blog “Best Practices for REST API design” are one of the most common kinds of web services available today. It allows various clients including browser apps to communicate with a server via REST API. It’s important to design the REST API so that the client can properly and effectively communicate with the server.

First, what is a REST API? A REST API is an application programming interface that conforms to specified architectural constraints, like stateless communication and cacheable data. It is not a protocol or standard. REST APIs should accept JSON for request payload and response to JSON. JSON is the standard for transferring data. On another note, while transferring dates, I didn’t use JSON in my project, instead, I ended up using Curl. A curl is a command-line tool for transferring data, and it supports about 22 protocols, including HTTP.  It’s very good when testing REST services, but the blog and most sources I would say would recommend JSON for requests/responses. I was familiar with JSON files, it’s common, but now I understand why using JSON is the more optimal.

Endpoint paths are used to grab/modify whatever information you might want from the REST service. The most common ones are GET, POST, PUT, and DELETE. GET retrieves resources, POST submits new data to the server, PUT updates existing data, and DELETE removes date.  Creating routes are how we can use these endpoints. For example, let’s say that we have a route called article, POST /articles/ is for adding a new article, PUT /articles/:id is for updating the article with given id, DELETE /articles/:id is for deleting an existing article with given ID.

To avoid any confusion when an error occurs, we have HTTP response codes so that we can figure out the root of a problem, the common HTTP status codes include 400 Bad Request This means that client-side input fails validation. 401 Unauthorized – This means the user isn’t not authorized to access a resource. It usually returns when the user isn’t authenticated. 403 Forbidden – This means the user is authenticated, but it’s not allowed to access a resource.404 Not Found – This indicates that a resource is not found. 500 Internal server error – This is a generic server error. It probably shouldn’t be thrown explicitly. 502 Bad Gateway – This indicates an invalid response from an upstream server. 503 Service Unavailable – This indicates that something unexpected happened on server side (It can be anything like server overload, some parts of the system failed, etc.).

This doesn’t cover all the details of REST API but for the most part, this will get you a decent understanding of how it all works.

Link To “Best Practices for REST API design” : https://stackoverflow.blog/2020/03/02/best-practices-for-rest-api-design/

From the blog CS@Worcester – FindKelvin by Kelvin Nina and used with permission of the author. All other rights reserved by the author.