Category Archives: CS-343

24.35.23

Whenever I played video games in the past, I would always be aware of a weird looking number, often resembling something along the lines of “1.2.3”. Even back then, I was aware that this number meant that I was using a certain version of a software; however, the idea of a value having multiple decimal points was perplexing to me. Upon doing some research, and performing a closer, more careful analysis behind the meaning of the number, I now understand why: this value is part of a system known as “SemVer” (Semantic Version).

SemVer is a special kind of number used to provide programmers and clients an awareness of a certain version of software. Basically, it is broken down into three different parts: MAJOR.MINOR.PATCH. A “MAJOR” number is incremented when code is added to a project that is not backwards compatible with previous versions. This kind of update will force users of the software to adapt in some way to the new changes.

On the other hand, a “MINOR” number is incremented upon creating (as the name implies) rather minor changes that do not result in breaking the program. All changes that result in a MINOR increment can work with previous versions of the software. Finally, the “PATCH” number receives an increment when very minor changes are made to a program. These changes often involve fixing bugs or other errors found within the MAJOR and MINOR releases.

Linked below is a YouTube video describing SemVer in detail, and it was made by a user known as “Inedo”; I chose this video simply because of the fact that it allows me to indulge in my favorite social media (YouTube) while also learning about SemVer. I guess I also chose this video in particular due to the fact that it is mainly audio; this is an easier video to play in the background as a “radio” during work than a normal video (which requires sitting down and paying attention).

Going forward, I plan on using my knowledge of SemVer for two purposes. First, when enjoying video games, I can now have a greater understanding of just how complete the product is (compared to when I was a kid). SemVer allows me to know just how much time and effort companies put into their software; while a higher SemVer number isn’t necessarily a hint of a better product, it does show that more time was dedicated to perfecting the craft. Second, I can use SemVer in my own coding adventures. Instead of making one program and being done with it, I can now create different versions of the product (for example, version 1.0.0). This knowledge will be especially useful when combined with collaborative software tools such as git and Scrum.

Note: The numbers in the title are NOT random. See if you can figure out what it means!

Link: https://www.youtube.com/watch?v=Si3eWq1yHXs

From the blog CS@Worcester – mpekim.code by Mike Morley (mpekim) and used with permission of the author. All other rights reserved by the author.

Docker

In class, for our activities and homework, the professor told us to download Visual Studio Code and Docker that we were going to use for the semester. I did not know what Docker was and what its purpose was going to be in this class. I was interested in learning more about Docker and why it is such a professional tool in software development.

In software, Docker is an open platform for developing, shipping, and running applications. It enables us to separate our applications from our infrastructure so we can deliver the software quickly. It is a set of platforms as a service product that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-designed.

In a way, Docker is a bit like a virtual machine. But unlike a virtual machine, rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they’re running on and only requires applications be shipped with things not already running on the host computer.

And importantly, Docker is open source. This means that anyone can contribute to Docker and extend it to meet their own needs if they need additional features that aren’t available out of the box.

I chose this article because I was curious about Docker and wanted to know more about it. So, from all the sources that I could have found, this one has all the details about docker, docker containers, how needed it is in software development, and why it is so desired in companies.

Now that we know what Docker is, let’s understand why it is used and needed for software. Docker streamlines the development lifecycle by allowing developers to work using local standardized environments, using local containers which provide our applications and services.

I think one of the reasons Docker is important, is that it can get more applications running on the same hardware than other technologies, and makes it easier to package and ship programs, which is a high potential. Companies use Docker a lot in software where they do a lot of programming and applications because it makes the work easier and more portable.

As a computer science major, what I understood about Docker even though I have never used it, it’s a great platform when it comes to running applications and can do many of them at the same time. I am still getting used to it with the activities that we do in class and love to see how it works and its roles.

Docker containers, images, and registries | Microsoft Docs

From the blog CS@Worcester – Gracia's Blog (Computer Science Major) by gkitenge and used with permission of the author. All other rights reserved by the author.

Looking at the Interpreter Pattern

“Interpreter Pattern – Spring Framework Guru”

