Category Archives: Week-14

Cracking the Code for Clean and Reliable Open-Source Science: 10 Rules to Rule Them All

Hey Coders! Feeling lost in a maze of confusing code? Tired of code messes and bug hunts?

Today, let’s dive into the exciting world of open-source scientific software. If you’re like me and tired of dealing with confusing code and chasing bugs, don’t worry! The article “Ten simple rules on writing clean and reliable open-source scientific software” by Hunter-Zinck et al. (2023) is here to show us the way to clean, reliable, and easy-to-handle code that benefits everyone.

Why This Article Rocks

This article stood out because it tackles two key issues: making code user-friendly and emphasizing the importance of open-source software. Plus, it simplifies complex software development into 10 easy-to-follow rules.

The 10 Golden Rules

The article outlines 10 key principles for writing clean and reliable open-source scientific software. Here’s a quick rundown, with a dash of my own insights:

  1. Modularize: Break down your code into smaller, independent units. This makes it easier to understand, test, and maintain. Think of it like building with Legos – you can easily swap or add new pieces without affecting the whole structure.
  2. Document everything: Write clear and concise comments explaining your code. Imagine someone completely new to your project needs to understand it – would your comments guide them through the jungle?
  3. Use descriptive names: Don’t be cryptic! Choose variable and function names that accurately reflect their purpose. Think of them as road signs – they should tell you exactly where you’re going.
  4. Test relentlessly: Write unit tests to catch errors early and often. These are like little detectives, constantly scrutinizing your code for any suspicious activity.
  5. Version control is your friend: Use tools like Git to track changes and revert to previous versions if needed. It’s like having a magic rewind button for your code!
  6. Automate your tasks: Write scripts to automate repetitive tasks. This frees you up to focus on the bigger picture and avoid tedious manual work.
  7. Embrace continuous integration: Set up systems that automatically test and build your code when changes are made. This helps to identify problems early and prevent them from snowballing.
  8. Get feedback: Share your code with others and ask for their feedback. This can be like having a team of extra eyes, spotting errors and suggesting improvements you might miss.
  9. Contribute to the community: If you’re using existing open-source software, consider contributing back by fixing bugs or adding features. Remember, it’s a two-way street!
  10. Stay up-to-date: Keep your codebase and dependencies up-to-date with the latest versions to ensure compatibility and security. Think of it like keeping your operating system updated – it’s essential for smooth sailing.

Learning and Beyond

This article has been a game-changer, offering a clear roadmap for writing clean and reliable open-source scientific software. Looking forward, my plan is to further refine my skills in writing clean and reliable code and actively contribute to the open-source community.

P.S. For more detailed explanations and examples of each rule, check out the original article here.

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

Navigating the Clean Code Conundrum: Striking a Balance for Optimal Performance

In the engaging podcast-style video, “Clean Code: Horrible Performance,” https://www.youtube.com/watch?v=OtozASk68Os&t=1944s two seasoned developers share insights over 47 minutes on the delicate balance between clean coding and system performance.

The developers initially champion the virtues of clean code—emphasizing readability, maintainability, and collaborative benefits. However, the conversation takes an interesting turn as they delve into the paradox that clean code might lead to suboptimal performance.

Real-world examples illustrate scenarios where an excessive focus on code cleanliness can unintentionally hamper efficiency. The developers caution against over-optimization and stress the importance of a balanced approach.

Practical insights emerge as the duo offers strategies for identifying bottlenecks and optimizing critical code sections without sacrificing readability. They acknowledge the evolving nature of software development, where the pursuit of clean code intersects with the demand for high-performance systems.

In conclusion, “Clean Code: Horrible Performance” serves as a valuable guide for developers seeking to strike the right balance between clean coding principles and performance optimization. The developers’ experiences provide practical wisdom for navigating the complexities of modern software development without compromising code aesthetics or system efficiency.

From the blog CS@Worcester – Dose Of Dev by msavice and used with permission of the author. All other rights reserved by the author.

Week 14 Blog

This week’s blog post I decided to research more about linting for non-inclusive language. The medium I selected is a blog post by Michael Bachand, an engineer at Airbnb. “Building an Inclusive Codebase” dives into the techniques engineers at Airbnb are taking to make their work environment more inclusive for everyone. In order to create a more inclusive platform, the development team must also be inclusive. To start, the team has increased the diversity in their teams to accommodate every demographic. Bachand emphasizes that building a diverse team will help empower both Airbnb’s hosts and guests. Inclusivity goes beyond forming a diverse team however.

The team at Airbnb discovered an issue with non-inclusive language in their codebase. After working with employees affected by these terms, the team presented a proposal to the Chief Technology Officer of Airbnb and got the approval to refactor the code to be more inclusive. Michael Bachand stresses that “acknowledgement and resourcing from the highest levels of management legitimized this effort”. The support from management and the CTO prioritizing the task produced a healthier working culture across all teams.

