Category Archives: CS-343

Anti-Patterns

In addition to learning about design patterns that should be referenced when programming, I wanted to learn about bad software design, which led me to anti-patterns.

A wonderful source covering anti-patterns that I learned from can be found at: https://www.freecodecamp.org/news/antipatterns-to-avoid-in-code/.

Anti-patterns are bad software designs that show how not to solve problems in programming. The source covers 6 different anti-patterns: Spaghetti Code, Golden Hammer, Boat Anchor, Dead Code, Proliferation of Code, and the God Object.

Spaghetti Code is when there is barely any structure to the code. Files are thrown in random directories and it is difficult to follow the flow of the program. This would produce many issues when needing to modify the code, because the program can break and it would be difficult to tell what caused it. It would also be difficult to estimate what may break after you make a change.

Golden Hammer is when you repeatedly use an architectural approach in your code that does not exactly fit the program you are making. Despite the fact that it doesn’t exactly fit the program, it is still utilized because it gets the job done eventually. Problems arise from the fact that it does not fit the program, and can cause longer runtimes.

Boat Anchor is when programmers leave code in the codebase that has no purpose at the moment, and is kept incase it is needed in the future. This code acts as an anchor because it holds the program back– it increases build time, and can make code reading difficult when programmers have to discern between code used and the code saved for later.

Dead Code is when programmers cannot tell which parts of code are currently necessary for the program and which parts of code are no longer needed.

Proliferation of Code is when objects in your codebase only serve to create a more important object. This makes the code more difficult to follow.

God Objects are objects that have too many responsibilities. The code should be broken down more so that objects do not have to undergo functions that other, smaller bits of code can cover.

The Boat Anchor anti-pattern reminded me of YAGNI (“You aren’t gonna need it”). YAGNI is the principle that you should not add functionality to the program until it is actually needed. Adding the functionality in advance may end up messing with schedules and requirements may be changed in the future where that functionality is not even needed. The God Object anti-pattern reminded me of the single-responsibility principle (which the article briefly mentions). These anti-patterns will be very useful to apply to my code to prevent the program from being too complex and hard to follow.

From the blog CS@Worcester – CS With Sarah by Sarah T and used with permission of the author. All other rights reserved by the author.

DESIGN PRINCIPLE

DESIGN PATTERNS.

Design patterns provide a comprehensive solution that can be reused for common problems that arise in software design. A design pattern isn’t a complete design that can be transformed directly into code.

Types of Design Patterns:

  • Creational Design Patterns
    Creational Patterns deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. They reduce complexity and instability by creating objects in a controlled manner.

Types of CDP:

  1. Abstract Factory

Creates families of related dependent objects.

Constructs complex objects using step-by-step approach.

 Creates an instance of several derived classes.

 Creates a new object from an existing object.

A class of which only a single instance can exist.

  • Structural Design Pattern

These design patterns are concerned with arranging different classes and objects to create larger structures and provide new functionality. Structural class-creation patterns use inheritance to create interactions/interfaces.

Types of SDP:

  1. Adapter

Allows for two incompatible classes to work together by wrapping an interface around one of the existing classes.

Separates the outline so that the two classes can differ on their own.

Composite patternconsider a group of objects to be one.

  • Decorator
    Allows for an object’s behavior to be extended dynamically at run time.
  • Facade

Provides a simple interface to a more complex underlying object.

Flyweight pattern takes the weight, or memory footprint, off of our objects by recycling them.

This pattern offers a proxy, or a substitute, to another complex object. Provides a space interface for the primary object to control access, reduce costs, or reduce complexity.

  • Behavioral Design Patterns

Behavioral patterns are about identifying common patterns of communication between objects and identifying these patterns.

Types of BDP:

  1. Chain of Responsibility.

Delegates commands to a chain of processing objects.

Creates objects which encapsulate actions and parameters.

Implements a specific language.

It accesses the elements of an object in sequence without revealing its basic representation.

Allows for free integration between classes as it is the only class that has in-depth knowledge of their methods.

Provides the ability to restore an object to its previous state.

 Is a publish/subscription pattern that allows a number of observer objects to see an event.

Allows an object to change its behavior when its internal state changes.

Allows one of a family of algorithms to be selected on-the-fly at run-time.

  1. Template Method.

Defines the framework of the algorithm as an abstract class, allowing its sub-classes to deliver consistent behavior.

  1. Visitor.

Separates an algorithm from an object structure by moving the hierarchy of methods to a single object.

