1. Thou shalt not trust user inputs.
2. Thou shalt not trust other applications usage of your APIs.
3. Thou shalt not trust any files, network incoming data yourapp may process.
4. Thou shalt not overstimate the size of the destinations buffers.
5. Thou shalt close all the strings (with the NULL character).
6. Thou shalt free all allocated memory.
7. Thou shalt not allocate more resources than needed.
8. Thou shalt reuse as much code as possible.
9. Thou shalt design before coding.
10. Thou shalt DOCUMENT!!
Hereby I publish a draft of a paper, Useful Polymorphism in C, where you could find some interesting and straightforward features of Object Oriented languages applied to our favourite language. It relies in the C structures to simulate the OO polymorphism and in organizing the headers and source files in a way in helps to achive the goal.
I am not sure if I will finish the paper ever but it has enough literature to understand the whole idea and contains quite lines of code which helps to go ahead and get it working.
I know a bunch of stuff have been written about OOing C but here I just try to apply the semantic of Polymorphism avoiding the use of hilarious syntax. I hope find it interesting.
Some useful links to explore the world of 3D inside J2ME. It looks to be pretty good since it does not overload the hardware too much (you do not get hardware acceleration obviously) and still you get pretty good results in handled hardware.
I will post more on this.
Getting started with mobile 3D API
Picking objects
Simple Example
Another example
Due to my interest in bluetooth I need to start learning about J2ME, MIDlet and related stuff to achieve the goals I have in mind. Once I learn all this new information I will code, together Ruben, a very interesting and maybe 100% new mobile application.
J2ME and Midlets building documentation:
J2ME and MIDP Development
MIDlet packing with J2ME
And Eclipse ME plugin link I am stilll playing around with it, I will write a larger post due in course:
Eclipse ME Plugin
As I pinned some days ago I am very interested in verification and validation methods. While thinking in preconditions, invariants and stuff OCL came to my mind and I started diving the web looking for a OCL parser and I found an OCL ANTLR grammar: http://www.cs.columbia.edu/~akonstan/ocl/
Benjamin (HP workmate) pointed me to an Java/C++ parser tool which I can’t remember!!
I am starting a personal projects page to write down all I have in mind and get some feedback from the wee community which read this blog.
Do not forget Dresden OCL Toolkit
After speding a couple of hours talking to Pablo about computer related stuff I realized the impact of refactoring in the way of people code and how it is going to be related with tools like Eclipse.
I have been interested in this field for a year and I am becoming more and more.
Some useful links:
Practical Refactoring
“[...]testing is done throughout a development effort and is not just an activity tacked on at the end of a development phase to see how well the developers did.”
“No amount of testing will improve the quality of a computer program.”
After spending almost a day debugging a memory leak which drove my app to crash I found the problem was with a vector<...> variable. It was not possible to free its memory with the proper destructor var.~vector<...>it always crashed in ntdll. Does anyone know anything about it?
The fix was to use Type *a = new Type[size] and then delete [] a;
If anyone knows what I did wrong please write it down here!!
Since I were tought about Bertrand Meyer’s Eiffel and its nice feature of design by contract I got interested in validation and verification of systems. Since most of the code I write is in C, C++ or even Java, I have looked for elegant ways of including contracts in C & C++. Next is what I am going to use in next developments.
Design by Contract in C++
The document is written by the author of “Imperfect C++”: Imperfect C++