Airbnb’s development team broke down this problem into two key parts: preventing the use of this language and eliminating the existing language. One essential tool that was utilized was the woke linter which checked each pole request for non-inclusive terminology and suggested alternative terms to promote belonging. The team now had a proper tool to use, however, they didn’t send the tool to every developer immediately. The team took a unique approach by slowly distributing the tool to expert developers. These developers decided which directories the linter should access and which should be excluded.

Before our in-class activity on this topic, I never thought about how my sentences might unintentionally offend or upset someone. This topic has opened my eyes to how crucial having a linter tool is. Many of these non-inclusive terms sound offensive without the right context which is why every developer should utilize a linter of sort. Reflecting on the problem addressed by Airbnb, having the support from the CTO is reassuring to know that your work is valued by the company. I believe all companies should strive to create a sense of belonging in their work environment, no matter how big or small. I can confidently say that the information I learned today will stick with me for the rest of my career.

Blog Post: https://medium.com/airbnb-engineering/building-an-inclusive-codebase-bbaa2315e5b8

From the blog CS@Worcester – Computer Science Through a Junior by Winston Luu and used with permission of the author. All other rights reserved by the author.

Inversion of Control

Inversion of control is a software principle that asserts a program can benefit in terms of testability and usability if the management of an application’s flow is transferred to a different part of the program. I.O.C’s framework takes the management of an application’s implementation away from the developer. When interactions require custom business logic, the I.O.C framework will use the code provided by the developer. This is the “inversion” point of the inversion of control design principle. The most common application for Inversion of control is Java servers faces. I.O.C frameworks implement low-level and problem-prone activities, it allows the developer to focus on custom business logic instead of tedious tasks.  The one thing about inversion of control is that it can confuse what qualifies as an I.O.C and what doesn’t. Some examples of inversion of control are event-based user interfaces, shared cache, and comprehension framework—the range of development changes that qualify as I.O.C contributes to the term. I.O.C is a principle, not a design pattern- the implementation depends on the developer. I.O.C just provides high-level guidelines. Inversion of control and dependency injection are usually used interchangeably. Dependency injection is one implementation of I.O.C., it’s a technique that allows objects to be separated from other objects that they depend on.

Dependency injection suggests that instead of making an instance of class b into class a using the new operation, the object of class b should be placed into class a using one of these methods constructor injection, setter injection, and interface injection. Another example of implementation in I.O.C is the spring framework. That contains instances and manages the lifecycle of the objects in the program. The user in the configuration file provides information that relates to what objects and dependencies are used by the application like Java code. The benefits of Inversion of control are that it makes the application easier to test and maintain, reduces the amount of application code, and decreases the coupling between classes. Inversion of control helps make your code more readable because of the absence of some components. At the end of the day, I.O.C is a design pattern that is very useful for software development and lets us know when action needs to be taken when something happens in our system.

https://www.theserverside.com/definition/inversion-of-control-IoC

https://www.educative.io/answers/what-is-inversion-of-control

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

From Learning to Doing

This week I was searching for an article to write about and I stumbled upon an article from Codecademy sharing the story of Juan Paredes, a Full-Stack Engineer from Mexico. The article is an interview of sorts where Juan has responded to prompts related to his journey from a Call Center Supervisor to a Full-Stack Engineer.

Juan covers how exactly he got into software engineering. When first moving to Mexicali, Mexico he got a job as a call center specialist. After 3 years Juan was promoted to Operations supervisor where at this point he decided to expand on his love for computers and wanted to start learning how to code through a free course on Codecademy.

After completing the free course, Juan decided to pay for a subscription and before Juan was completed with his first paid course, he was able to find an entry-level developer position. After figuring out that software engineering is what he truly wants to do, he also started attending the Mexicali Institute of Technology and is currently studying to obtain a degree in Software Engineering.

Juan also talks about how limited time and a pay cut made things temporarily more difficult but between his passion and determination, Juan continues to learn and progress.

When the article was created, Juan had just found a job with better pay and benefits than his first position and continues to progress forward in the software field.

Juan finishes off his remarks by recognizing the importance of organization and being open to learning new things as traits that will carry you far in the field. With organization, one can more easily find how to and be able to implement changes and by keeping an open mind you may learn things that while not valuable at the present, could become of great use in days, weeks, or months later on.

After reading this article I wanted to share and reflect upon it since I could relate to Juan. I too discovered my interest in programming through another medium of computers, however mine was video games. I started my journey by wanting to learn how to script in Lua for Garry’s mod addons and after that, I gradually kept learning more about coding. I never saw it as more than a hobby at the time, but here I am today almost finished with my Bachelor’s in Computer Science and preparing to join the workforce soon. Juan’s story serves as a reminder that through determination and perseverance, I can learn and do whatever I want within the extensive computer science field after obtaining my degree. It may take time, but in the end, the hard work will pay off regardless of how hard it may be or how much I would want to give up.