REFERENCE

  1. https://www.geeksforgeeks.org/design-patterns-set-1-introduction/
  2. https://sourcemaking.com/design_patterns

From the blog CS@Worcester – THE SOLID by isaacstephencs and used with permission of the author. All other rights reserved by the author.

YAGNI

What is YAGNI?

YAGNI – You aren’t gonna need it is an Extreme Programming (XP) key practice that’s states: “Always implement things when you actually need them, never when you just foresee that you need them.”As it stated then programmer should not add functionality until it is proven to be absolutely necessary

YAGNI Principle always recommends programmers to build the easiest solution to today’s problems. Even if you are sure you will need the feature, moreover, do not run it now. Mostly, it’ll alter in either:

  1. You won’t need it after all, or
  2. What you really need is different from what you originally thought.

Why YAGNI Principle is mostly relevant in Software Development Lifecycle than others?

In Software Development when software developers start implementing features they always go into practices known as FEATURE CREEP. Software developers always try to add or improve features regardless of whether they are not requested by users. For example, developers may try to add authentication to the form without first completing CRUD in the database.

Alternatively, following YAGNI in the configuration life cycle enables developers to implement features that will only be relevant for the first duplicate or demo and other future features that will work as a new version or update of software developed as recommended by users.

YAGNI Principle is safe, if …

The YAGNI principle, alone, may not be secure. Software developers can set up an early algorithm on the system and then copy-paste it all over, so when it goes wrong they spend a lot of effort fixing it. With this process in coding, YAGNI is very dangerous and may not be the best idea.

But when the developers set the quality of the design, the quality of the code, and the quality of the test, YAGNI is completely safe, as every future risk is excluded by simple design rules, and it will be easy to find and fix if it goes wrong.

Benefits of YAGNI:

  • With a simple answer you can say the biggest benefit of the YAGNI Principle is to avoid unnecessary development.

Main reasons to practice YAGNI

1. It saves time as you avoid writing code that may not make sense later.

2. Your current code is better because you avoid guessing which can be bad

For two main reasons for practice, they ensure:

• That deadlines are available quickly,

• Customer satisfaction due to visible and frequent changes according to their needs or details,

• The best quality of code ordered by the fact that developers focus on small tasks (those that are currently very important),

• The code can be extended more and more (allows for updated versions),

• Reduced number of adjustments required,

• That the error is easy to fix.

REFERENCE: – 

https://deviq.com/principles/yagni

From the blog CS@Worcester – THE SOLID by isaacstephencs and used with permission of the author. All other rights reserved by the author.

Resume’s For Software Engineers

https://www.hackreactor.com/blog/6-tips-for-a-software-engineer-resume-that-gets-you-hired

In order to use the skills we are using in class in a professional capacity. students need to land a job as a Software Engineer. The first step in this process is sending a resume to a potential employer. There are some good resources out there online, and on campus about resume building. And that is a great place to start. But this article focuses on Software resume’s in particular. A Software Engineer resume should be broken into experience, education, skills, and projects.

One important part of any resume is a job history. In the case of new developers it may not be necessary to give a long, detailed employment history. This is because not all of applicant’s past jobs are related to software development. In my case. I have one internship. And I list two unrelated jobs. But I don’t go into detail of the unrelated job responsibilities. A unique part of a software resume is a project section. This is important for new engineers that do not have an extensive software job history. Employers like to see personal projects because personal projects show the employer that the applicant is passionate about building software. The education piece of the resume is fairly straight forward. The applicant should just write down their university, area of study, and GPA (assuming the GPA is reasonably impressive). The skills section is also straight forward. The applicant should list programming languages, frameworks, and other tools they have used in internships, classes, and personal projects. I personally do not include “fluff” skills like attention to detail, written and verabal communication, etc.

Another helpful tip is to consider ATS software. ATS stands for Applicant Tracking Software. This is an AI that looks for keywords and send resumes that match those keywords to recruiters at the comany. The author recommends using a simple format, and not including impages or tables in the resume that could trip up the ATS. Applicants can identify keywords used by the ATS in the job posting. A resume that has keywords from the posting is more likely to be seen by a recruiter. This leads to the final tip. Applicants should tailor their resume to the job posting using the skills and wording from the job posting. This can be time consuming, but in my opinion this is worth the extra time. One thing that I would add is that I don’t add skills that I don’t actually have. If I make it to the interview by adding skills that I don’t actually have. The interviewer will ask me about those skills, and will quickly learn that I was not honest. This article was very helpful for me. And I hope that some of you find my summary and opinion helpful in your respective job searches.

