Subscribe to RSS feed

Assignment 4 -- Testing

,

Testing is another one of those things that is essential for software development, yet something I only started using in 3081. This semester I am actually taking two classes where the importance of testing is being stressed, 3081W(Project Design and Development) and 5801(Software Engineering I). The reasons to test are not as obvious as it may seem. The obvious reason might be a programmer testing if his code does what it is supposed to do, but the less obvious reasons are to test that the program does not do what it is not supposed to do, or that it meets "business requirements" (a statement that shows up often in Software Engineering especially). Testing for what is not supposed to happen is harder than testing for expected behavior. One has to test for boundary input, invalid input and weird external things like what will happen if the power goes out and system reboots? Those are just some examples of the reasons to do testing. Being that there are so many reasons to test there are different flavors of testing to try and achieve it all. Some of those include unit tests, component tests, integration, regression, system, black and white box testing. For me to cover all of them would be a fruitless endeavor, as I am relatively new to the concept. The little exposure I do have through 3081W, is unit testing and CxxTest as the tool to do it.

So, in more detail, unit testing is testing of specific functions or specific (small) units of code(where unit can be a method or a single class). When unit testing the programmer doesn't just check if the code fulfills a business requirement but also if given inputs the code behaves exactly as expected. Now, this goes for both "good" and "bad" inputs, as it is a good idea to write tests that check expectant failure behavior. This particular area however, is where challenges might arise. As with all tests it is the programmers job to come up with the ranges of "good" and "bad" inputs. That being said, once the unit tests are written they can be augmented with new tests as as the project grows in complexity. This allows a systematic and paced way for the programmer to come up with a good range of possible inputs for the unit tests instead of doing it all at once in a more general test at the end once the large project is over. This incremental approach that unit tests afford really help the programmer in satisfying one of the major requirements of every test -- thoroughness. Another important feature that every test in programming needs to strive for and unit tests can provide is independence. Things like mock objects and fake inputs not only allow to test almost the whole gamut of inputs, but also allow to isolate each and any part of the code to ensure that it works correct.

As with every good idea, someone takes it and makes it better. The way that happened to unit tests is the invention of the many widely available testing frameworks. A testing framework adds more than just the convenience of filling in a few lines of repeated code -- not that insignificant feat in itself as boring "repeatable" parts of coding can often be the cause of programmer error(and thus result in false test results). Testing frameworks also allow the tests to be automated, professional and repeatable --- another 3 important hallmarks of a good test. These three hallmarks I think are especially important in a group project type setting as instead of writing your own tests in one's own unique and quirky way of writing code the testing framework allows for a standardized way for the programmer to write tests. Moreover, having the tests in the framework speeds up the understanding of another programmer who is later trying to augment or simply to understand the tests. Moreover, the framework setting also eases automation allowing someone who knows nothing of the content of the tests to still be able to run them.

The only framework I am familiar with is CxxTest and it pretty much provides all the benefits above. Something that I found a little unsettling at first is using code I don't completely understand. To create tests it is only necessary to include the file that is being tested and use CxxTest's function calls in a CxxTest header file to create the tests, the framework will generate the cpp behind the scenes. As someone who is used to understanding all the in's and out's of what I am turning in this was little unsettling. Another personally challenging thing I found is coming up with good mock input, but once done the set up of TS_ASSERT_EQUALS doesn't require much more thought to implement.

After using CxxTest I think of testing frameworks in context of backing cookies. Backing cookies is good but difficult, so testing frameworks are a form of a ready-bake variety -- you just add some ingredients and you can pop them in the oven!

Assignment 3 -- Subversion

,

Now that I know what it is, I think there is no one out there in their right mind who would suggest against using at least some kind of source control. That being said, this is the first course I had to take in computer science where I actually get to use it. In this assignment I need to explain the concepts of source control and the specifics of a source control client called Subversion. I have come to think that everything is understood better in terms of contrast. So, it comes down to "yes-source control" / "no-source control" and "yes-subversion"/"no-subversion"? No, that's not right --- I hear there are other options for source control out there, like an older incarnation of svn--cvs or many of the new"er" kids on the block from the proprietary camp with fancy names like "Synergy" or "Plastic". The only one I know is subversion, so can I compare it to Dropbox? The "subversion" for the vanilla non programmer population.


Before I get into that, what is source control (sc)? Short answer -- it is what made me disillusioned with DropBox -- as apparently it's not that original. Long answer -- it is a way to maintain a record of all changes made to a particular document, be it a c++ source or a plain old .docx. The reason it is a good idea is it allows for collaboration, accountability, backup/rollback if an error had been made, and management of releases. If multiple people are working on the same file, source control will either aid in reconciliation of the conflicts by merging different parts together or highlighting the conflicting parts for humans to sort out. Some sc models straight out forbid such an occurrence by making files in sc read-only and only allowing one working copy at a time.

