Friday, May 8, 2009

End of the Semester

So today is the last day of class for CS 371P, which brings this semester to a close.

I've felt like I've learned a lot this semester, about both C++ and OOP. Considering that I took this class so that I could learn more about these subjects, I definitely am happy with the end results. I was also happy that I became a little more experienced with UML and using Subversion, along with other tools. I think I'll be using at least some of these tools often in the future, so I like to get as much experience as possible while taking classes at UT.

I also had fun working with new people. There can be some downsides to this, but I do like working with others, especially learning what type of techniques they use when programming. I learned at least a few new things to help me in my programming based solely on the fact that I was working with new people this semester. Of course, it was always fun to figure out some topics to talk about on this blog. The Projects and Exams were challenging, but not overly so (at least, not compared to some of my projects/exams for my Operating Systems class).

In conclusion, I'm pretty happy with how the course ended up. In fact, this last semester for me (I'm graduating this semester) has gone really well so far. Hopefully I can continue that success post-UT.

Tuesday, May 5, 2009

Eclipse

I've been using Eclipse since around the beginning of my second year at UT (almost 3 years ago). I didn't really try any tutorials or anything, so I kind of had to pick up on things on the fly. While it did take me a little while to learn some basic things, I quickly learned to love Eclipse (especially compared to BlueJ, my previous Java IDE).

One thing that bothers me though is that I don't really use some of the nicer features of Eclipse. Although apparently, I'm not doing too badly (e.g., I've been telling some people about the "Correct Indentation" tool). Nevertheless though, I'd definitely like to learn more about the things I never touch (e.g., refactoring). In case others want to learn too, I decided to put some links I just searched for:

http://aspectprogrammer.org/blogs/adrian/2006/02/tips_for_using.html

http://dmy999.com/article/29/using-eclipse-efficiently
http://unitstep.net/blog/2008/02/10/eclipse-the-best-and-only-ide-youll-ever-need/
http://www.intelligentedu.com/blogs/post/best_new_training_sites/3467/best-eclipse-tutorials-and-videos-on-the-web

Some of these may refer to Java only (especially the last one I think), but I think some of it can refer to C++ development as well.

Inheritance

Inheritance isn't really anything new to me. It is one of those things that is drilled into our heads during our first few CS courses (or that's the goal anyway).

But most of that involved inheritance with Java. Simple inheritance, more or less. The type where a class can only inherit from one other class (i.e., only one parent).

But with C++ (and probably other languages), it is evident that inheritance can be much more complicated. Multiple inheritance, protected/private inheritance, double inheritance, virtual inheritance, etc. Some of these really involve drawing a picture of the whole hierarchy to understand what is going on. Granted, some things seem to be affected by odd design choices (e.g., using the same name for instance variables in each class), but it is helpful to know exactly how to work with the classes in these situations. Well...hopefully it is helpful outside of just taking tests about inheritance anyway. :)

Monday, April 27, 2009

Distributed vs Client-Server Revision Control

Sort of off-topic from the class, but while I was upgrading to the latest version of Ubuntu, I noticed a comment about how all of Ubuntu's core development was moved over to the Bazaar distributed revision control system. Looking into this, I found a Wiki entry on distributed revision control:

http://en.wikipedia.org/wiki/Distributed_revision_control

For the lazy:

Differences

* There may be many "central" repositories.
* Code from disparate repositories are merged based on a web of trust, i.e., historical merit or quality of changes.
* Lieutenants are project members who have the power to dynamically decide which branches to merge.
* Network is not involved in most operations.
* A separate set of "sync" operations are available for committing or receiving changes with remote repositories.

Advantages

* Allows users to work productively even when not connected to a network
* Makes most operations much faster since no network is involved
* Allows participation in projects without requiring permissions from project authorities, and thus arguably better fosters culture of meritocracy instead of requiring "committer" status.
* Allows private work, so you can use your revision control system even for early drafts you don't want to publish
* Avoids relying on a single physical machine. A server disk crash is a non-event with Distributed revision control

Disadvantages

* Concepts of DVCSs are more difficult for developers to grasp as they are required to know more about infrastructure.
* It's not possible to remove or change the whole history by only one party. This may be an issue for some companies, who would like to have full control over the history.
* A centralised server tends to be favored in corporate environment where access management and selective code visibility is more easily achieved; in this sense, tighter data security.
* There are no dedicated versions at one time, There are multiple variants.

Unclear

The following points are neither well documentated nor easily understandable:

* Will DVCS often require many more merge conflict resolution by hand efforts?
* Source code is considered the "crown jewels" of a software group. Centralized version control systems have been around much longer and thus perceived to be more stable.
* Some projects want or need centralized control.
* Distributed systems can end up with a person as the central point of control, rather than a server.


