Author Archives: lenagviaz

Blog Post Week of 11/22 – How Important Is Bash Scripting For Programmers?

Most of us in CS-348 have been introduced to the terminal and bash scripting from previous classes or using Linux on their laptop. I haven’t used linux for any major projects but I installed and dual boot linux on my laptop (windows and linux installed on two different ssd) and use it for small side projects, or to learn new things. It’s for this reason I use a laptop that’s a little bit older so that everything inside is easily accessible and I can modify it however I like. The terminal allows a user or programmer to control their computer and make requests to the OS through keyboard commands rather than interacting with the user interface. One advantage with using the command line vs GUI is it keeps a history log of every command that was executed which makes doing things again much quicker and more organized, and it helps if you need a reminder for what you did a few days ago. You can type individual commands in the terminal prompt one at a time or you can write a bash script, which is a text file with the .sh extension that contains multiple bash commands to be executed at once. 

How and what do programmers do with bash scripts exactly? I found this blog post to be a great introduction for programming students like myself to practice, with tasks that relate to real IT jobs we may hold one day: https://linuxhandbook.com/bash-automation/. The bash is a great tool for running tasks that are boring and repetitive without much repeated effort. The first example shows how a system administrator can use a bash script to create a new user on multiple servers. This example shows how you can even use bash scripts to enter data from the command prompt and use this data to create the new user. The third example shows how you can monitor disk space using a bash script and send an email warning whomever is using the computer that disk space is running low and by how much. These are basic examples that show how simple bash scripts can save you a lot of time in the long run. 

Bash scripting is something most of us will come across at some point in our programming careers and it’s important to get a handle on the basics. Automating mundane tasks will make work easier and show you have a wide variety of skills.

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

Blog post 10/18/21 – JUnit tests and code refactoring

As we progress through CS-343 we are learning how to refactor existing code. In my previous coding class it was a challenge to learn all the rules of java and apply them to new projects – getting the code to run was a success. The next step is writing code that is up to professional standards as we prepare to enter the workforce. JUnit tests are used by developers to implement tests directly in your project , making sure no corner is left unchecked. This increases the quality of your code and speeds up the refactoring process because you can see clearly what parts of your code need improvement. The tests are a goal for your project, and you will meet your goal once all tests reach 100%. I have only briefly used JUnit testing in my previous courses and still struggle with writing them myself. I found this video helpful because it allows you to watch a professional programmer walk through a code refactoring session and write tests from scratch.

Testing and Refactoring Legacy Code – Sandro Mancuso

The developer has his screen split between the legacy code and the refactored code/tests, working from the inner methods and functions then working outwards. Over the summer I created a basic paint application using JavaScript. I will use the code refactoring methods I learned in this video to begin refactoring my own personal coding project.

In this video, they go one class at a time first examining the code then line by line writing the tests. When running the JUnit test class, the java file will have different color highlighting on certain lines to show you which parts of your code meet the standards and which do not. I would recommend this video to everyone in our class to watch because it gives you the full step by step process for writing JUnit tests and using the results to refactor your code.

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

Introduction: CS-343

Hello my name is Lena Viazmitinov and my major is Computer Science. I will be using this blog for CS-343 coursework and will doccument my progress throughout my final year here at WSU. Good luck to everyone!

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