cpgf library one year birthday -- a review of past one year

cpgf library first version was released on 2011, Nov. 05. At the time I writing this blog, 2012, Nov. 24, one year has passed. One year is not quite long time for a long term open source library project, but a lot of development had been done in the year. I will give a review on what happened on cpgf in the last year. Looking back is for better looking forward!

A comparison between cpgf version 1.0.0 and version 1.5.2

Version 1.0.0 is the first released version. Version 1.5.2 is the latest version up to the time writing, 2012, Nov. 24.

Below I list several comparisons between the first and the latest version. Just funny reading.

Download file size

The distribute zip file size in day first (v1.0.0) is 262 KB, now (v1.5.2) it is 1530 KB.

Huge increment. However, almost all stuff in v1.0.0 is hand-written code, while there are about two fifth in v1.5.2 is code generated by metagen.

Lines of code

There are 37K lines of code in day first. Now the number is 119K lines.

All .h, .cpp, and .java files are counted in all include, source, tools, samples, and test folders.

Though there are about 34K lines are generated by metagen now, there are still 80K lines hand written code.

Features

The first version only includes reflection and Lua script binding, while now we have a long list of features in latest version

  • Reflection
  • Serialization
  • Lua script binding
  • Google V8 JavaScript script binding
  • Python script binding
  • Tool metagen
  • Meta data for OpenGL
  • Meta data for Box2D physical engine
  • Meta data for SFML graphics and multimedia engine
  • Meta data for Irrlicht 3D engine
  • Wrappers to use C++ specify features in script, such as bit fields, operators, reference.

Unit tests

There are less than 200 unit tests in first version, while there are 1055 tests now.

Reflection syntax

Can't remember what my original opinion is, the first version utilized macros to reflect meta data. There are functions for reflection, but the library can't live without macros.

GMETA_DEFINE_CLASS(MyClass, MyClass, "MyClass") {
    GMETA_METHOD(methodGetInt);
    GMETA_METHOD(methodAddInt);
    reflectMethod("getData", &MyClass::getData, GMetaPolicyAllParamNoncopyable());
}

Though GMETA_METHOD can be replaced by reflectMethod, there is no alternative for GMETA_DEFINE_CLASS.

Ugly, super ugly. I changed the syntax in version 1.2.0, after three upgrading versions.

Now

GDefineMetaClass<MyClass>::define("MyClass")
    ._method("methodMakeData", &MyClass::methodMakeData)
    ._method("methodGetNCData", &MyClass::methodGetNCData, GMetaPolicyAllParamNoncopyable())
    ._method("methodExplicitThis", &methodExplicitThis, GMetaPolicyExplicitThis())
;

Not eye candy? But at least it's standard C++ syntax.

Conclusions and my thoughts

The past year 2012 is a great year for cpgf library. Lots of amazing features were added to the library. I can say cpgf is a very fast grow open source library in the year.

cpgf is still far from perfect and complete. There is a lot of work to do in year 2013. I hope I can have enough spare time to work on cpgf in 2013, like I did in 2012. However, I can't guarantee on that because I'm not sure if my daily job will be affected by current serious economic deflation. Anyway, no matter under what condition, I would try my best to develop on cpgf as usual.

Discussion

Enter your comment:
ACXKI