The above article describes in detail how the Interpreter pattern from the gang of four book works. Before I continue, I should specify that the book, this post and the above article are focused on the Interpreter pattern primarily in terms of object oriented programming, which is not the only way that the general concept may be applied. There is the general idea, which is creating a small, limited language inside of a program, and then there is the gang of four specification, which includes more specific implementation details. For example, it mentions regular expressions, which do not necessarily have to be written in an object oriented way.

I sort of understood what the interpreter pattern was in a broad sense, but not in the specific technical sense one needs to actually make use of it. For example, I didn’t know that it employed the use of another pattern, called the Composite pattern. The Composite pattern is essentially the idea of treating individual objects and compositions of objects uniformly by representing them as a tree. The Interpreter pattern uses the Composite pattern in order to represent an expression to be interpreted. It does this by representing the components of the expression as atomic expressions arranged in a tree called an “abstract syntax tree,” and then expressing the language by recursively processing each node in it. The components of this expression may be either non-terminal or terminal, representing operations with and without operands, respectively (for example, a multiplication versus a constant). The pattern also specifies a “context,” which represents string data that is parsed, and a “client,” which actually parses the expression.

This pattern may be useful in a case where I want to create a smaller, more focused programming language inside of a project for use by less technically oriented people. Specific potential use cases like this include a language for writing plugins in an art program or a simplified language for directing game behavior inside of a game engine like GameMaker’s GML. Other, more common examples include SQL parsing and, as was mentioned previously, regular expressions.

At its core, the Interpreter pattern is essentially about converting instructions from one language to another, much like how a language interpreter interprets ideas from one language to another. “Interpreted” languages such as Python can be seen as an instance of this idea, using an interpreter to convert Python expressions into work by the computer. In the same way, you might also view a C compiler as an interpreter that converts C instructions to machine instructions.

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

Self-Directed Professional Development Post #6

For this week’s blog post, I’ve decided to continue watching the video I started in my professional development post #4, “Object Oriented Design Tutorial: Creating a UML Design from Scratch” and start the next video in this series titled, “Object Oriented Design Tutorial 2: How to Turn a UML Design into Code” by Derek Banas. The reason I picked this video is because 1. it directly relates to one of our course topics, “Modeling: Unified Modeling Language (UML)” and 2. because it teaches a methodical process to creating UML diagrams and the code that goes with it. Since I will likely be making more UML diagrams in my educational/professional life, I want to further develop these skills. In my last post, I learned how to use a Use Case Description to create an Object Model and a Sequence Diagram. In this post, I will start by discussing how an Object Model and the Sequence Diagram is used to create a Class Diagram. I will then move on to discussing how these models and diagrams can be used to create Java code.

When Derek is creating his Class Diagram, he uses his Object Model to create the class name and the data fields of his classes. Derek then uses his sequence diagram to bring in the methods for each of the classes he creates. One thing that I thought was interesting as he brought in the methods for his Class Diagram was that he added an additional method that he did not include in his logic when creating his sequence diagram. He added a getCoinOption method and stated that he may not end up needing this method but will include it just in case he missed something with his logic. It is nice to know that using his approach allows me to make these kinds of edits on the fly.

In Derek’s next video, he uses his class diagram to lay out the data fields and methods in his IDE. Once he has outlined his program, he uses the sequence diagram to write his code. Derek starts with the coin class. In this class he mentions how he starts with what makes the most sense to him to get his code to work. He mentions once his code works, he can come back and worry about optimization. He uses an array that contains heads or tails for the coin value and Math.random to return the value of the coin flip. Observing this process was beneficial because it showed me how important it is to think of the data structures I will be working with and the operations that I want to perform.

Overall, I’m very happy with this series. One of the things I enjoy the most is that Derek is doing all this from scratch so we get to see any obstacles that come up along the way. I’m looking forward to seeing his working program at the end.

Tutorial links:

  1. https://www.youtube.com/watch?v=fJW65Wo7IHI&list=PLGLfVvz_LVvS5P7khyR4xDp7T9lCk9PgE&index=3
  2. https://www.youtube.com/watch?v=1BVXQ64wI00&list=PLGLfVvz_LVvS5P7khyR4xDp7T9lCk9PgE&index=2