How to pick the correct sc client? In the end, it all comes down to a few very important functions that every source control client must have in order to be better than storing everything on your flash drive. These important functions are: revision record, ability to roll back, ability to merge and resolve conflicts, collaboration, common source storage, and true-atomic-commits to prevent corruption of half-finished/interrupted uploads. Some of the more advanced (frosting?) type functions are: ability to create "read-only" tags, support for branching(with revisions having non-integer increments in a branch), comments on commits, and support for multiple platforms. There are actually a myriad more functions that source control clients offer but which I have no direct experience in, and/or little understanding of -- like symbolic-link versioning, internationability, parsability of output, etc.


Personally, all I know is Subversion, also known as SVN. Even so, some features of SVN I only found out by researching sc clients for this assignment, like 'parsable-output' or 'native-support for binary files' among others. What I have realized is that svn is good at is making sure commits are complete -- the true-atomic commit feature. As in, if I loose internet in the middle of a commmit and only upload changes to half of the files I actually worked on, svn will roll-back to the last complete commit. Another feature I find awesome is how I can have a working copy on my work station (doing hw during breaks of course p ), my home pc and school! Did I mention that I have different OS running on all three of those machines? That part--just blows my mind (screw Dropbox). Another excellent feature of svn is the commenting. Such small and "non-tech" of a feature, but what a sweet addition. I leave notes not just for myself but also can keep on with what my partner is doing, since with every commit I can "tweet" her what I've been up to and she "tweets" back with her next commit. Yes --- enter the real 3081W twitter.

There are other important features of subversion that I have been using, for example once I broke my code and had gone too long without compiling it so I could not tell where I messed up. Instead of breaking down over just how little ctrl-z remembers I simply copy/pasted from iteration_1 tag folder. Thus it makes sense to make the tags read-only, though svn does not offer that, so I just need to watch myself. Another important feature would be branching, but we don't have that major of bugs, neither did we have any releases -- so I offer no feedback on that.


All in all, SC is essential and SVN is pretty good as far as I can tell. Let me know if I missed anything in the comments.



Assignment 2

Iteration 1 deadline has passed and the fruit of mine and my partner's labours is on the chopping block (also known as the subversion repository) for the TAs. Now for my second assignment I need to describe some of the challenges encountered when working in a pair environment and how we addressed them, as well as discuss what we’ll try to do different next time. One of the major challenges that I encountered when working with a partner was the issue of time constraints, and another challenge is work styles.

“Deadline" is quite a relative concept, and thus the challenge. Yes, the absolute deadline exists, but in reality we both have our own separate commitments. Thus, while we might have x number of days to work on the assignment actual availability depends on our individuals schedules as well. To address this conflict we tried to sync our available times, but maybe next iteration we should plan out our availability to work together when we have a better idea of how much time the project might take. If this is not done than too much work might be left until the last few days.

The second challenge that I encountered is the difference in work styles. I am quite comfortable at holding the monitor in an unblinking stare for hours on end. My partner on the other hand has a different approach, one where she works a few hours at a time taking breaks in between. This conflict I think is easier to address. Now that I know my partners preferences I’ll plan accordingly and try to finish the easier parts by myself and leave the complicated things that will need two heads to figure out to our group sessions.

Basically, working together is great as long as both partners clearly communicate the amount of time available and expected time commitments for each session. These types of conflicts will take some adjustment to solve as issues relating to time management and work styles extend beyond this class or this project. Moreover, adjusting one self to someone else is always difficult, but there are always upsides. Being flexible is just as important as being good at programming, as working alone I won’t be able to complete complicated large projects on time no matter how good I am.

Blog Post 1 (This is homework)

,

This semester I am taking one of the core classes for computer science, 3081-Program Design and Development. Part of the course is writing assignments. For my first assignment I have to describe two things I feel pretty comfortable with that will be tough in this class, and two things which will be completely new to me. However after attending the introductory lecture and looking again at the syllabus I realize that I actually know very little and can’t claim true comfort to anything that is on the agenda for the upcoming semester. Of course, it could be that I am just humble, or nube at cs, or not very confident in my own ability, or any combination thereof--- but either way, I can’t really pick anything. So, for this assignment I will just describe what I am especially looking to, even though I am looking forward to pretty much everything (lest the ever looming assignment/lab due dates).
One thing that sounds awesome is learning project design methodology and models used. I know everyone says that this is not something an Entry Level should concern himself with but why bad mouth it! Hey, better learn early than late --- my own spin on an American saying.
Another is software development tools, particularly the debugger. Something tells me that peppering my program with print statements in the debugging stage is not the way to go in a professional environment.

Lastly, I just like the fact that there is a big project/serious programming component. After all, my (eventual) job title will be “programmer”, so I like to use every opportunity I can get to practice the craft.

That’s all I can come up with, could be more descriptive—but I just don’t know enough yet.
Bela
February 2012
S M T W T F S
January 2012March 2012
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29