Stipula Fountain Pen

2015-16 Term 2 Week 6: Learning Journal – UoPeople

Wow, I didn’t realize I was so far behind with the learning journal. I thought I was missing 2 posts, but it turns out I’m missing 3 :/ I decided that I’m still going to share, because there was some valuable information in them, especially for CS majors who are a course or two behind me in their studies. This learning journal is “nerd heavy” so it’s not for all of my readers, but those of you who might be taking CS 1102 1103 this term may find this handy to refer to later in your course. Here’s the raw LJ, mostly unedited… Enjoy 🙂

Dec 21/15:

Just finished the 2nd part of our graded assignment this week. I had almost no time to spend on it over the weekend – we were booked with Christmas gatherings. Luckily I have experience with I/O in other languages so, although the assignment wasn’t exactly easy, I already had an idea of what I was going to do.

My approach might of taken a few more lines of code, then using the suggested method from the assignment description, but I decided to make my output format to include each DrawTextItem on it’s own line, with properties delimited by commas. I’ve done something similar before when creating save files for a video game. I/O in that game was a little more complicated, and I eventually switched to using XML, but this assignment was the same basic idea – with less objects to worry about.

One issue I ran into however, is that I used the println method to write to the file, so my last token was being parsed as the attribute plus a “\r” at the end. I had to go into the debugger to figure out what was wrong, but it was a simple fix.

I just ended up adding a “.trim()” to the one of my lines like this:

array = currentLine.trim().split(",");

“array” is used because I’m still not comfortable with collections to know intuitively how to split a string into tokens and then add them directly to an ArrayList, from which I wanted an Iterator. So “array” is used to populate an ArrayList called tokens, and I use its Iterator to set the attributes of each DrawTextItem like this for example:


I’m happy with it. Now I just have to come up with an extension for the program and I’ll be all set!

Dec 22/15:

Managed to finish the graded assignment today. I added a feature that lets the user change the angle of the string objects using a JSpinner. Took me longer than it probably should have, because I wanted it to work from within the menu, but I ended up just creating a new JFrame instead – I was wasting too much time trying to figure it out.

Anyways, I usually spend a little time completing various coding challenges in the morning to warm up my brain, and today I completed a coding challenge on – one which I was stuck on for a while, and came back to after a break of a few weeks. I decided to start over completely from scratch, to find that what I’ve been learning in this course has really paid off. This challenge was so simple, it only took me 30 minutes to complete while enjoying a coffee and cereal with my son before taking him to the sitter’s.

The goal was to take some input which included a file extension with its associated MIME type – key word associated  – and then given a list of file names (both valid and not) you had to print in order the correct MIME types, or “UNKNOWN” if there was no associated MIME type for the file.

The solution was simple using a hash map, which I’ve gotten comfortable with over the last few weeks. So it was a nice experience to have a seemingly difficult challenge become so simple, directly because of what I’m learning in this course. It’s been challenging, but it’s paying off.

Dec 23/15:

OK, finally got everything done for this week. This is the tightest I think I’ve been with any course so far. Including this assignment, I basically had 4 things that had to be done, and it’s the last day of the unit! I normally have everything completely done by Monday or Tuesday – sometimes even earlier, that way I can study casually or just take a break if I want. But this course has been pushing me hard – I didn’t even get a chance to really finish the reading assignment, I sort of skimmed it all, and managed to take rough notes, but honestly I’m at the point now, where a lot of it isn’t really sticking.

However, all of that said, it’s clear I’m getting better at what I do. My performance at work has been improving, I’m finding a lot of coding challenges that I do for practice getting easier, and the exercise this week wasn’t too bad to complete either. I get a lot of practice with recursion outside of school, so it’s something that came pretty easy to me. I did have to do some googling to find out what methods were available to a File object, but once I had a grasp of my options it seemed pretty straight forward.

And, this is where I cut off the rest of my journal. After this point I start sharing too much source code, which probably violates our code of ethics or something at school, heh.



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Show Buttons
Hide Buttons
%d bloggers like this: