[Open-scap] Refactoring

David Niemoller David.Niemoller at g2-inc.com
Tue Sep 22 13:25:50 UTC 2009


The attached patch file implements the refactoring suggested by Peter,
and updates the Results model.  The results model is code-complete, but
Tom and I continue to test.

I suspect that the refactoring tools I used did not penetrate into some
of the deeper probe code.  Since we are not compiling this code on our
windows development environment, I'm using a slower methods to inspect
this code.

-----Original Message-----
From: Peter Vrabec [mailto:pvrabec at gmail.com] 
Sent: Monday, September 21, 2009 8:58 AM
To: David Niemoller
Subject: refactoring

Hi David,

I'm not sure if I mentioned it before, but there is an important task we

should do before next release. It's refactoring. Why it is important?
Because 
we must avoid changes in API as soon as possible. We can manage this
task on 
our own, so there will be no work for you. But I appreciate your
comments.

So here is the list of changes:

1. function naming (there is inconsistence in this area)
let's name functions in this syntax:
prefix_object_operation_{subject}
prefix = {oval,xccdf,cve,cpe,cvss,cce}
operation = {load,export,get,add,set,cast,free,new,update}
examples:
oval_object_model_load   (no subject!)
oval_object_model_get_object

2. structure naming
There are structures like
oval_iterator_"something", we suggest to change it into
oval_"something"_iterator. 
example:
oval_iterator_sysitem -> oval_sysitem_iterator
Together with rule #1 we get function 
oval_iterator_sysitem_has_more
renamed into
oval_sysitem_iterator_has_more

The benefit? Get list of functions and structures and sort it. :)

3. enum naming
something_enum -> something_t
let's make it shorter

4. set vs. setobject
sometimes it's not clear whether "set" stands for operation or set
object. We 
can use name "setobject", so it will be clear.

5. we want to improve appearance of source codes, so we gonna use indent
on 
them with these params: "-linux -l110"
-l110 means max line length = 120chars. 
"Don't tell Steve! he doesn't like it. He is kind of old school, I'm
afraid 
his terminal use fixed font with 80 characters per line. ;)"

OK, I guess this is all. If you want to change something or propose
another 
changes go ahead. :)

btw. I must admit that it would be better to have typedef on structure 
pointers. This change was not a good step. And I know that we had
proposed it, 
so I feel responsible. :( Anyway we not gonna change it now, I can only
learn 
from it. :)

Peter.




-------------- next part --------------
A non-text attachment was scrubbed...
Name: openscap-DN-20090922.patch
Type: application/octet-stream
Size: 409195 bytes
Desc: openscap-DN-20090922.patch
URL: <http://listman.redhat.com/archives/open-scap-list/attachments/20090922/b15b6ece/attachment.obj>


More information about the Open-scap-list mailing list