Category Archives: CS-348

Clean Code

During this last week of class, I have been learning about clean code and how to write it as well as edit my previously written code in order to follow these guidelines. Clean code is exactly what it sounds like. It is code that is easy to read and understand, and isn’t too complicated or formatted poorly. Learning how to write clean code is going to be vital in working in the computer science industry. Everyone in this industry works with another programmer at some point in time, so having clean code will make their life and your life easier. While researching more about how to write clean code, I found a website called freecodecamp that does a great job explaining attributes of clean code while also giving examples. On top of explaining how to do it, it also has a section explaining why you should care about writing clean code. Personally, this really helped me understand why clean code is needed and why it is very important to understand.

The three main aspects of clean code are effectiveness, efficiency, and simplicity. Effectiveness is pretty self-explanatory. It means that the program should be able to solve the problem that it was designed to solve, otherwise it isn’t helpful. Once the program is considered to be effective, we need to also make sure that it is efficient. If a program solves a simple addition problem, but takes 36 hours to run, the program isn’t efficient as there are much faster and more simple solutions. If your program is post effective and efficient, then you also need to make sure that it has simplicity. While most sites will have different qualifications for simplicity, I think freecodecamp has most of them. Freecodecamp wants everyone that is trying to write clean code to ask themselves these questions about the code:

  1. “Can you easily understand what the program does at each line?
  2. Do functions and variables have names that clearly represent their responsibilities?
  3. Is the code indented correctly and spaced with the same format all along the codebase?
  4. Is there any documentation available for the code? Are comments used to explain complex parts of the program?
  5. How quick can you identify in which part of the codebase are certain features of the program? Can you delete/add new features without the need of modifying many other parts of the code?
  6. Does the code follow a modular approach, with different features separated in components?
  7. Is code reused when possible?
  8. Are the same architecture, design, and implementation decisions followed equally all along the codebase?”

While there are a ton of other ways that you can improve your code, these are the 3 main factors. Without these 3 foundational factors, you wouldn’t be able to write clean code which would make life harder for you and for everyone that reads your code.

Synopsis: https://www.freecodecamp.org/news/how-to-write-clean-code/#what-does-it-mean-to-write-clean-code-and-why-should-i-care

From the blog CS@Worcester – One pixel at a time by gizmo10203 and used with permission of the author. All other rights reserved by the author.

Clean Code

