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