02.04.06
COTS
You know what it is all about.
Useful links:
http://www.sei.cmu.edu/pub/documents/99.reports/pdf/99tr013.pdf
“The best code only comes from a good design” — Gabriel Gonzalez ’s Weblog
You know what it is all about.
Useful links:
http://www.sei.cmu.edu/pub/documents/99.reports/pdf/99tr013.pdf
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:
“[…]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++
Implementing a observer (publish-subscriber) pattern for drawing bussiness data on GUI is bit tricky since you are out of the event loop so the GUI will not be refreshed till the application return to this loop.
To make a windows refreshes out of the event loop wxWindows offer ::wxSafeYield() which flushes events suchs as paint ones and prevents of user events.
Below some lines of code illustrating the use of SafeYield:
Drawing and printing with wxWindows
void
VideoFrame::refresh(Observado *o)
{
wxMemoryDC dc;
wxBitmap tmp;
Features *ofeat, *efeat;
Frame f = (Frame ) o;
//
// new empty image
//
wxImage i(f->getWidth(), f->getHeight());
if (bitmap)
delete bitmap;
//
// Set data from the Frame
//
i.SetData(f->getData());
tmp = wxBitmap(i);
//
// Select the bitmap to draw on it
//
dc.SelectObject(tmp);
ofeat = f->getOrigFeatures();
efeat = f->getEndFeatures();
dc.SetPen(*wxGREEN_PEN);
dc.BeginDrawing();
ofeat->head();
efeat->head();
for (int j = 0; j < ofeat->size(); j ++) {
Point p0, pf;
p0 = ofeat->getPoint();
pf = efeat->getPoint();
dc.DrawLine(p0.x, p0.y, pf.x, pf.y);
ofeat->nextPoint();
efeat->nextPoint();
}
dc.EndDrawing();
//
// Detaching the bitmap so we can use it
//
dc.SelectObject( wxNullBitmap );
bitmap = new wxBitmap(tmp);
paintMe();
}
void
VideoFrame::paintMe()
{
wxClientDC dc(this);
PrepareDC(dc);
dc.DrawBitmap(*bitmap, 0, 0, TRUE);
//
// Send an OnPaint to the window
///
this->Refresh();
//
// Flush events: Calling the OnPaint method
//
::wxSafeYield();
}