Article Link: https://www.codecademy.com/resources/blog/from-call-center-sales-representative-to-full-stack-engineer/

From the blog CS@Worcester – Eli's Corner of the Internet by Eli and used with permission of the author. All other rights reserved by the author.

Suggested Standards for (basic) REST API Calls

In the past few weeks, we’ve finished the CS-343 semester focusing on designing/implementing REST API calls and interacting with back- and front-ends. During one of our classes, I recall a discussion about the fact that there are no unified across-industry “best practices” for writing API’s. Specific API structures and rules are common within teams but can vary from organization to organization, however there are some general habits and strategies. So I decided to do some searching and focused on a blog post on the website for Swagger, the REST API view/interaction software we’ve been using in class: Best Practices in API Design.

The post discusses some general best practices on creating consistent, well-designed API’s by focusing on three key characteristics: 

  1. Being easy to read, understand and work with
  2. Being hard to misuse, and in turn more intuitive for users
  3. Completeness and Conciseness – something which the post acknowledges frequently happens over time as developers build on top of existing APIs

Alongside some other basics on CRUD operations and how they correlate to standard REST API calls (get, post etc.), the post also dives into practices for writing effective call response messages. The codes for responses should follow the HTTP standards, where client-side errors return 400-level (4xx) codes versus server-side errors return 500-level and successful calls return 200-level. 

Arguably most important is providing thorough and clear explanations in response messages. For error responses, this entails providing detailed messages describing the error that occurred and suggestions/tips to address and debug it. As a part of this, it’s worth considering putting an example of a successful call to show proper syntax and passed parameters – handholding users will pay off with smoother API interactions long term. To reinforce this, the blog post recommends providing examples for all possible GET responses to demonstrate successful data access calls.

While specific implementations will vary by project/system, these are some good strategies and habits to keep in mind. The importance of providing examples for each individual GET response really sticks out and hits home for me. I can imagine with more complex systems and calls that may contain various request, query or other parameters it could quickly become confusing for users to navigate and access information they need. It seems worthwhile to also provide an example of a successful call in the error response for some specific situations, such as an Error 400 – Malformed Requested → providing an example successful request. 

Below, you’ll also find a link to a “glossary” of REST API parameters with explanations on their purpose and uses – a resource I also recently came across and have been finding valuable. If you have any other suggested “best practices” to keep in mind when designing REST API calls, please let me know in a reply or E-Mail.

  1. Blog Post: https://swagger.io/resources/articles/best-practices-in-api-design/
  2. Parameter Glossary: https://rapidapi.com/blog/api-glossary/parameters/

From the blog CS@Worcester – Tech. Worth Talking About by jelbirt and used with permission of the author. All other rights reserved by the author.

Inversion of control

Inversion of control is a software principle that asserts a program can benefit in terms of testability and usability if the management of an application’s flow is transferred to a different part of the program. I.O.C’s framework takes the management of an application’s implementation away from the developer. When there are interactions that require custom business logic, the I.O.C framework will use the code provided by the developer. This is the “inversion” point of the inversion of control design principle. The most common application for Inversion of control is Java servers faces. I.O.C frameworks implement low-level and problem-prone activities, it allows the developer to focus on custom business logic instead of tedious tasks.  The one thing about inversion of control is that it can confuse what qualifies as an I.O.C and what doesn’t. Some examples of inversion of control are the use of event-based user interfaces, the use of shared cache, and the use of comprehension framework. The range of development changes that qualify as I.O.C contributes to the term. I.O.C is a principle, not a design pattern- the implementation depends on the developer. I.O.C just provides high-level guidelines. Inversion of control and dependency injection are usually used interchangeably. Dependency injection is one implementation of I.O.C., it’s a technique that allows objects to be separated from other objects that they depend on.

Dependency injection suggests that instead of making an instance of class b into class a using the new operation, the object of class b should be placed into class a using one of these methods constructor injection, setter injection, and interface injection. Another example of implementation in I.O.C is the spring framework. That contains instances and manages the lifecycle of the objects in the program. The user in the configuration file provides information that relates to what objects and dependencies are used by the application like Java code. The benefits of Inversion of control are that it makes the application easier to test and maintain, reduces the amount of application code, and also decreases the coupling between classes.

https://www.theserverside.com/definition/inversion-of-control-IoC

https://www.educative.io/answers/what-is-inversion-of-control

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

Blog #7

The pattern I read for this week was “Draw Your Own Map”. It was about how to create your own career path and not worry about what others think of it. This was a great pattern to read because it is so true. Everyone is living their own life in their own situation, and no two people are exactly alike. It was interesting to look at the different ways I can create my own career map, and be prepared for the future. This pattern started making me think about my own map now that my college days are coming to an end.

