Category Archives: Blog

Design Patterns: Useful Tools for Structure & Organization

When I was first learning about programming and writing code, I never stopped to consider issues like effective layout, efficiency, or structure in my programs. At these early stages, it was enough for me that the code worked and ran without crashing. Now, as I have been studying design patterns in one of my University classes, I have seen the value that design patterns, and taking consideration to layout and structure can bring to a program.

I think that following a structure or a framework of some kind can definitely bring some much-needed order to what would previously have been organized solely by necessity and convenience. Without a design pattern, my code would often be organized based purely on instinct and whatever seemed easiest in relation to the particular functionality I was currently in the process of implementing, without taking into account the effects this would have on the rest of the project.

This brings me to an article I found relevant to the topic, a post from the personal blog of a software developer (https://madhuraoakblog.wordpress.com/2017/03/01/design-patterns-revisiting-gang-of-four/) which talks about each of the different Gang of Four design patterns, (of which I was surprised to learn there are a total of 23). This post goes into sufficient detail for each of the different design patterns, without inundating the reader with excessive information. The author provides a simple explanation of each of the design patterns originally presented in the book Design Patterns: Elements of Reusable Object Oriented Software. Many of these patterns were unfamiliar to me with the exception of the creational patterns and maybe half of the structural patterns, which I had worked with for class assignments prior.

Of these 23 design patterns, I want to highlight one specifically which stood out to me in terms of versatility and overall usefulness.

Bridge pattern

Photo by Pixabay on Pexels.com

The bridge pattern is used to separate an abstract class or method from the class implementing it, by using inheritance/hierarchies. The example given by the author is of an abstract feedback class, with two sub-classes: questionnaire and comment, with each utilizing the same variable reviewable which was previously defined by the parent class, thereby acting as a bridge to separate the sub-classes from each other (both can be changed without it having any effect on the other as a result of the separation). I think this concept is useful because it keeps sub-classes notably separate from each other, while allowing them to each retain important aspects from the parent abstract class, so you can have each subclass be completely different besides the bridge aspects of the program which link them together.

I can see this being especially useful in programs where there are large amounts of specific functionalities added on to more centralized base abstract classes which define boilerplate functions and basic attributes.

Overall, I think that the Bridge pattern will likely be useful to me in the future, and combined with another pattern like decorator could be used to build a program with highly specific sub-classes which elaborate on functionalities defined in a central base abstract class. I believe this combination would be helpful in building GUI style projects, word processing applications, or anything where high flexibility and customizability is warranted.

Post Referenced:

https://madhuraoakblog.wordpress.com/2017/03/01/design-patterns-revisiting-gang-of-four/

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

CSS Grid: A Better Layout System

Whenever I find myself working on a website, one of the more time-consuming aspects of development is often the CSS (cascading style sheet) code which controls the layout of the site. While CSS properties often have names which are self-explanatory the various formatting tools in CSS can oftentimes be confusing to me.

In the past, using the float property and various div classes to control different sections of the website was my go-to when building webpages for practice. This has since been proceeded by a number of new layout systems now baked into CSS functionalities as more recent versions of CSS have worked to better support modern web-development concepts. As I am looking to improve and modernize my web-development skills to prepare for contract work in the future, it was important that I start looking into the newer layout systems provided by CSS.

The newest layout system introduced by CSS, CSS Grid, is a fairly recent invention. I was looking for a good reference to introduce me to the idea, and I found a great resource on the website css-tricks.com (https://css-tricks.com/snippets/css/complete-guide-grid/), which focuses on providing relevant information regarding various CSS standards and techniques. The article provides a complete introduction to the idea of Grid, starting with it’s various properties (display: grid to begin using the layout, various grid-template properties and grid-column/grid-row to control the particular layout of content) and moving further to discuss more specific techniques associated with Grid. I felt that the information about defining gutters (spaces between grid items) was extremely helpful, as gutters vs. borders in web design has been a hard topic for me to wrap my head around for a while, and this page put it into a really easily-understandable format in my opinion.

CSS grid is absolutely what I would use for a modern website design if I were making a site for someone in 2020. Although there exist frameworks such as Bootstrap and Skeleton, a lot of the inner-workings of the page and its layout can be obstructed in a way, and I feel like Grid makes it easy enough to make a great layout without relying on an external framework. Keeping things simple in web-design has always made for a more manageable website in my experience. I would certainly recommend this article to anyone looking to explore CSS Grid as a layout option for a website, the plentiful examples and images make concepts easy to visualize, and the explanations provide a good level of information without seeming overwhelming to someone unfamiliar with the topic.

With CSS grid, I think web-development (in terms of front-end) has become much more accessible, and building a functional and aesthetically pleasing website has become far easier than in the past when reliance on outdated layout formats made things a lot more difficult.

Site Referenced: CSS-Tricks.com

Great resource for learning more about CSS grid!

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

Why I Prefer Object-Oriented Design

Object-oriented design is incredibly useful in my opinion. While there are also functional and procedural languages, I feel that languages which are primarily Object-oriented are the most exciting and useful for the types of projects which I enjoy. Topics such as game development, large-scale user interface focused applications such as Microsoft Word, and general programming can all benefit from an object oriented approach. While functional and procedural languages are certainly important and have legitimate uses, I would be unlikely to choose one for any large project.

I recently read a blog post on The Robert Half Blog, a blog which focuses on career advice and discussion of skills which employers look for. The post focuses on a quick overview of some reasons that object-oriented programming is useful and some of the aspects of object-oriented programs which make them easier to understand compared to code written with different paradigms.

Overall, the article focuses on features which are key to the concepts of object-oriented design. Modularity is discussed, and while I was already aware of the concept the post brings up an interesting point. The idea that the self-contained nature of object oriented code makes it easier for teams to work on many different projects at once, while minimizing the chances of duplicate code (since classes and objects are self contained, it is almost always clear what each one will do in terms of functionality).

Additionally, the topics of inheritance and polymorphism are discussed. While I have always been able to easily visualize the concept of inheritance (one concept extends from and inherits functionality from another), polymorphism has been confusing to me throughout my academic career. The author of the post uses a clear example which was very helpful in clarifying my understanding of polymorphism. An example “car” class is discussed, with “drive” function which controls driving in general for all types of cars which extend and inherit from the parent car class. Since all types of cars inherit the drive method from the superclass, they can call drive with their own information and variables, and the method has the ability to be adapted into many potential situations.

Finally, the post discusses the use of object oriented languages in problem solving. It is described as a “natural and pragmatic approach”, which accurately describes object oriented languages in my experience.

Although the information provided in this post is fairly general in the information it provides, the examples and concise explanations of a few concepts which were becoming unclear to me over time (it has been a while since I have been able to study and review modularity and polymorphism, polymorphism in particular has been especially confusing). The post provided a good review of these concepts, and I will likely attempt to introduce polymorphic methodologies into some of my projects in the future. In some circumstances I think a simple explanation can be more effective than something complicated.

https://www.roberthalf.com/blog/salaries-and-skills/4-advantages-of-object-oriented-programming

image from The Robert Half Blog, July 13, 2017

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

Welcome to My Blog

Software Development, Project Updates, Learning new Skills & Technologies

9/8/2020

With this blog, I will post updates for various projects I am working on, technologies and software that I find of particular interest, and general programming, technology, web development and game development topics, as well as information on things I am currently working on, including personal projects and practice in various languages and frameworks.

I hope to eventually replace this blog with a self-developed (non-wordpress) website as I continue to study web development topics and design.

What I’m Working On In September

– HTML, CSS, & JS (trying to update my skills with most recent HTML and CSS technologies and frameworks)
– Software Construction, Design & Architecture Course @WorcesterState (course at Worcester State University concerned with building and designing software, learning skills associated with software development)
– Building a Text-Based Java RPG (practicing object-oriented development skills, structure of a role-playing game, preparing for more complicated game development projects)

Progress on a Text-Based Java RPG game, basic framework for map structure, player and enemy classes, and game logic has been laid out. Currently working on saving player information to an external text file and outputting to a popup textbox instead of the IDE console.

Some CSS code I have been working on as part of an online tutorial. Also pictured are an HTML and javascript file which are part of the same project.

CSS, Javascript, and HTML code

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