What is clean code, and how do I make sure my code is clean?  These are the questions I had when first hearing the term “Clean Code.”  In my quest to answer these questions, I found a blog (https://codingsans.com/blog/clean-code) transcribing Karolina Tóth’s interview with Robert C. Martin (Uncle Bob) who literally wrote the book Clean Code.  The main topics covered in the interview are clean code, developer and manager communication, and code ethics.  Focusing on what Uncle Bob has to say on the importance of clean code while including my personal experiences. 

Uncle Bob quotes Michael Feathers saying, “Clean code always looks like it was written by someone who cares.”.   Which makes sense, as I have taken pride in having simple aspects of Clean Code such as clearly named variables and proper indentation in my code blocks.  In contrast, as a tutor, I was asked to review code written with neither of these aspects by a student who openly expected not caring about the class. 

Looking at the functions reveals a lot about the code and how clean it is. Uncle Bob states that you can measure the size of a function, and that going above six lines of code they become too large.  Naming the functions properly will also create cleaner codes as Uncle Bob points out that having smaller and more specific functions will require more specific names.  This combined with the if and while statements will create easy to read code that is close to english.  

Understanding the importance of clean code starts with examining the consequences of having dirty code.  Uncle Bob emphasizes that everything goes slower when you are working with “dirty” code.  Developers commonly believe that quick and messy code is faster upfront, however the slowdown happens a lot faster than most realize.  The example given by Uncle Bob is someone writing bad code in the morning and after a simple lunch break they will be lost in what they wrote.

“Slow is smooth, smooth is fast,” is a quote drilled into my head from my highschool soccer coach.  Take your time with your movements, make them deliberate, and the result will be smooth.  Going slower and executing a move is better than going too fast and failing.  It feels slower to stay disciplined in writing clean code, however the time saved by having easy to read code will immediately and only grow over time.

Listening to what Uncle Bob had to say about the flow of functions and how they should create sentences really sticks with me. As someone who never saw the need for “the flood of functions”, having easy to read sentences in my code will make returning to projects significantly easier.

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

Week 13: CS-348

Software Process Model

A software process model is an abstract framework that gives steps on ways to plan software development processes and how they can be organized and executed. There are different types of software process models but all include some form of:

  • Specification – Defining what the system should do
  • Design – Defining the structure of the system
  • Implementation – Implementing the system
  • Validation – Ensuring the system works as intended and that the system is what the customer wants
  • Maintenance – Changing, modifying, updating to keep up with the customer needs/fixing bugs

Types of software process models

There are many different types of models that are available to be used by organizations. Some allow organizations to use the model directly while others are more flexible, allowing organizations to create custom steps that are more specific towards their needs.

Software processes are typically specified using Software Development Life Cycle (SDLC) models. These models specify the different steps of the software development process and the order they are executed. 

Waterfall Model

The waterfall model breaks down software process activities into sequential phases. Each phase depends on the outcomes of the phases before and cannot be started until all phases prior have been completed. Each phase corresponds to a software process. For example, the first phase would be specification/requirements analysis because developers cannot create a system without knowing its intended function. Once that step is completed, then the next phase can be started and so on.

V Model

The V model is similar to the waterfall model where steps are followed in a sequential order. Initially after each step, the model progresses downwards to move onto the next step. Once the the coding/developing stage is complete, the model then bends upwards to create a V shape. This model highlights the relationships between each phase of the development life cycle and its corresponding phase of testing. The downward process is called the Verification Phase, while the upward process of the model is called the Validation Phase which are completed by developers and testers, respectively.

Agile

Unlike the two previous models, Agile is not a model with specific steps to follow. Rather Agile is a broader term for a set of methods and practices that encompasses values from the Agile Manifesto. These values helps teams to react quickly to any unforeseen changes, while reducing risk. The software development approach to Agile is usually rapid and small cycles. Doing this results in more frequent releases with each building upon the previous releases. Agile can be implemented by using frameworks such as Scrum and Kanban.

Reflection

I chose this resource because before simply listing different types of models, it clearly defined what the software processes are. This ensures a foundation is established. Although only three of the models in the article are listed above, there are several more models which I found interesting as I was unfamiliar with some of them. Because organizations use different models, being aware of the more popular ones will be beneficial in the future.

Resources:

https://www.visual-paradigm.com/guide/software-development-process/what-is-a-software-process-model/

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

Week 12 – 12/3

For this week, I wanted to talk about the creation of comic books, and how it relates to Software Process Management and Software Design. Within the article linked below, it describes the process of how a comic is created, and the steps needed to reach a final project. I specifically wanted to look more into this as the process is quite similar to how software is developed.

The first step is coming up with an idea for what the comic would be about. Some stories might be a story needed to be told to convey a message or present a solution, which is things that we have been learning about in Software Process Management. Or perhaps you have a creative idea you want to put out there, which can relate to the creation of software on your own, like we are doing in Software Design.

The second step is writing a plot, which is much like creating a backlog for your process, planning the beginning, middle and end of the process.

Then, its off to creating the art, which is a multi-step process, which is much like creating the code. For the artists, they need to sketch, then line, then ink and even maybe color the panels of the comic, which parallels how code will need a framework, then main code, supplemental code, and comments to build on top of each other. This process isn’t always in a predetermined order, and can vary from project to project.

And then theres editing and review. Everyone looks over the draft of the work they’ve made, and then tweaks whatever needs adjustments as needed. This process might lead to the recreation of art or code, depending on which process we’re discussing. Once a review gets a pass, they’re ready to finalize and move onto the last step, which is…

Publishing and marketing! Once you’re done, you send the finished copy of the work to consumers to receive, and perhaps you’ll even advertise it, if its not well-known. This can include things like advertisements, sponsorships, and even word of mouth.

The parallels of the dynamics in which these processes interest me a ton as someone whos also minoring in art, and wants to go into a digital design or digital-art focused field, whether it be game design or webcomics. It’s kinda awesome to see that theres a sort of venn diagram between my two passions, and that they can intersect.

EDIT: I meant to post this earlier before, but I had connectivity issues and it never posted when I thought it did. I only realized because a friend wanted to read my blog, haha. To clarify, this blog is intended for Week-12, and for both classes, not 13, it just was posted late due to issues. My apologies for this inconvenience.

From the blog CS@Worcester – You're Telling Me A Shrimp Wrote This Code?! by tempurashrimple and used with permission of the author. All other rights reserved by the author.

Guide: Clean Code

Now I know what everyone is thinking, ‘You lied in your last blog.’ Yes, I did, and guess what? This is my blog, so that’s okay. You see, I could not pass up on this beautiful opportunity to kill two birds with one stone. As you may remember from my last blog, I complained about how hard it was to come up with topic ideas for CS-343. Well, well, if by some miracle I read that if topics intertwine between your two classes (343/348), we could count one blog for both classes (shoutout Prof Wurst :)).