From the blog Sensinci's Blog by Sensinci's Blog and used with permission of the author. All other rights reserved by the author.

Interface vs Abstract class vs Concrete class

Summary:

As a programmer, java is all about classes and there are design patterns that we must follow, and it is our duty to question them. Java is an object orientated programming language where we have the ability to write our code in the form of reusable classes. Code re-usability doesn’t start by creating objects out of classes, it starts way before that when we are creating the classes itself. The class types that we have available to us are Interface, Abstract, and Concrete classes.

Reason:

The reason why I chose this article was because I thought this article would help us understand why we us certain classes and when to use them. In class we have gone over different design patterns where the uses of every class are different depending on what we want to achieve. I believe that it is important to fully understand how they each function as it will make understanding the design patterns much easier.

What I’ve Learned:

Interfaces are a blueprint for your class that can be used to implement a class and an interface cannot have any concrete methods. What your interface can have are static members and method signatures. All methods that you declare in an interface can have static, default or abstract modifiers. Abstract methods cannot have a body; all they can have is a method signature. Variables are not allowed in interface. Hence any data declaration is public static final. Interfaces can extend other interfaces (one or more) but not classes (abstract or not). Interfaces cannot be instantiated as they are not concrete classes. Methods and constants cannot be declared private, methods cannot be declared final.

Abstract classes are a bit different from interfaces. These are also used to create blueprints for concrete classes but abstract classes may have implemented methods. Abstract classes can implement one or more interfaces and can extend one abstract class at most. A class can be an abstract class without having any methods inside it. But if it has any methods inside it, it must have at least one abstract method. This rule does not apply to static methods. As abstract classes can have both abstract and non abstract methods. Static members are allowed. Abstract classes can extend other at most one abstract or concrete class and implement several interfaces. Any class that does not implement all the abstract methods of it’s super class has to be an abstract class itself.

Concrete classes are the usual stuff that every java programmer has come across for sure. It is like the final implementation of a blueprint in case you are extending it some abstract super class. A concrete class is complete in itself and can extend and can be extended by any class. The only condition is that all the methods have to be implemented in order for it to qualify as a concrete class.

From the blog CS@Worcester – Life as a CS Student by Dylan Nguyen and used with permission of the author. All other rights reserved by the author.

Code Smells

https://jserd.springeropen.com/articles/10.1186/s40411-017-0041-1

A code smell is used to see or detect issues in code. There are many tools used by different developers in order to make the detection of code smells easier and faster. Aswell as being used to detect more general issues in code developers can also use code smells to help them know when refactoring of code would be beneficial. Code smells most frequently represent issues with maintainability (future or present) or comprehensibility if a developer refactors their code these issues will either take a much smaller form or they can be non-existent.

This article focuses on three of the many code smells and what each of them mean. One code smell outlined in this article is the “God class” code smell, this code smell tells the developer that class contains too much code/information or that the methods inside of the class are used to do too much. Which as the article says violates the “single responsibility principle”. The “God Method” code smell is described as when a method is assigned too much functionality which makes it hard to maintain. This code smell also “tends to centralize the functionality of a subsystem” according to the article. Lastly “Feature Envy is a code smell which shows that a method is more influenced or interested in a class other than its own.

The three code smells outlined in the article are some of the most frequently detected and can be detected without using a specific code smell detection tool. Some well known detection tools listed by the author are “inFusion, JDeodorant, PMD and JSpIRIT” all four of these tools are free or can be used on a trial. All four tools can be used to analyze Java and are known to at least detect the three code smells from the article. But other tools can be used or be more effective depending on the language you use to code or the code smell present in the code.

I chose this source (article) as it is easy to follow but also relatively in depth about the general definition of code smells as well as giving a list of tools used for code smell detection which other students as well as myself could find helpful in future classes or the professional world. This article showed me what tools I should be using to detect code smells in my own code and the reason as to why code smells are important to address/fix by way of refactoring and I plan on using this article or reflecting back to it when I need to find a tool for detecting code smells in the future.