From the blog CS@Worcester – Jim Spisto by jspisto and used with permission of the author. All other rights reserved by the author.

Software Construction Log #7 – Utilizing Docker-Compose YAML files

            Although I dedicated my previous post to introducing REST and RESTful API writing, I feel that it is important to briefly return to talking more about Docker, given how much I have come to using Docker containers for a significant part of my studies recently. In this blog, I have talked about containerization as a concept overall and not exclusive to Docker, as well as some of the things that can be done when using Docker. Namely, I discussed data management through use of volumes and mounts and container networking through port mapping. Such  features can be rather straightforward and easy to use individually and with enough practice during application development, however as development becomes more complex and demanding, having to repeatedly run commands to enable further functionality can be rather cumbersome for individual developers and overwhelming for the entire development team overall. This is not exclusive to Docker; certain utilities or commands used in development that are used especially frequently may overcomplicate the development process. Thus, often, a certain degree of automation or simplification is needed.

In my experience, I have used scriptwriting in order to speed up parts of my development process. In Docker, where it is possible to have to manage multi-container applications at once, having to manually define ports and volumes for each service individually can be extremely inconvenient for complex application development. Therefore, docker-compose YAML files  are often utilized to manage multiple services, volumes, and networks at once and in a more organized manner. Though a docker-compose file is not exactly a script file when it comes to defining container services, they can still help condense the entire process to create a service into one file. Moreover, to utilize a Docker container for application development, a docker-compose YAML file is not enough, as a Dockerfile is also needed in order to build the container’s image. However, for simplicity, I will only focus on the compose file.

Like I mentioned, a compose file is not necessarily a script file, not at least from my experience of writing script files. Despite this, there is a certain structure that needs to be followed when writing docker-compose files in order to ensure the proper functionality of the application. One resource that I found in my research regarding writing docker-compose files is an article named Introduction to Docker Compose posted on Baeldung.Com by Andrea Ligios. In this article, Ligios begins by briefly introducing the theory YAML configuration files and why using such a configuration file is preferable for development. Moreover, they proceed to illustrate the basic structure of a docker-compose file by highlighting the services, volumes, and networks to be used for the multi-container application, before they go into further detail on how to set up each of the previously mentioned sections and provide examples.

While it is important to understand how each part of a docker-compose configuration works individually, when it comes to larger-scale development and deployment, simplifying the process through use of docker-compose files can be extremely helpful.

Direct link to the resource referenced in the post: https://www.baeldung.com/ops/docker-compose

Recommended materials/resources reviewed related to :
1) https://www.tutorialspoint.com/docker/docker_compose.htm
2) https://docs.docker.com/compose/
3) https://dockerlabs.collabnix.com/beginners/difference-compose-dockerfile.html
4) https://phoenixnap.com/kb/docker-compose
5) https://runnable.com/docker/docker-compose-networking

From the blog CS@Worcester – CompSci Log by sohoda and used with permission of the author. All other rights reserved by the author.

Frontend vs. Backend

This week will be continued talk on APIs and specifically I wanted to learn more about the structure of our API’s including on the differences between frontend and backend and any extra information on API’s that can be included. I have chosen a website that goes over what exactly these are and gives a good amount of information that could be useful later down in our careers.

In summary, frontend and backend are two very popular terms in web development. The term frontend is usually used for the part of the website that the user directly interacts with like the GUI’s. This is also called the “client side” of the application and use languages that should sound familiar to you such as HTML, CSS, and JavaScript with JavaScript being the most popular language of them all. This is because of several advantages such as flexibility, speed, and extended functionality although it does have some disadvantages in areas such as with debugging. Now if the frontend is what the user interacts with, the the backend should be everything that is kept out of sight from the user such as work with the databases, the scripting, and the API itself while making sure it can connect to the frontend. The languages used include python, PHP, and java all being widely used. The work on the frontend and backend has also become quite specialized over the years in which it is usual for one person to either work with just the frontend or just the backend and people who work on both are called full stack developers.

This resource has given me insight on the work we are doing with the API’s and with the work we are doing on the backend. The work that we are doing with the databases and the API’s is an entirely different area from the frontend that we haven’t even touched yet. The areas that have to be learned are numerous that require different sets of skills and talents to work in. It makes me wonder on whether we will get to work with the frontend in this class or in a future class. The I should prepare myself a bit more if one would want to become a full stack web developer seeing the needed skills in both ends. Although I haven’t done much work on any frontend material so I would have to wait to see on what the experience is like when working on the frontend on deciding if I should focus on one or another in the future.