Enough yapping, clean code time. I believe it was only a year ago when I first started taking coding seriously, and I can recall how awful my code looked. It worked… but if you wanted to debug, you had to pray before opening it. We are talking about one-function programs, with no formatting and variable names that would drive any professor mad. I quickly realized how important clean code was after watching some YouTube videos and seeing how much easier debugging was if your code had a good flow and was properly formatted. This is where I stopped when it came to clean code, unknowing that there were 100+ other factors that all combine to make clean code.

While exploring LinkedIn, I came across this article by Oleabhiele Donald titled ‘Benefits of Clean Code In Your Application Development.’ I gave this a full read and was really surprised about all the little ways I could make my code even better than it already was. Now I 1000% recommend giving it a full read, but I’m going to talk about some of the techniques that were mentioned that I didn’t know at the time or found most beneficial to me.

Use comments sparingly:

  • Limit the use of comments to when necessary, ensuring clarity and conciseness. Overusing comments can clutter the code, making it harder to read. Aim for clear and concise comments that add value.

Write small, focused methods:

  • Break down larger methods into smaller, focused ones, each with a single responsibility. This approach improves code understanding and facilitates easier modification.

Use unit testing:

  • Incorporate unit testing practices to verify code functionality and prevent the introduction of errors. Well-designed unit tests contribute to clean and reliable code.

Avoid duplication:

  • Identify and eliminate code duplication by utilizing methods, classes, and inheritance. Reducing duplication enhances code maintainability and modifiability.

These techniques stood out to me mostly because they were things I just didn’t think about. I love to keep a list on my desktop notepad that always reminds me of some of the key steps to clean code.

Why Clean Code? This a very simple answer thanks to the article, clean code is important enhances readability, making it easier for developers to understand, maintain, and collaborate on software projects. It also improves efficiency, scalability, and reduces the likelihood of introducing bugs, ultimately leading to more reliable software and a happier programmer.

Source: https://www.linkedin.com/pulse/benefits-clean-code-your-application-development-daniel-donald/

From the blog CS@Worcester – CS: Start to Finish by mrjfatal and used with permission of the author. All other rights reserved by the author.

Gitpod: A Cloud-Based Development Environment

What is it and how does it work?

In this episode of Behind the Source, Mike Street talks to Pauline Narvas about Gitpod, a cloud-based development environment. Gitpod is a platform that allows developers to code, build, and test their projects in a cloud-based environment. This means that developers can access their development environment from anywhere, and they don’t need to install any software on their local machine.

How does Gitpod work?

Gitpod works by creating a pre-configured development environment for each project. This environment includes all of the tools and dependencies that the developer needs to work on the project. The developer can then access this environment from any web browser.

What are the benefits of using Gitpod?

There are many benefits to using Gitpod. Some of the benefits include:

  • Increased productivity: Gitpod can help developers to be more productive by providing them with a pre-configured development environment that is ready to use.
  • Improved collaboration: Gitpod can help developers to collaborate more effectively by making it easy to share their development environment with others.
  • Reduced costs: Gitpod can help to reduce costs by eliminating the need to purchase and maintain hardware and software.

How to get started with Gitpod

Getting started with Gitpod is easy. Simply create an account and then connect your Git repository. Gitpod will then create a pre-configured development environment for your project. You can then access this environment from any web browser.

Conclusion

Gitpod is a powerful tool that can help developers to be more productive, collaborate more effectively, and reduce costs. If you are a developer, I encourage you to try Gitpod today.

Podcast used for this blog: https://podcasts.apple.com/us/podcast/gitpod-with-pauline-narvas/id1645278976?i=1000581227601

From the blog CS@Worcester – Site Title by Iman Kondakciu and used with permission of the author. All other rights reserved by the author.

