Download Example3_Dissertatio.. - Department of Computer Science

Transcript
work. The ideal solution would be to somehow integrate IPv6 into the tool
so that the user can construct both firewall with just one program.
There is rudimentary support in the simulation classes to support both
versions of IP, however only IPv4 is actually implemented at the time.
Classes like QHostAddress were used to represent IP addresses rather
than unsigned int in order to make this effort as painless as possible.
3.8.4
Beautification of code
Although care was taken at all times to produce readable code, sometimes a
quick hack or an incomplete solution (allways marked by comments!) were
used to quickly get basic functionality in order to implement the “more
interesting” bits. Sometimes things were done one way when they could
have been accomplished using Qt classes that were discovered afterwards.
This section deals with the various things that can make the code more
readable, maintainable and stable.
Resolve FIXME, HACK and TODO comments
Whenever incomplete solutions were used instead of a “proper” solution,
mostly due to time constraints, these sections in the code were marked with
comments. Removing them by taking some time to produce a more correct,
more stable, faster or easier to maintain solution will be a good thing to do
and increase the overall quality of the code.
QGuardedPtr
Sometimes special care had to be taken that a pointer is never ‘dangling’,
i.e. pointing to an already deleted object. Only after implementing those
special measures (especially with the pointer that points to the rule being
dragged) I learned about the QGuardedPtr class which would have solved
all these problems.
Due to time constraints the old (but functional) method was not converted to QGuardedPtr uses. It would greatly simplify some code sections
and make the implementation of some new features far easier if the project
would use QGuardedPtr objects.
Use QDomDocument to create and load XML files
The QDomDocument class is another class I learned about after it was
“too late”. The parser for the XML firewalls is especially nasty code which
could have been implemented far nicer and quicker if the QDomDocument
had been used.
Since this class can also be used to generate XML, the save function for
XML firewalls would have been much easier and cleaner.
58