From the blog CS@Worcester – Dylan Brown Computer Science by dylanbrowncs and used with permission of the author. All other rights reserved by the author.

“Encapsulate what varies.”

“Find what changes and encapsulate it.”-  This is a different approach from the redesign approach. In simpler words, we are able to consider what we want to change without redesigning, rather than thinking about who might force a change in design.

This principle of encapsulating makes it possible for nothing to affect the rest of your code.

Encapsulation can be found everywhere!

When we turn the steering wheel and the car wheels rotate, we see that there is a variety of moving parts that work together to transform our action into the final effect that the car wheels have, but all these details are encapsulated by us. But this example can never be confused with abstraction. Because they are simply similar and can be true. Just like in the real world but also in the world of Software we have various examples of encapsulation but also of Abstraction that interact together. These are two concepts that are different but that are also related to each other, and that in most cases work together.

The moment we include anything that has the potential for change, we are dealing with time savings. In general, encapsulation has to do with objects which in a way make possible the merging of attributes but also of the methods they have, for the sole reason that they do not have an impact on other objects they have. But it works differently in cases when we are dealing with the design of a program which is mostly object-oriented. This is because the requirements that may most likely change in the future, need to be more concise for one reason only: that the change is likely to occur at the time it is requested. The volume of the code is changed by the summary which minimizes the volume of the code, and which may need to be changed in the future.

When we see that this principle is particularly relevant to the code which changes very often, we are dealing with the benefit of encapsulating the code, regardless of the frequency of the code change. Like what:

The code that is encapsulated has the possibility of reasoning to be separate from the code

  • To prevent conjugation summarized with the implementation of the code which is encapsulated, such as when summarizing when the interaction of a downstream system. At this point this replacement is even easier.
  • -Other developers can understand from the encapsulation constants, that they are sufficiently connected and have control security in case they have changed or even the way it has changed.

References:

https://genderi.org/encapsulate-what-varies.html

https://alexkondov.com/encapsulate-what-varies/

From the blog CS@worcester – Xhulja's Blogs by xmurati and used with permission of the author. All other rights reserved by the author.

Command Line

Command-Line is essential to developers and I think every developer should master this skill. In my point of view, the command line is quicker than a regular click which saves developers much time along with effort, and the command line is one of the best tools at our disposal. Recently, I have had more opportunities to practice command-line while learning about Docker. It comes to my sense that using CLI fastens the Docker process than the original clicking method.
Knowing CLI gives you better accessibility to control the system. You can only access these kinds of commands via the shell on Unix/Linux and Power-shell on Windows. The basic commands only involve changing the directory, creating new files, and editing text files. The more advanced techniques could involve managing database systems like Apache/SQL. And elite users could use the command-line to do test penetrating to expose security vulnerabilities.
Developers spend an amount of time in Command Line Interface to execute codes or to run packages. Two essential programs are git and brew was designed exclusively for CLI though there is a way to use it without CLI interference, this is still much quicker and easier to use and work with the code base in it. CLI also allows us to do manipulations with your system internals. It offers better flexibility and control than regular GUI.
Front-end and back-end developers are better off with CLI. Since back-end developers will be dealing with servers, configuration files, and making sure the code for your site is working. Front-end developers don’t need as many CLI skill sets as back-end but knowing CLI serves them .better in the long run. After all, both developers use git and git functional based on CLI.
Talking about the bad stuff, CLI in Linux is popular among penetrating testers, meanwhile, hackers love CLI because of its flexibility. Using CLI to run Nmap to expose vulnerability is a powerful tool. It allows us to scan the network and discover not only everything that is connected to it but also much sensitive information. Besides Nmap is Metasploit, another powerful tool for penetrating testing. The problem with Metasploit is it makes hacking simple than it used to be. Nmap and Metasploit are two powerful for testers and developers and to people who use Linux, these are essentials, not necessarily for regular Linux users.
To summarize, the main advantage of using CLI is if you know the commands, CLI could be faster and efficient than other operations. It can handle repetitive tasks easily and CLI requires less memory than other interfaces.

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

The Strategy Design Pattern

Christian Shadis, 10/20/2021