The Art of Coding: Clean Code.

In the everyday life of a computer science enthusiast we are caught up in complex stuff like algorithms and coding languages, but there is a crucial aspect that we cannot overlook, writing clean code. In this blog post, I will show you some coding principles that make your code look good and make life easier for you and whoever reads your code.

  1. Clean Code is not just a fancy choice, it’s a must. Robert C. Martin says, “Clean code is simple and direct. It reads like well-written prose.” This basically means writing a clean code isn’t just for others, it’s a great help to you as well.
  2. Naming things by what they are supposed to do makes total sense. Dont aim for cryptic names, go for clarity. Think of good names as a map, it tells you what is what without a guide.

    Python Example:
    <<
    #Confusing variable name
    x = 5
    #Clear variable name
    total_items = 5
    >>

  3. Consistent formatting is your code’s best friend. Follow a set of indenting and formatting rules and stick by it till the end. Most IDE’s or coding tools make your code look neat automatically but putting some effort yourself goes a long way.

    Java example:
    <<
    // Messy formatting
    public void exampleMethod(){
    if(condition){
    statement();
    }
    }
    // Clean formatting
    public void exampleMethod() {
    if (condition) {
    statement();
    }
    >>

  4. Break things down and chop your code into smaller bits (this part exists in all of my blog posts by now). Each bit needs to have one main job or function. This makes your code easier to understand and saves you from later headaches.
  5. A little comment goes a long way. Try to think of comments as salt, a pinch is just right, and a lot ruins the dish (and gives you high blood pressure). Use your comments for tricky parts and remember to keep them updated.
  6. A lot of us are familiar with Legos which makes Test-Driven Development somewhat easier to grasp. Before building a great pyramid, try to plan it out with smaller bricks (tests). Not only does it ensure your code works but it helps in keeping things organized.

To conclude: Diving deeper into the coding world the smartest move you can make is writing clean code. Not only to impress the others but to make your life smoother. To put this in other words my generation understands writing clean code is the “ultimate flex”. Until next time keep it clean.

Ano out.

References: 
“The Clean Code Blog

by Robert C. Martin (Uncle Bob)” – https://blog.cleancoder.com/

From the blog CS@Worcester – Anairdo&#039;s WSU Computer Science Blog by anairdoduri and used with permission of the author. All other rights reserved by the author.

Week 12 Project Coordination

While we have been working on our projects I have wondered what we should expect in our upcoming work. That is why I searched for an article that would give me insight into the later parts of our project. Just finishing up the project set up a few days ago will help me map out the rest of the project itself. I targeted my article on projects in GitLab to have a more precise understanding rather than a broad project understanding with no correlation to our own.  Hopefully, giving you the knowledge I gained will help your journey of developing your project.

This article gives the reader an insight into how GitLab coordinates its scheduling, planning, tracking, and releasing. To decide on their release date they use the Good Docs Projects template which emphasizes two updates per year. So for GitLab, they work from Jan – May release mid-June, then a three-week break, then back to work from July to December, have a release, then another break starting the cycle over again. In their six-month work, it’s similar to scrum where the team meets up in the beginning and establishes goals. During those months they do general community meetings to see if they’re on track and assign issues by weight of importance. On release day, all the team members meet up to build the team artifacts including their zip files and tarballs. If everything goes right and all their merge requests are complete they try to make sure everyone is credited and then go on a three-week vacation where the cycle begins again all over again. 

After reading this article it showed me a new and effective way to complete a project. This way of doing a project has many similarities to scrum but in the grand scheme of things, all you need is a cycle that is effective and can be repeated. In this particular project, I can’t use their scheme but I can try to concise it into a smaller scale understanding the time constraints. I think it’s very effective to have a break after finishing a project. Some people may want to take a break in between projects but in my opinion, it’s better to finish it overall then take time for yourself. In the article, there was no research on the effects of the break but I believe their workers come back replenished and ready to work when they do come back. 

https://about.gitlab.com/blog/2023/08/24/coordinating-documentation-projects-gitlab/

From the blog cs-wsu – DCO by dcastillo360 and used with permission of the author. All other rights reserved by the author.

Happy path and “The Pride lands”

In the realm of user experience and product development, the concept of the
“Happy Path” is crucial. It refers to a streamlined, problem-free journey a user experiences when interacting with a product or service, aligning perfectly with their needs and expectations. This idea, vividly explained in a blog post by UserPilot (https://userpilot.com/blog/happy-path/), resonates deeply with the narrative of Disney’s classic, “The Lion King.” Here, I draw parallels between the Happy Path and the Pride Lands, contrasting it with the deviations that lead to the Elephants Graveyard, to underscore the importance of this concept in our course material.

The Pride Lands, in “The Lion King”, represents the ideal state or the happy path in user experience terms. This lush and vibrant ecosystem where everything works in harmony symbolizes a users journey where needs are met effortlessly, and satisfaction is guaranteed. The Pride Lands thrive under Mufasa’s reign, much like how a well-designed product or service flourishes when it aligns perfectly with user expectations and provides a seamless experience.

On the other hand, the Elephant Graveyard symbolizes deviation from the happy path. It is a place of chaos, danger and poor outcomes, the opposite of the Pride Lands. In our course, we learned that straying from the happy path in a product development or user experience can lead to complicated, unsatisfactory user interactions, Much like how Simba’s venture into the Elephant Graveyard leads to peril.

My interest in this particular blog post stems from its clear, engaging explanation of the Happy Path Concept. Making it highly relevant to our course material on product development. The analogy with “The Lion King” further sparked my curiosity, as it creatively demonstrates the importance of maintaining the Happy Path in real-world scenarios.

Reflecting on the content, I have learned that like in “The Lion King” where the well being of the Pride Lands depends on wise leadership and balance, the success of a product or services hinges on thoughtful design and understanding user needs. This has affected me by highlighting the importance of user-centered design and has made me more aware of the user journeys in the products I use daily.

In my future practices, I plan to apply these lessons by prioritizing user needs and striving to maintain the Happy Path in my designs. This approach will not only enhance user satisfaction but also contribute to the overall success of the products I will be involved with.

In conclusion, the Happy Path is a fundamental concept in user experience and product development. The comparison of the Happy Path with the Pride Lands provides a vivid illustration of its importance, straying from this path, akin to venturing into the Elephants Graveyard, can lead to unfavorable outcomes.

From the blog CS@Worcester – Josies Notes by josielrivas and used with permission of the author. All other rights reserved by the author.

Following Clean Practices

When I first started coding in AP Computer Science, I found it fun. It was like solving a puzzle, a difficult one at first, but it slowly made sense. One thing I struggled with was clean code. I remember vaguely writing code that was disgustingly dirty, as in unorganized, unreadable to others, and all around messed up. I’m surprised I was able to get something to work in those conditions. I soon realized that clean code would be a game changer, as I would be able to read it clearly, and follow along easily.

Clean code consists of some points, having good and descriptive method and variable names, appropriate spacing between different lines of code, and good sectioning are some examples. Ultimately, these can go further based on context. Some variables may not need overly descriptive names if there’s enough context to imply what it is used for. 

In this blog post, Karolina Tóth interviews Robert C. Martin, or Uncle Bob, on his way of building quality code. The post is fairly lengthy but it has very good tips. Uncle Bob talks about what clean code is, its benefits, how not using clean code can negatively affect you, and many more. One tip he gives is keeping your functions as small as possible, because once they start to get large, the method starts to become confusing. By not writing clean code, you slow everything down. On a team, it’s difficult to work together if someone’s code looks like a 5 year old wrote it. By writing clean code, the team can work effectively and efficiently, ensuring quality code. 

I think this is a good post, Uncle Bob has good information, not only on clean code, but also boosting team morale and how to ease into using clean code. His knowledge in teamwork comes from his own experience and mistakes, which I like. Someone has to make mistakes for others to learn, and fortunately, Uncle Bob has done just that.

Clean code is important, whether you work in a team, or alone. It’s good practice to do so. When I first started, it was sloppy code. But now, I can’t stand seeing unorganized code. Even after we had learned clean code in class, I realized that mine wasn’t exactly perfect either. I liked my variable names to be descriptive, but short, and I made the short part priority because I’m lazy. But after reading this post, I understood that it’s not always good to keep them like that, having overly descriptive names can be beneficial, but when they have to be. I like things to be clean, and orderly, and neat, and whatnot, so I’ll be sure to refer back to this post, and the rest of Uncle Bob’s resources later down the line.

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