Skip to main content

CST 338 - Week 3

In this week's material, we expanded on what we started previously about arrays, classes, and inheritance, and put it together to create a program that simulates a deck of 52 standard playing cards and then performs basic card operations such as shuffling a deck and dealing it to "players", which are classified as Hand objects (objects that store Card objects in internal arrays).

I haven't gotten this program any kind of approval or convinced some sort of online gambling site to use it for some of the backend they use to run their casino games, but I'll keep all of you readers of this lovely blog once I do, and how much money I make (or lose) off it.

Disclaimer: I am not promoting or endorsing gambling with your assets.

Speaking of arrays, the largest multi-dimensional array I've ever used was a 10 x 10 array that an old professor of mine came up with for a simulated "Battleship" program in another class I took early in my computer science career. He came up with the classes to generate the playing field, and we had to simulate multiple games amongst two players with wins/losses/ships sunk. It was an entertaining assignment to run once my partner and I got everything working together.

I don't particularly think any single array size would be unwieldy to work with, but the worst ones would be arrays that cause memory leaks have some algorithms with awful runtimes, such as O(n^3), or the absolute worst: cause out of bounds errors. Thankfully, I've never seen such code both in school and browsing around open source projects that would be so buggy, and I don't want to think about it. However, I have a feeling I will need to face my fears eventually and fix such code in the future, so I must prepare myself mentally now.

Inheritance is a beautiful thing about object-oriented programming, and its biggest strength is simplifying program structure and allowing the reuse of good code. One of the earliest examples of when I used inheritance in code was in a homework assignment to create four classes, one superclass and three subclasses. My superclass was "Aircraft", and the subclasses were "Fighter", "Bomber", and "Cargo", and the superclass defined attributes such as weight, number of engines, and number of crew. I thought it was a simple and elegant solution to demonstrate inheritance. 




Comments

Popular posts from this blog

CST 300 - Week 4

Educational Goals My current educational goals are to finish my bachelor's degree in computer science while also gaining a deep understanding of the fundamentals along the way. I have always believed that a solid understanding of the fundamentals goes a long way in any skill since you always refer back to them. When I have gotten stuck on a problem or some skill in the past, I have always taken a step back, broken down things into smaller pieces and remembered my fundamentals, and doing so has helped me through a lot of academic and professional work so far. Although I already know basic programming and data structures, I want to learn more about them and discover new ways of thinking in order to solve complex problems.  Career Goals I started a career as a full-time software test analyst about two months ago. Even though my job doesn't involve a lot of programming, getting a degree in computer science would be really helpful in all aspects of my career, such as identif

The Final Journal

It's the end of a long, four year journey, and what a journey it has been. I never thought I could pull off finishing my second bachelor's degree four years ago when I first went to that introduction to programming class at my community college. I would like to thank all the friends I've made along the way and the people who have helped me through the last two years. Although it was difficult at times taking class while working 40+ hours a week, I'm proud of myself for making it through. I don't think I'll be a student enrolled in classes anytime soon, but I'll always be a lifelong student. See you all around.

CST 499 - Week 4

This week, our team finished most of the major features of our application, CONVEE - aside from front end style components and changes to the user settings page, our application is almost feature complete. I am proud of our group for our accomplishments and making it this far in the program. Additionally, we also finished updating our ILP pages and put together our video outline for the project video. As I have a good amount of experience now in video production (I have edited almost every single required video in each class I've taken so far, both solo and group), I am looking forward to producing this one. This week's topic covered job interviews. I don't have much experience as an interviewer myself, but one of the tips I received from my manager about interviews was to answer each question confidently, even if you feel like you don't know the answer. I feel as if that approach can backfire at times, however it's always good to approach a new or unknown situa