Source:https://www.interviewbit.com/blog/difference-between-frontend-and-backend/

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

Front end/Back end: Difference

The front end of a website or application refers to the visual elements that users see and interact with. Front-end development, therefore, refers to the programming and management of the front end of a website or application to provide users with a rich interactive experience. They need to create a website’s entire interface and user experience, as well as its design and overall look. They usually work with HTML, JavaScript, and CSS languages to create a basic layout of the website and then add various visual elements to improve its esthetic quality.

Some performed tasks for a front-end developer include:

  1. Creating rough concepts and using HTML, CSS, and JavaScript to materialize them.
  2. Adapting a website’s design to look and function properly on mobile devices
  3. Optimizing the user’s experience on a website and making sure it’s not interrupted by any design or functionality issues.
  4. Developing an easy-to-use and intuitive user interface and gradually improving it based on user feedback
  5. Constantly testing the website’s front end for ease of use and potential errors and optimizing it to ensure a smoother user experience
  6. etc…

Back-end development refers to creating and ensuring the well-running of a website’s internal operations, which are hosted by a server. A website’s back-end is its server, application, and database, so a back-end developer focuses on setting up and maintaining databases, scripts, and the overall website architecture. 

The tasks of a back end developer include:

  1. Understanding what the website’s main objectives are and finding various ways to facilitate them
  2. Making sure that data is properly stored and that users who want to access it can do so quickly and easily
  3. Managing application programming interfaces and making sure they work across devices
  4. Organizing a website system’s logic and optimizing it to run properly on multiple devices
  5. Creating website architecture that can easily be modified with future upgrades
  6. etc…

What are some differences between front end and back end development:

  1. The front end refers to the graphical user interface required for navigating a website, including its overall layout, videos, images, text, buttons and every other visual element, whereas the back end solely refers to the way the website should function.
  2. Back-end development typically focuses on the application of logic to solve various functionality and user experience issues, while front-end development focuses on making the website look good and provide a positive user experience.
  3. Front-end development collects user input, while back-end development processes user inputs.
  4. Issues like search engine optimization and user accessibility are handled by front-end developers, while those related to the website’s security and backup are the responsibility of back-end developers.

I chose this topic because I was curious to learn more about the front end and back end and their importance in software development. Being a computer science major, and doing both concentrations, this is important information I need to know to be a good programmer. and develop my computer skills

Back-End vs. Front-End vs. Full-Stack Development: What’s the Difference? | Indeed.comWhat are front end and back end? Definition from WhatIs.com (techtarget.com)

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

SOLID

Resource Link: https://www.digitalocean.com/community/conceptual_articles/s-o-l-i-d-the-first-five-principles-of-object-oriented-design#single-responsibility-principle

For this blog post, I wanted to delve into what the SOLID principles are and how they apply to object oriented programming. SOLID is an acronym for the 5 object oriented design principles. They are the single-responsibility principle, the open-closed principle, the Liskov substitution principle, the interface segregation principle, and the dependency inversion principle. The reason these principles are important, and why they’re important to use is that they help to maintain good coding practices and help to avoid code smells. This is essential in large projects, as code smells and bad design could increase development time, make refactoring harder, and make development harder for teams if other team members couldn’t understand the code.

The first principle of SOLID is the Single-Responsibility Principle. It states that a class should have only one reason to change, and that it should have only one job. This means that a class should only have code related to its function, and not extraneous code that should be elsewhere that’s unrelated to the class’s intended purpose. This helps to keep classes simple and easy to understand. If a class contained logic unrelated to its purpose, then it would make the intended purpose of the class confusing.

The second principle of SOLID is the Open-Closed Principle. It states that a class should be open for extension but closed for modification. This means that a class should be designed in such a way that if a modification to that class is needed, it can instead be extended by a different class, and then that class could be modified while maintain the functionality of the original class. The also helps the make each class have its own specific purpose. If instead of creating a new class, a single class was modified every time a modification was needed, then the class would get messy very fast, making it hard to read and hard to understand its functionality.

Next, the Liskov Substitution principle states that every subclass that extends another class should be substitutable for the parent class. This means that for example, if there was a shape class, and then a square class extended the shape class, then the square class should be able to be used in place of the shape class.

Then, the Interface Segregation Principle states that classes shouldn’t be forced to use an interface which has functionality that it has no use for. This means that if an interface has some functionality that doesn’t apply to everything, then a class shouldn’t use that interface if it won’t be using that functionality. Instead, interfaces should be very broad, making them applicable for many different purposes.

Finally, the Dependency Inversion Principle states that functionality should depend upon abstractions, not concrete methods. This means that if you have a class that must perform some functionality, and it shouldn’t depend on an exact implementation, then the class must be design in such a way that it applies to all implementations, based off abstractions.

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

Anestiblog #5

This week I read a blog post that I thought really related to the class about agile software development. The blog is about the phases of the agile software development lifecycle. The blog starts off explaining Agile and why it is used. It is being used because of its flexible, iterative, and incremental character. The blog then goes into the phases, and some agile techniques and tools. The phases are requirements, design, development and coding, integration and testing, implementation and deployment, and finally review. Some of the tools and techniques are spiral SDLC, and waterfall SDLC. The blog then goes into the pros and cons of agile software development. A pro is that there are flexible working hours around the clock, and a con is that all communication takes place on the internet, so it might be harder to connect with fellow developers. The blog ends by summarizing the cycle of agile software development, and describing it as aiming to build and deliver flawless working software on a tight schedule.

I selected this blog post because software development is my dream job, and I thought it would be interesting to read about a possible way I might be working using the agile method. This blog has a great way of showing how agile software development works, and how useful it could be, and I think every CS major should read it since we have to take another class similar to the things in this blog with software process management.

 I think this blog was a great read that I recommend for many reasons. One reason I would recommend this blog is because of how deep it goes into explaining the cycles of agile software development . The blog gives a description for every phase, and explains what to do at every phase, what others are going to do while you are on that phase, and what tools to use when you are on the phase. Another reason I would recommend this blog is because a lot of jobs that we will be looking for in the future will be using the agile method, and if we are not good at using it, then we are at a disadvantage to be hired. The last reason I would recommend this blog is because it is focused on teamwork, and teamwork is important for every job, and not just computer science related jobs. Agile could be used anywhere. 

This blog taught me about all the phases, and that if they are all done correctly by a team of developers, they could really work productively as a cohesive unit. The material affected me heavily because it showed me what skills to learn, and what to expect if I want my future dream of software development to come true as many jobs might be using the agile method, so I must be prepared. Now that I know about the agile software development method, I will try to look for more different methods.

link: https://relevant.software/blog/agile-software-development-lifecycle-phases-explained/#Output

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

Unified Modeling Language (UML): Class Diagram Relationships

The Unified Modeling Language (UML) is a standard for diagramming the design of a computer program. UML class diagrams illustrate the classes and relationships of an object-oriented program. The five fundamental class relationships are dependency, aggregation, composition, inheritance, and realization. When my professor introduced UML, he provided instruction on inheritance and realization. Because an understanding of the five relationships is essential to reading and building UML class diagrams, the goal of this post is to familiarize myself with dependency, aggregation, and composition as well as their applications. To achieve the goal, I will be reflecting and adding to the blog, “Association vs. Dependency vs. Aggregation vs. Composition,” written by Niraj Bhatt, an enterprise architect at Advent eModal. In the post, Bhatt defines and applies the relationships.

Dependency is a relationship between two classes where one class uses the object of another class as a parameter of a method. One can represent it by drawing a dotted arrow from the user class to the class being used. Bhatt exemplifies the relationship in a program that simulates a turn-based game. The program acquires a Player class with a TakeTurn method that expects a Die object. Bhatt’s example is effective because, in many turn-based games, a player uses a die during his or her turn.

Aggregation is a relationship between two classes where one class owns the object of another class as an attribute. If an instance of the owner class ceases to exist, the object of the other class would still exist. One can represent it by drawing a line with a hollow diamond from the owner class to the class being owned. Because Bhatt exemplifies the relationship in an unfamiliar type of game, I will be providing another example. Another application of the relationship is in a course management system where the Course class owns Student objects. The application is effective because students will exist when courses do not.

Composition is a relationship between two classes where one class needs to have an object of another class as an attribute. If an instance of the former ceases to exist, the object of the latter class would cease to exist too. One can represent it by drawing a line with a filled diamond from the owner class to the class being owned. Because Bhatt exemplifies the relationship in an unfamiliar type of game, I will be providing another example. An application of the relationship is in an online shopping system where the Customer class has Order objects. The application is effective because orders would not exist without customers.

If I continue to pursue a career as a software engineer, my newfound understanding of class relationships will help me carry out my responsibilities. Many companies use UML to illustrate their software systems. I may need to apply the relationships to blueprint software or understand them in existing software to implement new features.


From the blog CS@WORCESTER – Andy Truong's Blog by atruong1 and used with permission of the author. All other rights reserved by the author.