I'm kind of new to revision control (just started using SVN last semester, which is client-server). I'm pretty happy with SVN, but I wouldn't mind learning more about these others, especially if they have some nice advantages (of course, have to find the right combination of advantages/disadvantages).

C#

I never really looked into this language, but it seems like I might be working with it a lot in the near-future. Fortunately, our OOP book seems to refer to it a lot, about as much as C++ and Java, which should be very helpful. I'll have to go back through some of the chapters and review some of the C# stuff again (which I might have skipped previously). I seem to recall a few peculiar things, but then again, C++ and Java do a lot of strange things too. From the little bit I've seen, it doesn't seem too bad (unlike say Objective-C).

Darwin Follow-up

So I finished Darwin about a week ago (last Sunday). Didn't go nearly as smoothly as I had hoped, although I had some "distractions" that made it a bit difficult to get started on the project when I originally wanted to (yeah, I know...if I started a week earlier, this wouldn't have been a problem). I basically more or less started it the Friday night/Saturday morning right before it was due. Because of this, whenever I found a problem with my code, I decided to stick a "band-aid" on it instead of reconsidering my overall design. Eventually, I had a lot of band-aids and some poorly (in my opinion) designed code. It seemed to work for what I tested it with (I did get a 42/50, which is decent I guess), but it definitely was not easy to use the classes I created.

I'm hoping to do a better job with Life, which seems similar in some aspects to Darwin.

Don't Miss Class

A little over a week ago, I had to miss class due to a job interview. It was my first absence of the semester, and I feel like I missed a lot of information. It seemed like more topics were covered that day than any other (about 8 topics on the calendar). I did review some of the material, and I think I understood some/most of it. But I feel like maybe I was missing something important. I did ask a few people, but it turned out that either they missed class too or they couldn't really remember anything too important.

I don't think we got quizzed (directly?) over it, and I'm understanding the new material, so I guess it isn't a big deal. But nevertheless, I'm happy that I shouldn't have to miss any future lectures. We can cover a lot of material in a short amount of time in this class, and I think it can be a bit difficult to catch-up, especially if you miss a lot of days.

Monday, April 13, 2009

Thoughts on Darwin

Originally, I was going to name this "First Thoughts on Darwin" or something like that. But that was because I wanted to make this post about a week ago...back when I had my first thoughts on Darwin. Not really accurate to have that now...

Anyway, this definitely seems like an interesting project. It seems like the most difficult project we've had, but also potentially the most rewarding. I might change my mind in a couple of days, but I think I will really enjoy this project, particularly the Object-Oriented nature of it.

I'd like to get started tonight if possible (might have to wait until tomorrow). Usually, I just start coding a solution right away, but I think I might actually do some design work beforehand (of course, I do a little design work for other projects too, but usually just in my head). This is definitely a project where good design will pay off (and bad design will really hurt). I want to make sure I make some good decisions when I'm deciding what classes to make, what they will do, how they interact, etc.

Fortunately, I already found out about a few suggestions (e.g., use a separate container for creatures instead of trying to place them directly onto the grid). I probably would have done something different...and likely more difficult.

If things go smoothly, I'd like to make at least one more post about Darwin, preferably when I am done. As I said, it seems like an interesting project, and I'd like to compare my thoughts before and after. Besides Allocator, this is the only project I've never worked on in a previous class (at least in some form).

Wednesday, April 1, 2009

Ask, and Ye Shall Receive

"Of course, as I read in another blog, I probably wouldn't mind maybe a little more OOP-specific stuff."


"I'm somewhat disappointed by the lack of reading assignments lately"


As the old saying goes, "Ask, and Ye Shall Receive."

Monday, March 30, 2009

Mid-Semester Review

I've been really slipping here lately when it comes to blog posts, although I'll try fix that from now on.

For now, I think I'd like to briefly discuss the course up until this point (about 50%-60% into the course I guess?). So far, I've been doing pretty well in the course (although I'm a little worried about the last project). Even better, I feel like I've been learning a lot. As usual from a Downing course, some of the lessons seem to cover some relatively obscure ideas, but in the end, there is a payoff. For example, the lessons about the Allocator and the Heap/Stack arrays helped to teach us about how memory gets allocated to our programs. Sometimes, the point isn't to actually use what is taught in class, but simply to understand what is going on (e.g., we saw arrays being allocated/deleted, but in practice, we'd want to use vectors).

Of course, as I read in another blog, I probably wouldn't mind maybe a little more OOP-specific stuff. I enjoy learning about C++ (probably enjoy it as much if not more than learning OOP concepts), but I do wonder how the rest of the course will be. I'm assuming we'll definitely get to the OOP stuff eventually (looks like we might get to classes and inheritance soon). Although looking at the remaining examples, it seems like it might be difficult to cover them all before the end of the semester (ugh...test 3 will be fun to study for).

I'm somewhat disappointed by the lack of reading assignments lately...ACK! Did I just say that?!

Seriously, I think it was kind of nice to do a little outside reading from time to time. Nothing crazy (60+ pages a day or anything), but just a little reading every week to supplement the lectures. I think the last reading I did for the class was about 4 weeks ago (I accidentally read Ch.4 in the OOP book a little too early), not counting any review I did for Test 2. And actually...I think I just skimmed Ch.4 since it seemed to review some concepts I'm relatively familiar with. *Edit: Granted, I could always read on my own...but what would be the point in that? Just kidding...think I probably will do that, if not now then after the semester is over (skim/read parts of the OOP book we didn't cover in class). Readings similar to the papers might be hard to find though, and I have enjoyed those (especially the last two papers).*

I think that's about all I have to say for now, but as I said at the beginning, I'll probably try to post a few more blog posts in the near future.

Tuesday, March 3, 2009

Correction on Earlier Post (Eclipse vs NetBeans)

In an earlier blog post, I was mentioning how I was trying out the NetBeans IDE, partly because I believed it had some features that Eclipse didn't offer (or at least didn't offer as easily). While that was more or less true for the versions tried out, it doesn't seem to be the case for the latest versions.

The version of Eclipse I was running is the one that Ubuntu seems to install by default. I forgot what version it is, but it is pretty old. The version is prior to the new naming conventions of the Eclipse IDEs (Europa, Ganymede, etc.). Of course, this was the case for the NetBeans IDE I installed too, but it wasn't as big of a deal (I had 6.1, and the latest was 6.5).

This past weekend, I decided to manually install the newest versions of Eclipse and NetBeans. After doing this, it became apparent that the newer/newest versions of Eclipse do indeed have support for SVN, UML, etc., via plugins or whatever, similar to NetBeans. This was my original assumption, which is why I was a little surprised that I didn't see those options in my original version of Eclipse. Of course, I'm not sure why Eclipse didn't try to tell me to upgrade to a newer version, but whatever...

So in conclusion...these IDEs are really similar. I'm sure each does some things better than the other, but I was actually somewhat surprised at how alike they are. After working with NetBeans for while (well, not that long), I can't really see too much reason to stick with it. Or, conversely, any reason why I should go back to Eclipse (other than familiarity). I think it more or less comes down to how much you like the interface for each one.

Friday, February 27, 2009

Templates

In a few of the recent lectures, we've covered function templates and the use of templates for defining new classes. In addition to the lectures, the latest reading assignment from the book (Ch 18) also covers templates (or generics as they're more generally known). For the most part, I haven't really used this to my advantage in the past, but after seeing them in use, it really seems like they can be pretty useful. They do have their drawbacks of course. It may be a little confusing to try and figure out what is going on exactly. What is going on may not be what the user intends. For example, as the lecture on Function Templates demonstrated, making calls to Function Templates can be somewhat confusing (EX: my_max ("stu", "pqr") completely ignores the non-template function that would make it work, but my_max("abc", "def") doesn't). But as shown in the example, it is nice to have a "single" function called my_max that can work with a variety of data types.

Even better is the use of templates for classes. When were producing the code for the stack in class, I thought we were limiting it to just ints (and initially, we were). But by using templates, we quickly allowed the stack to store basically any type T, as long as T supported the various operations stack used. Even further, you could basically pass in a value for the maximum size of the stack using the template syntax. This almost doesn't seem much different that simply passing in the size as an argument, but if there is only a default constructor (which takes no arguments), the max size of the stack can still provided as shown in the example (Stack x;).

The book covers some of the more confusing aspects that might arise when using templates. For example, what is the relationship between two objects that use the same template, but have different types? For example, Stack vs Stack. Or what happens if you extend a templated class in a new class, which doesn't use templates? Things can get a little confusing once you start extending these classes.

In any case, they seem like a pretty nice feature of C++ (and other languages), and I'd like to explore their functionality in the future.

Monday, February 16, 2009

NetBeans

Over the weekend, I spent some time trying out the NetBeans IDE. Basically, it is an IDE by Sun Microsystems, somewhat similar to the Eclipse IDE, which is what I (and most people I know) tend to use for a lot of our Java/C++ projects. Like Eclipse, it natively supports Java, but plugins can be downloaded to enable functionality for C++ and other languages and/or features. Some of these features are actually what I wanted to try it out. For example, one of the plugins allows you to create UML. I haven't really tried it out yet, but I did check out a sample UML project they had which looked pretty good (although the sample was for a Java project if I recall correctly). If I'm not mistaken, Eclipse doesn't have this sort of functionality, so this is a nice advantage to NetBeans. If it does have that functionality, it certainly didn't seem as easy to enable compared to NetBeans (NetBeans did require a plugin, but it was relatively easy to find and enable).

Additionally, NetBeans has support for SVN and other "versioning" tools. Once you import your project into the depository, you can simply do commits, updates, diffs, etc., all within NetBeans. There are probably some more advanced options available, but those are the basics that I was able to quickly figure out. Again, maybe Eclipse has this sort of functionality and I'm unaware of it, but it seemed pretty easy to work with on NetBeans.

I can't say whether I actually prefer NetBeans to Eclipse, at least at this point. I definitly have grown accustomed to the Eclipse layout, so there has been a bit of a learning curve in figuring out how NetBeans works. I've yet to even use the debugger, which is one of my favorite aspects of Eclipse. I've also just worked on C++ (AustralianVoting), so it isn't like I'm using it for its original purpose (Java development).

NetBeans does seem like an interesting IDE. I don't know if I'll ever give up on using Eclipse, but I think I might at least use NetBeans when it comes to certain projects. It definitely seems to have come a long way. I think I checked it out years ago (maybe 2005?), and it didn't seem nearly as good back then. I almost didn't bother to try it out again due to my past experiences, but I'm glad I gave it another shot.

Saturday, February 7, 2009

Computing Large Prime Numbers...Useless?

I used to think so. In fact, I believe it actually was useless, at least up until the 1970s. But since then, the properties of prime numbers have become quite useful for certain applications. One particular use of this computation is RSA encryption, which was briefly covered in a few of the courses I've taken here at UT.

I won't get into the specific mathematics of it all since Wikipedia/Google can provide a much better explanation than me. The basic idea is that it is easy to multiply two prime numbers together, but it is difficult to factor that product back into the original set of prime numbers. This is an example of a one-way function (also known as a trapdoor function), which basically means that the function is easy to compute but "hard to invert." Of course, given a small set of prime numbers, this isn't too difficult, despite the definition.

And that is why it is important to come up with large prime numbers. The larger the prime numbers, the more difficult it will be to factor the product back into the original pair of prime numbers. For example, could you easily factor 26,636,627 into two prime numbers? Certainly wouldn't be easy to do it with pencil and paper. Perhaps a computer could compute it if given enough time to run, but it might take a little while (certainly slower than factoring 6 for example).

Anyway, thought this was an interesting aspect to prime numbers. Oh and by the way, the factors are 3449 and 7723.

Friday, January 30, 2009

3N+1 and More

I spent a couple of hours working on the 3N+1 problem last night, most of which was actually used to setup SVN, cppunit, and a few other things on my PC. Instead of looking up some of the old code I've submitted in the past for 3N+1, I wanted to program it from memory...at least the basic solution anyway (think I still have a copy of an old solution that is optimized which I might look at). It seemed to work pretty well, but apparently I have a small bug somewhere since UVA is rejecting it (the lovely "wrong answer" reply). I ran about 50 tests (some of my own, but most from previous courses on Blackboard), and all of them passed. I'm probably missing some basic test case, although I'm not sure what. I did test a few obvious ones (i may not be less than j, input of something like "1 1", etc.). I didn't really dwell on the problem too much. I'll probably look at it again later tonight or tomorrow (along with my old solution) and figure out what dumb mistake I made...as well as how I made/picked such bad tests. I also have to work with getting Doxygen to work.

As for the other parts of the course, it is early, but I am enjoying things so far. Some of the stuff has been a bit of a review (left/right hand values, exceptions, assertions, etc.) since I've had Downing twice before. Then again, I seem to have problems remembering things like efficient ways of generating prime numbers, so I guess a little extra review here and there will help me remember these things better. As the course continues, I imagine we'll get more into the specifics of C++ and OOP. While I did take a 1 hour C++ course a year ago, I'm still relatively new to the language, so another ~15 weeks or so of programming in the language should help me out a lot (especially since I've rarely used it in the last 6 months or so).

I guess that's about it for now. I have a lot of work I need to get done over the next few days, so I better get started.


Update: Yep. Of course it was a stupid mistake on my part regarding how I did the output for the answer (specifically, 'i' and 'j'). Guess that also explains why my Unit Tests weren't picking up anything (they were just testing the answer, 'v'). Good times. Now time to do some documentation...and possibly optimize it some, although I think I may just stick with what I have.

Thursday, January 22, 2009

Test

Testing the new blog for CS371p.