Author Archives: Kelvin Nina

Code, Test, Refactor!

In my last post discussing testing and QA development, I went into depth about a project I was working on last year. I was developing an app that was supposed to track one’s financial history. It was the first project I had ever worked on that gave me free liberty to do whatever I wanted. I explained that it took a lot of my time and I ran into a lot of issues regarding the organization of the code, for the most part, I was most concerned about making something that worked rather than making something that worked effectively. Recently, I read a blog from Thesoftarch discussing how to write object-orientated code effectively.

The blog “Simple & Effective Way to Write Object Oriented Code” basically explains that most developers, like me, will only look to write code to reach functional requirements and not advocate for the technical quality of the code. The blog post explains that writing code to be functional can be acceptable during initial releases but can slowly turn complex if not managed correctly. So, it is important to maintain quality so that in the long term we can avoid struggling with maintaining the application. Different ways of writing effective, approachable code include making it simple to read, easy to test/verify, and having a low cost of change. The blogger goes by explaining the three basic steps of writing effective and well-designed code.

First, they go on to say that writing is easy but writing effective code is not easy, especially when you don’t have an approach. There are many design principles that developers go through in order to design good code. This includes SOLID, DRY, Design to Interface, and many more.

The second step is Unit Testing, as explained in my last blog post, it’s important to ensure that the code written works as intended. it’s best to write unit tests every time a method or class is created instead of writing the unit tests all at once.

The third and final step is to refactor. Refactoring is an activity to improve the quality of code without affecting its behavior. Making this a habit will help “maintain the code in the long run without adding much effort or risk.” As the blogger puts it, the coder should be able to identify “smells” in the code, refactor code to remove the smell and fix unit tests. Smells are certain structures that indicate violations of fundamental principles and negatively impact quality.

While reading this blog I’ve been able to keep note of what I need to do and look out for when it comes to developing a program. If I had read these steps last year, I think I would have had a better time developing my phone application. Reading this over I realized that there is a lot that goes into the development process and simply writing the code isn’t enough. It’s like baking a cake, everyone can follow the instructions to bake one but if key details are left out then it might not taste good, software development is the same way. It’s important that the code is designed in a way so that it can last. In my next project, I want to focus on refactoring for the most part. Code quality is very important and being able to make quality code will save me time and prevent any struggle.

Link to “Simple & Effective Way to Write Object Oriented Code”:

From the blog CS@Worcester – FindKelvin by Kelvin Nina and used with permission of the author. All other rights reserved by the author.

The Wonders Of Testing

Testing is an essential tool when it comes to software development. This week I listened to the podcast “Code Newbie Podcast”. In the episode “How to make sense of the testing landscape”, they talk about the importance of testing, and why people test, what kind of testing is done. They bring in Sergei Egor who is the CEO of AtomicJar. His company works with Testcontainers a java library that supports JUnit testing. The reasoning for looking into this episode, in particular, is so I could get more familiar with how testing works and its intricacies. The experience with testing my programs is very minuscule, and so having a veteran QA developer explain the little details of testing is just what I need personally.

Sergei goes on and explains that when discussing software, new features are being implemented almost all the time and so in order to make sure that those features work as intended, testing must be done. When working on a program, it’s fair to assume that the program must meet a certain amount of requirements and so testing ensures that all those requirements are met. The whole point of Sergei’s company is to optimize testing for software companies that don’t want to create miscellaneous code just to test a certain feature or task. The question that Sergei brings up is why can’t it be done through the backend of the program? And so Sergei’s company basically specializes in these software developing phenomena.

He goes on to explain different types of testing such as automated testing, performance testing, and the most popular type of testing which is unit testing. Unit testing is basically low-level and it will tests individual methods and functions. I’ve worked with unit testing in my previous computer science courses so I am most familiar with this type of testing. I would use unit testing in java for the most part. I had a project that involved me creating a banking account class, and basically, I had to create a JUnit class that would test all my methods such as my “getFirstName” method or my “getBalance”, so on and so forth. It would basically tell me if these methods succeed or not. When Sergei started talking about unit testing it felt very familiar with assignments I’ve worked on in the past.

When he started going into performance testing which is a test that evaluates the speed and reliability of an application, it made sense on paper but with my little experience, I began to struggle with how one may go about doing something like that. With the implementation load test as Sergei mentions, load tests are used to work the application to its full potential and record its response times and request counts as he goes on to explain. Something else that I found interesting while listening to Sergei is the question of why can the developers test the code so that the company doesn’t have to hire a crew of QA engineers. In Sergei’s words, he explains that many developers don’t want to think of all possible inputs for a program they would rather have an algorithm such as property testing do it for them.

Property testing relies on properties and makes sure that a program abides by those properties. It would be interesting to see this type of testing work with my mobile application which word recorded finance information- it would typically crash when inserting a record of payments occasionally and so having an automated testing algorithm such as property testing could have helped me figure out why my program failed in some instances. Automated testing would serve me in testing my programs and their functionality, running multiple tests whenever it’s needed.

Link to “Code Newbies Podcast” S18:E4:

From the blog CS@Worcester – FindKelvin by Kelvin Nina and used with permission of the author. All other rights reserved by the author.

The Start of a Beautiful Friendship

Being able to optimize software development is very important but the practice of optimizing can be a constant battle when attempting to create good software. The last class I took prior to CS-343 was CS-373, an Operating Systems course. The final project of that course had us create our own phone applications, and while it was exciting to finally work on such a project, it turned out to be very difficult in some aspects. I had the idea of creating a finance app. It was supposed to record ones spending habits throughout the coming months and weeks- planning out a minimum amount they should spend and save. I thought it was going to be very easy to implement and I wrote down ideas that the application software was going to include such as a credential screen, a colorful UI, a splash screen with the logo, etc. The idea of implementing a way of connecting actual bank accounts to gather information was also in play. Unfortunately due to my lack of experience It was hard for me to complete my vision and at the end of the day, I was only able to submit an unfinished application.

There were many reasons for such results, first off, the code was a mess. I would write countless lines of code, and the program, for being a simple finance application, took ages to write. I had to implement over 1000 lines of code just to record information like user spending and budget analytics. It was a nightmare because my only priority was to get my code to work but how the code was organized would stop me in my tracks. I would sit in front of my computer screen for hours looking for compiler errors or logic errors. It made development very frustrating. I’ve taken classes such as CS-348 which served the purpose of explaining how to completely avoid similar issues that I was having, but this project being my first big project, it proved to be a lot more difficult to make a habit of those practices than anticipated. With that being said, the purpose of this blog will be to record my software development process. Whether it be a new technique I’ve learned, a new technology that has really helped me, and whatnot.

From the blog cs-wsu – FindKelvin by Kelvin Nina and used with permission of the author. All other rights reserved by the author.