Saturday, November 7, 2009

What should I #include, where do I #include, not to have circular include error

Well, I was talking to Carl about what to include in my code and where to include them, not to have circular includes in my code, and I thought this could be useful to others too:

There are two things you should consider when you have lots of classes and header files in you project;
1- in header files, try not to include other header files, instead try forward declaration, or better to say, first use forward declaration, if not possible, use include.
2 - do all necessary includes in your ".C" and ".CPP" files instead.

How to "know" if you can use forward declaration? The answer is easy;
If all you have in your class header file, are references and pointers to a class, then only use forward declaration for that class.
On the other hand, if an instance of a class is created in the header file, or if you are inheriting a class from another, then the class header file must be included. To prevent this, try passing object by reference and pointers as much as possible...

For more detail, check the IRC conversation logs between me (fardad) and [Carl89] from [14:54] to [15:05] here , and also Carl's blog on this.

Friday, November 6, 2009

The New OOP344 - Intro to Open Source continued!

As I mentioned in my last blog about this, (to attract and familiarize students to open source subjects in Seneca) I converted one of the prerequisite courses of these subject to a semi-open source format. The prerequisite course is OOP344. I did not change or remove any of the content. I just changed the tools and mothods of the student activity. I am using SVN, for assignment development in groups, Wiki for documentation, IRC for student help and blogs + wiki + IRC for student participation. The result isthe new OOP344.

What I intended was to keep the first part of the semester "closed", so students write few libraries by themselves and then use it for the second part in open format. But to my surprise, even though the fist assignment was "closed", students started helping each other to understand the concept and do their work.

I also, gave challenges in class and asked the students to blog the answer. The reward was marks for first two solutions and first two most efficient solutions.

Students started to actively blog about their work, and more to that, they took each others work and perfected it and made it their own.

So far, it has been an amazing experience. The opensource part of the semester is just started and students are diving into coding and finding themselves in a project in much larger scale than they ever encountered.

I am hoping this works to both students and open source subjects benefit in Seneca.

Our IRC channels are #seneca and #seneca-oop344 on freenode server

Monday, October 5, 2009

OOP344 tester program V 0.9 for assignment one is released

Just letting all OOP344 students know that as1test.c is released.
It is 0.9 release. Few of the tests for io_edit() is not implemented yet, but you can start testing your functions while I am implementing the rest of the tests.

Since this is not the final release there may be bugs. If you find any, I'll appreciate if you blog about it here and also send an email to me. (But if you find a bug, make sure it is a bug and not a problem with your assignment)

Happy testing :)

Thursday, September 17, 2009

The New OOP344 - Object Oriented Programming II Using C++ @ Seneca