This pattern taught me to not take my current map too seriously as it can always change, and the map I have right now might not necessarily be the same map I have next year, and I am free to change it however and whenever I see fit. I have always worried about the big goals, and this pattern has also taught me to focus on the little goals that will build up to create the big goals. This can even make the big goals seem simpler as the little goals will build into the big ones. 

I do not have anything that I disagree with in this pattern as it all seems to be given as options for you, and not anything said as a fact. Your map should be your own, and nobody can tell you if it is wrong or not as nobody is the same. I think this pattern did a great job at making sure that, in the end, this is only for yourself, and it will be different from everyone else. There might be times when your map intersects with others, but it will never be the exact same. This pattern is very important for anyone to read no matter what your career choice is. Everyone should draw their own career map with whatever goals they have to go through their path. In the end, your career map should be unique to you, it can change as many times as you need throughout your life, and it should include all your goals you wish to achieve.

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.

Record What You Learn

Ive grown to have struggled with my communication skills. I would propose that it comes from feelings of inadequacy. Growing up I spoke solely Khmer at home and going into school there was a short time of transition from one language to another. Fast-forward a decade or two the tides have turned, and I now struggle with Khmer.  What I recognize is the common factor within developing language and communication is one’s ability to write in each language. For one key factor as introduced in the Record What You Learn pattern, it says “You should not also underestimate the power of writing itself….You can lose your larger sense of purpose. But writing lets you step back and think through a problem. Even the angriest rant forces the writer to achieve a degree of thoughtfulness.” During my earlier stages of life, I don’t think I would ever have been able to understand this idea so much so that it would have led me to loathe writing in its entirety.

Though, as a graduating student, like many things, I have learned to love and develop a healthier relationship with things that may feel adverse. Like an opposing force school has been, I have learned to pull rather push against such a struggle. As I begin to make a shift, I wish to utilize writing more in any way that would serve me. As of now I see writing as a way to develop my language skills both natural language and coding/computer language, continue to use it as a way to develop ideas, and have it be part of my lifelong existence.

More specifically writing such as the writing in this blog has been an empowering way to process thinking and how to think. Of the many ideas that this blog has helped me develop, with the subject matter being the patterns in the reading, I’m learning to reflect on myself and record those reflections in way that crafts my “larger sense of purpose”. For example, recognizing that I like talking up all these ideas but never act on them, and starting to transition into learning how to take action and start making these ideas come true. The role in which writing has played has served as an oath to grow to my higher self, a mastered self. If I am true to myself these writings must be treated as a nursery to my ideas and the visions of the future that I have.

It is not only myself that I serve, but also for those that may have struggled as I did.

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

Apprenticeship pattern: Familiar Tools [featuring the Concrete Skills pattern]

Since beginning this undergrad program (really, the CS transfer program at my previous school) and starting my internship, I’ve found myself working in several different environments with several different tools. I’ve been able to scrape by in most of them, but haven’t stuck around with any one of them for long enough to become really familiar with it. I can specialize template classes and manage pointers in C++, but I don’t know how to use most of the standard library. I’ve grown from using a couple of Linux commands in a Manjaro VM to writing increasingly useful Bash scripts, but I’m not rapidly adding Linux commands to my toolbox. I’ve programmed in at least 10 different languages in the last year, but I’m not happy with my proficiency in a single one of them.

I think that this means that I need to start making use of the related Familiar Tools and Concrete Skills patterns, or at my own dot product reinterpretation of the two. The Familiar Tools pattern is all about developing consistency with a tool that you already trust yourself with, and Concrete Skills is about developing a proficiency foundation to build on. I have some foundation, but it’s split across a bunch of different technologies, and I need to rebuild it starting from a single tool that can become familiar to me.

The tool that I’d like to become familiar with is Rust. I share a lot of the general and technical priorities of that project. It’s great that it’s flexible and able to progress and fix mistakes without being paralyzed by a need to forever remain backwards-compatible. More importantly, I want to eventually work mostly with statically typed languages, and I love that it lets you opt into fewer levels of abstraction. For example, how cool is it that you can inline assembly in the same language that considers C-style undefined behavior to be a design failure?

Now that my formal education is ending, I’m going to use some of my spare time to develop my concrete skills in Rust by working on small projects. Hopefully, one of those will be working through Sedgewick & Wayne’s Algorithms again in Rust, some will be collaborative projects on fun things that I can’t yet get paid to do, and some will be projects where I figure out how to integrate a Rust backend with other tools that I need to learn more about anyway such as web APIs and AWS CloudFormation and Timestream.

From the blog CS@Worcester – Tasteful Glues by tastefulglues and used with permission of the author. All other rights reserved by the author.