In the blog post “Strategy Design Pattern in Python”, Giridhar Talla defines and discusses the Strategy Design Pattern first in a broader object-oriented approach, but then directly with Python implementation. Talla uses the Gang of Four’s definition of the Strategy Design Pattern to first create an abstract implementation of the design pattern, and then using a more concrete example to show the pattern in use. He also includes a UML diagram visualizing the design pattern.

The strategy design pattern was a topic of focus for my CS-343: Software Construction, Design, & Architecture class. We examined the pattern using a simple example in Java called DuckSimulator, which had different Quack and Fly strategies. While the value of the pattern was immediately evident, the concept of the pattern itself still confused me, especially when attempting to implement the design in Java for homework. I chose to study and write about this blog post because it took a straightforward approach like the in-class activity, but it is implemented in Python instead of Java. I decided that the best way to understand the abstract nature of the strategy design pattern was to consider its implementation in other object-oriented languages.

I found the blog post both informative and direct – Talla’s language is easy to follow, and his code snippets are clear and concise. What I found simultaneously helpful and confusing was his abstract implementation of the pattern using not a real-world example, but simply by creating Context and Strategy classes. This made it helpful to see exactly how each component interacts with one another without getting caught up in or confused trying to figure out what part of the example represents a strategy or a context. This abstract code chunk is a solid foundation for building a python script using the design pattern if you it to your specific real-world example.

The article did supplement my understanding of the design pattern by adding extra abstraction. On the other hand, however, I still find myself confused trying to implement the pattern in Java. Because of this, I plan to continue reading about the pattern and practicing implementing it. The code I write is often very dependent on using if/else branches to run algorithms differently based on object attributes, which is a problem this design pattern can mitigate. I plan to read the original Gang of Four chapter on the Strategy Design Pattern to further increase my understanding because being able to implement this pattern will greatly improve the efficiency of programs the pattern would work with.

Source: https://auth0.com/blog/strategy-design-pattern-in-python/

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

Back to the Basics: Inheritance Vs. Abstraction

When it comes to coding in Java, Interfaces and Abstract classes may be referred as a part of the basics. These are concepts you must understand to pursue the coding of Data Structures. That being said, just because you are able to code Interfaces and Abstract classes, doesn’t exactly mean you understand it completely. Just because a Code compiles without error, does not mean there aren’t mistakes in the code. It also does not mean these concepts were implemented correctly. Although these are basic concepts, it does not mean they will not appear in a future interview. You will know you have a confident understanding when you can explain these concepts through word of mouth without referring to a cheat sheet.

Since I believe this question will come up in any Software Development Interview, I decided it would be a good idea to write about it and attempt to concrete these ideas in my mind. If I were to put a key difference between Inheritance and Abstraction, I would say that Interfaces are to Standardize, and Abstraction is to Generalize. With an Interface, you are creating a methodology of creating a new class. Your interface will create standard properties and methods which can be reused in an existing class. It helps to improve code reusability. While your abstract class is a concept that hides implementation details and shows only the functionality to the user. Meaning it defines the code identity of a class. It is used for objects of the same type. While an Interface only defines peripheral abilities of a class, it only provides a signature and not any code. Abstraction is meant to help reduce the complexity of the code.

To nail the interview question, start with the largest differences and work your way down to the more subtle ones. Abstract classes can only extend one Interface while an Interface can extend several Interfaces. You can define fields in Abstract classes while you cannot in interfaces. Abstract classes work at a faster speed. You use Abstraction to avoid independence. While you use Interfaces for future enhancement. Abstract classes contain Data Members and Constructors while a Interface does not. An Interface cannot have access modifiers, everything is public by default.

To further educate myself, I found a great Youtuber of the name Gabriel Zimmermann. Who is actually does interviews at his Software Company. He gives a great video on how to answer this question if it comes up in your interview. As well as a detailed explanation of this topic to help someone learn for themselves!

https://www.youtube.com/watch?v=Lnqmde9LP74

Andrew Sychtysz

10/19/2021

From the blog CS@Worcester – Andrew Sychtysz Software Developer by Andrew Sychtysz and used with permission of the author. All other rights reserved by the author.