You can use a factory to instanciate the classes, or just define a base class and then use platform-specific files to define them. NFBTrans shouldn't really be cleaned up, just rewritten. use boost::spirit with a factory based on the translation you want, etc.
On 7/5/2011 2:44 PM, David Tseng wrote:
I think from perusing NFBTrans, the very least of its problems is cross platform compat, but a general lack of maintainability, scalability, and good software engineering employed while writing it. It's as if some guy just sat down, and incrementally started adding to nfbtrans.c and avoided adding any indirection. Just keep appending to main and once in a while add functions with +100 lines. Oh and also for every possible state, just add a poorly named global int. Makes my ears bleed just reading it. I think using a lexer like flex or bison's the way to go and would make parsing other braille codes (spanish, music, memeth, etc)... much easier. But, back to the topic at hand...the use of platform egnostic base classes helps tremendously. Your platform specific subclasses can do all the platform specific platform calls while you bubble up as much as you can to the base classes. Use a factory to instantiate your classes and you're pretty much set. On 7/5/11, Ken Perry<whistler@xxxxxxxxxxxxx> wrote:After the NFBTrans discussion I thought it would be interesting to put out some rules of cross platform design. The following is the best I could find. I will say I mentioned rule 2 and 5 in my last email and NFBTrans breaks rule 3 hard. It would be interesting to see a re-write of NFBtrans following these rules. http://www.ski-epic.com/source_code_essays/ten_rules_for_writing_cross_platf orm_c_source_code.html __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind
-- Take care, Ty my website: http://tds-solutions.net my blog: http://tds-solutions.net/blog skype: st8amnd127 My programs don't have bugs; they're randomly added features! __________View the list's information and change your settings at //www.freelists.org/list/programmingblind