cpp->setStatus( DONE );
February 2nd, 2008Finally! After half year since I bought my C++ book), I’m ready to “graduate” from that section of my roadmap and proceed to the next. I actually finished reading the book a few weeks back, but due to the hustle and bustle of January festivities, I really didn’t have the chance to get some closure, so to speak. And I thought of doing a C++ project as the perfect closure. I wanted something not overly complicated, yet complex enough to showcase and test what I’ve learned, as well as pick up a few things about the software development process. In the end, I just decided to do a very simple addressbook program named Rolodeks. My code is in here along with my first manually-made Makefile and a tarball version of the whole thing. (Please be kind, it’s my first ever serious app project
) Along the way, I noticed/realized a few things:
1. I suck at OOAD. (Object-oriented Analysis and Design). While I know the technical aspects of creating a class, I didn’t really know how to design one. I kept on asking myself again and again, should this be private, public, or protected, should I provide a setter/getter for this, etc. I guess one of the things lacking in my book is the integration of problem analysis and design into some of the example problems. I had this old C book (Hands-on Turbo C by Larry Joel Goldstein and Larry Gritz) that did just that. Even just the basics of designing classes would probably do a lot for a beginner to C++. In fairness, my book does have a sort of discussion about OOAD, but presented as a sort of add-on, rather than an important part of the process.
2. Nothing beats experience. Even if a book contained all the information and theory on software development, it still wouldn’t compare to the actual experience of writing code. Unfortunately, for months I leaned more towards the “I need theory first” excuse for procrastination, thinking that theory will properly equip me with the necessary arsenal to tackle any problem. Fortunately for me, Sho has always been there to knock some sense into me (I owe so much in that area that I should probably dub him as my Vox Rationis). Thing is, you need theory too, but it’s only half the story. Theory is nothing without practice, as they say. You can’t possibly learn everything through just reading programming books. At some point, you’ll need to apply that by actually writing code. Then, along the way, you’ll realize stuff that you haven’t really learned well enough or not learned at all. Then it’s time to learn about those. It’s a cycle. It’s a process. Either way, it needs to get started first.
3. KDevelop is… I really don’t know what to say about it. Touted as one of the best C++ IDE’s on Linux, I was really eager to give it a try. I didn’t use it while I was still learning because I thought it would overkill at that time, when my exercise programs spanned 3 files at most (main.cpp, Class.h, Class.cpp for example). But when Rolodeks grew to around 3 classes, I thought it was time to try it out. KDevelop is overwhelming, was my first and instant reaction. Unfortunately, it didn’t get better for me. For one, it’s Project system forced me to create C++ projects that used Autotools or CMake. I couldn’t just create a project with all files grouped together or let me use my own Makefile. In fact, KDevelop doesn’t even let you compile a single file C++ program at all. I might have missed some things though, since I haven’t read the KDevelop docs, but suffice it to say, I was pretty disappointed. Luckily, Kate is wonderful for what it is, and advanced text editor. With a few plugins, I was able to convert it to a mini-IDE, complete with a Makefile plugin. Although it’s still missing debugger plugins. Maybe I’ll have better luck next time.
Up next: Qt! And hopefully more exciting and worthwile software project.
Just some small updates, while I'm trying to get off my ass and migrate the site completely to Textpattern.
February 2nd, 2008 at 1:53 am
May I recommend wxWidgets and Code::Blocks IDE.
http://ubuntuforums.org/showthread.php?p=3627418&posted=1#post3627418
February 2nd, 2008 at 2:02 am
kdevelop: you need to choose “Import project” instead of “New project”, then select custom c++ makefile project. iirc
February 2nd, 2008 at 2:44 am
For object oriented design, check out the Head first series! First you read “head first design patterns”, and then afterwards “head first object oriented design and analysis”
Those are the best books ever!!
KDevelop is ok, only the autocomplete is sometimes not so good as for example eclipse(latest versions I mean, and using CDT)
Just start from a template in kdevelop, and then you are set to go. qmake is also nice for building an application, and it is supported in kdevelop!
February 2nd, 2008 at 2:45 am
@Alex Why wxWidgets when you could use Qt? Wxwidgets is ok, but I’ve used both and it can’t hold a candle to Qt. Documentation is spotty, the framework is not as well tested, and it uses some really archaic techniques like message maps. Code::Blocks is a decent IDE, but I always found it a bit unstable.
@Jucato KDevelop has its problems, and for gods sake don’t use automake and friends. They are a nightmare. Have a look at the docs for qmake and then just use that. It is much simpler than maintaining a makefile yourself. Just create your files (main.cpp, class.cpp, class.h) and then run qmake -project. it will create the .pro file for you, which is dead simple to maintain. When you add a class, just add it in there as well. Then qmake, make to build.
February 2nd, 2008 at 3:34 am
Look at you! You are so grown up now
Congrats on finishing the book homeskillet. I am with you and KDevelop, I keep playing with it though and learning more and more as I go on. I am still quite partial to Eclipse though, I think overall Eclipse is an easier IDE to use, and even with the new Qt plugins it is still quite nice, of course when those plugins don’t cause Eclipse to crash all of the time.
Anyways, just wanted to say good job! And the “Head First” books that Tom talked about, they are really good. I will check out the 2 books he recommended on Amazon right now as a matter of fact.
February 2nd, 2008 at 4:21 am
Congratulations! I’m glad you’re having fun with C++ now.
Keep up the great work, and I hope to see more of your code making its way to the open source stream of consciousness.
February 2nd, 2008 at 6:00 am
see this book on c++ programming
How to Think Like a Computer Scientist: C++ Version, by Allen B. Downey.
http://www.greenteapress.com/thinkcpp/
February 2nd, 2008 at 9:15 am
Hi, I’ve been using kate for c/c++ development, I would ask which extension did you use.
Since I tried many ways to turn it in a textmate like editor.
February 2nd, 2008 at 6:23 pm
@ALex: Maybe I’ll give wxWidgets a spin *after* Qt. While I was sort of curious about another cross-platform C++ GUI toolkit, it’s not a priority at the moment.
@mik, Tom, Leo S: Thanks for the tips on KDevelop and qmake. I’ll be giving them a try sometime. Although since my next focus will be Qt, qmake will be what I will use anyway.
@Tom & nixternal: Currently looking for reviews on those two books. Might add them to my “to buy” list if they’re good and not too pricey.
@Michael: Thanks for the encouragement! Haven’t heard from you for quite a while.
@waleed: I sort of browsed that before, and I think I concluded that it wasn’t for a beginner like me. Of course, I can check it again now.
@lucky_: I used the Symbol plugin, Make plugin, and OpenHeader plugin, all available from the kdeaddons module (the kate-plugins package in most distros).
February 15th, 2008 at 10:19 am
More code dude! Keep churning out code and it won’t be long till you can code cpp in your head without the need for any IDE
Idol!
February 15th, 2008 at 10:23 am
one more thing (here i am spamming your comments again) can you incorporate some crypto for your rolodek app? might i suggest a modular one where the user can choose what cipher and hash algo to use (eg: twofish/rijndael/cast5, ripemd/sha1/md5).
February 15th, 2008 at 4:02 pm
Wow, Idol! Now a bonafide C++ programmer…congrats dude! Hope to see more codes from you soon.