During summer of 2009 I attended POSSE (Professors' Open Source Summer Experience) and got many ideas to help introduce students to open source.
I decided to change one of the subjects I teach in Seneca to a "Simulated Open Source Model".
I believe by doing this, I can help the students understand the open source method of development in a less stressful and more controlled environment and encourage them to take the open source subjects later in Seneca.

The first time I got involved with an open source subject in Seneca, I found out that the step from educational programming to open source programming is a little too big for many of the students.
Before the students take the first open source subject in Seneca:
  • The lengthiest program they dealt with is few hundred lines of code.
  • They have done it either by themselves or in a group of 2 or 3 students.
  • They have to come up with a solution by themselves, through research or help of the prof.
The first time a student is introduced to open source;
  • The code size of the projects is hundreds of thousands of lines if not millions.
  • They have to learn to work with huge groups developers.
  • The source of their code it open for everyone to see and criticize and they probably will never meet the person helping and guiding them in their code.
This major change I believe makes the job of the student and professor very difficult. The learning curve is very steep and students keep up with difficulty.

I believe by having an introductory subject like OOP344 as a semi open source subject, students will become familiar to the type of work awaiting them, when they take the "real" open source subject.

Since this is a college, we teach through practice; OOP344 topics are taught in parallel with developing an application that is probably the first complicated program they encountered.

In the application, the student is to take over the text-base console input/output routines of several different platforms and write some kind of simple interactive "dialog box". The IO routines are written in C language and later encapsulated into classes using C++ and then some kind of a "dialog box" is written using these classe. Eventually, at the end, an application (like a record browser) is written using the "dialog box" class.

This project is done individually.

  • The project is changed to something that is just big enough not be able to be done by one person. (a Text editor for this semester)
  • The first part of the assignment will be done individually (the basic "C" IO routines) so they can learn,exercise and then be evaluated for their programming skills. This will take 3 to 4 weeks.
  • The C++ part of the assignment will be done in teams.
  • At the beginning of the 3rd week, the students will be asked to form groups in larger teams than they usually do, ( I am thinking of up to 8 students but I am open to suggestions)
  • The Teams are required to use a repository (SVN or Mercurial... suggestions?) for their source code.
  • The assignment is fully designed. Students can, by only follow the specs, have a simple text editor. But if they want to, they can add as much features as they want or change the specs to make it work with desired features. (this should be approved by the prof to make sure the additions are feasible)
  • The students are required to blog about their work and help each other through their blogs and they will be mark accordingly for their collaborative work and their contribution.
  • They are required to maintain and contribute to the wiki pages created for the subject.
  • They are required to use IRC for their meetings and immediate questions. (I will also set "online office hours" on IRC to encourage use of IRC.)
Take a look at here for to see the course as it develops....

Wednesday, July 29, 2009

I just programmed for 8 miles....

I just got back from POSSE (Professors Open Source Summer Experience) hosted by Red Hat. It was quite an experience indeed.

I met new people with the same goal, shared experiences and learnt the way open source communities work. It gave me many ideas that I am going to work on one by one and you'll read about it here as I go through them.

It is true that I learnt many things about Open Source, but I saw something in Red Hat head quarters that I think it will change the way I work for rest of my life;

Like all other geeks I am always glued to my computer screen in worst posture possible. It gives me back pain, neck pain and after few hours of coding, I feel like I can not stand up straight any more.

Greg, during the final hours of POSSE was talking about how he walks and works on his treadmill at home and then he took us down to the offices of those working at Red Hat and there is was; a treadmill/desk hybrid!!!. It was literary a treadmill with a tall (with adjustable height) desk attached in front of it.

Taking Greg's advice on how it can cause neck pain because of looking down for a long time, I made few improvements and converted my own treadmill to a workstation; The notebook monitor is at the eye level, so while walking on treadmill I will look forward instead of down, I added an additional monitor for dual head (multiple screen) capability and also set two height settings for the keyboard (so my wife can use it too).

It took me a day and a half and 100 Dollars to build it and since then (24 hours ago) I burned 1300 calories!!
Here it is at work: [Video]

Now the only problem I have is to fight with my wife on who is going to jump on the treadmill to work(out)!!!

I will blog with closeup shots on keyboard stand and monitor stand, so if you like to convert your treadmill to a work station, you can get an idea of how it is done.

Thursday, July 23, 2009

POSSE - Day 3

Today was the most enjoying day of POSSE. We worked on Mozilla to make a little change in the way new tabs are added.

We worked on our builds on remote virtual machines and searched the code for the proper place for modification. We used Mozilla Cross-Reference for searching the code. I searched trough huge projects like before. Their search engine is called {OpenGrok. I have to admit, that searching through Mozilla code is much easier than going through

The remote debugging was too slow so I decided to check out the code and work locally on my own machine, Christian did the same but only few minutes before me and apparently someone during those couple of minutes committed a patch that broke the build.

His build was going through, but mine, doing the exact same thing was failing.
It was interesting for me to see how just couple of minutes difference in checking out the code, could cause such difference it build.

Monday, July 20, 2009

Collaborating Online

Working collaboratively, online, need some getting used to before you can really be productive. Like all other new things, it has many pros and cons;

It brings down the cost in development-collaboration by making it possible to work with someone thousands of miles away "almost" as if you are in neighboring cubicles. The communication is easily logged and nothing is forgotten. Also there is no limit to the number of people collaborating on a task.

On the other hand, the lack of physical presence can cause lots of confusion in parties; like understanding each other’s mode! (I guess that is what emoticons are for). Also managing participants of a discussion and organizing efforts and tasks could be tedious.

Having said all this, do we have a choice? Just look at the size of the communities handling the projects. Is there any other way than online collaboration? Do we have the budget to get all those taking part in tasks together for a meeting whenever something breaks down?

It is different! It lacks human touch! But like any other new thing, it will, and in fact it has become part of our lives. My wife and I, sometimes, talk with each other through our chat programs from our desks at home, instead of just turning our head and speak up!!!

I believe, if we learn to live with it, like any other piece of technology, it will help us to be more productive. (and less human?)

Sunday, July 19, 2009

Hotel sweet hotel

Well, after not being able to find any hotel on the way to Raleigh I decided to drive through the night with the exception of taking a two hour nap in the car.

I got to the hotel with no problem and got connected to Internet.

Hotel sweet hotel, time to take a loooong nap!

Saturday, July 18, 2009

On our way to POSSE

We, left home around noon and it took us 4.5 hours to get to peace-bridge boarder where it usually takes 1.5 hours! What a traffic in QEW, I guess everyone is going to POSSE ;).

Passing the boarder was a breeze. Thanks Mr. Obama! , no finger printing, or long waits! All we needed to do was to surrender out oranges to the customs officer!!!.

We passed the border in 35 seconds where it usually takes 4 hours!! So I think we are even.

Still 1024 kms to drive; till next WiFi rest area...

Thursday, January 29, 2009

Use http protocol to checkout using SVN

Checking out the source of through Seneca network, I realized that if svn's protocol is used for "checkout" it takes forever to download the source. But if http is used instead, in less than an hour the source is checked out.

Most likely, it is the ITT's routing rules that causes this...

so, use:
svn co whatever
instead of
svn co svn://

Wednesday, January 21, 2009

OOo Checkout time at CDOT

Here is the checkout time for source code:

start time: Wed Jan 21 11:03:22 EST 2009
svn co
end time: Wed Jan 21 11:35:41 EST 2009

Around 32 minutes.