Category Archives: CS343

Test test test…

First blog post!

Hi! I’m Camille, this is my blog I guess!

CS348 and CS343

From the blog Camille's Cluttered Closet by Camille and used with permission of the author. All other rights reserved by the author.

Test test test…

First blog post!

Hi! I’m Camille, this is my blog I guess!

CS348 and CS343

From the blog Camille's Cluttered Closet by Camille and used with permission of the author. All other rights reserved by the author.

Test test test…

First blog post!

Hi! I’m Camille, this is my blog I guess!

CS348 and CS343

From the blog Camille's Cluttered Closet by Camille and used with permission of the author. All other rights reserved by the author.

Test test test…

First blog post!

Hi! I’m Camille, this is my blog I guess!

CS348 and CS343

From the blog Camille's Cluttered Closet by Camille and used with permission of the author. All other rights reserved by the author.

Test test test…

First blog post!

Hi! I’m Camille, this is my blog I guess!

CS348 and CS343

From the blog Camille's Cluttered Closet by Camille and used with permission of the author. All other rights reserved by the author.

Test test test…

First blog post!

Hi! I’m Camille, this is my blog I guess!

CS348 and CS343

From the blog Camille's Cluttered Closet by Camille and used with permission of the author. All other rights reserved by the author.

Test test test…

First blog post!

Hi! I’m Camille, this is my blog I guess!

CS348 and CS343

From the blog Camille's Cluttered Closet by Camille and used with permission of the author. All other rights reserved by the author.

Test test test…

First blog post!

Hi! I’m Camille, this is my blog I guess!

CS348 and CS343

From the blog Camille's Cluttered Closet by Camille and used with permission of the author. All other rights reserved by the author.

Code Smells

For this post, I wanted to talk about code smells. I picked this topic since it was related to my software construction course, and I believe I could benefit from diving into it some more. In my course, I feel like I learned much more about design smells, but not as much relating to code smells. A code smell is a characteristic or surface indication that shows there may be a deeper underlying problem with a code. Typically, they’re easy to spot, but I wanted to learn more techniques to look for these problems. In the past, I’ve discussed refactoring, and this ties into that nicely. Learning more about code smells will allow me to become better at refactoring. In order to learn some more about code smells, I listened to episode 88 of the Complete Developer Podcast which was all about code smells.

In the podcast, the hosts discuss what code smells are, as well as methods and techniques to find code smells. I was already familiar with some of the smells mentioned in the podcast, which makes sense. I’ve been guilty of many of these as I first started learning code. Naturally, as you learn to code, refactor, and improve, you start picking up on some code smells, even if you don’t have an exact word or phrase for what the code smell is. I was much more interested in the podcast when they started discussing object-oriented smells, since this is much more relevant to what I’ve been studying most recently.

The most interesting smell I thought the hosts discussed was the Refused Bequest smell. Simply stated, refused bequest can occur when a subclass only uses a portion of properties and methods inherited from its parents. Unneeded methods can go completely unused or in some cases, give off exceptions. This is something I had never given much thought to, but it makes sense after hearing the hosts discuss it. I usually try to reuse my code as often as I can, so I could see myself making this type of error where I try to tie classes together through inheritance just to reuse my code. I’ve learned about delegation and using it rather than inheritance, but it’s not something I’m as comfortable with as I’d like. This segment in the podcast led me to go back and study delegation some more to improve my grasp on it.

From the blog CS@Worcester – Derek's Design by dereksspace and used with permission of the author. All other rights reserved by the author.

SOLID Design Principles

This semester, I spent a lot of time learning about object-oriented design. As my interest grew, naturally I wanted to learn more. In order to better my understanding of object-oriented programing, I listened to episode 142 of the Complete Developer Podcast on SOLID Principles. This podcast talks about about each of the 5 core principles of SOLID and how they’re implemented. The focus of SOLID is to make maintaining and extending code easier as a project grows. Proper use of SOLID design principles attributes to low coupling, high cohesion, and high encapsulation. It also helps to cut back on the need of refactoring, as well as avoiding code smells. SOLID stands for Single Responsibility Principle, Open-closed Principle, Liskov Substitution Principle, Interface Segregation Principle, and Dependency Inversion Principle.

The podcast reflects that SOLID design principles aren’t mandatory law, but rather should be utilized whenever they can to help improve code. The allow the code to be more flexible, but increase the complexity of the overall code. Personally, I felt that the Single Responsibility Principle was the most significant principle discussed in the podcast. To simply describe this principle, SOLID founder Robert C. Martin describes it as “A class should have one, and only one, reason to change.” In turn, following this principle can make software easier to understand and implement. Personally, this is something I tend to follow most of the time. However, there are times that I’ve tried to fit too many functions or responsibilities in a class. It doesn’t necessarily break the code, but I understand how it could make it harder to build off as the project grows.

I felt that many of these design principles tied into one another nicely in one way or another. For example, I could see a clear correlation between the Open-Closed Principle and the Single Responsibility Principle. The main idea behind the Open-Closed Principle is that objects and entities should be open for extension but closed for modification using object-oriented features such as interfaces, subclasses, and inheritance. While Single Responsibility Principle allows for modification to fix bugs, it explains how code can still be extended so long as each class has one sole responsibility. In this regard, I felt both design principles key emphasis is to avoid needless complexity. I think having this understanding now would have been beneficial for some of my prior classes, but I’m excited to have further knowledge of these tools to use in the future.

From the blog CS@Worcester – Derek's Design by dereksspace and used with permission of the author. All other rights reserved by the author.