General Development Archive

C++ Mediator Pattern for Object Interaction

Monolithic software products (those with a multitude of highly coupled components) are often blamed on the use of procedural languages, but it's just as easy to produce overly interdependent classes in object-oriented languages. Stephen B. Morris shows how using the mediator design pattern can help reduce class interdependencies, aid componentization & ultimately help make classes service-oriented.

Speed up Ruby-on-Rails with memcached

"Today I learned about memcached, which I'd heard of before, but never really investigated. From the project's site, 'memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.' So, even though I don't have a huge amount of traffic, I still have dynamic sites, and I'm always looking at ways to speed up my Typo blog. So, using memcached, you can get a big performance boost in databases calls, which sold me on giving it a go."

UndoDB Released

"Undo Software today unveiled UndoDB - the first bidirectional debugger for compiled programs. A bidirectional debugger allows programmers to run a program backwards in time as well as forwards. The program can be stepped back line-by-line, or rewound to any point in its history. Furthermore, programmers can play the program forwards and backwards in a totally repeatable fashion, allowing them to 'home in' on the cause of a bug."

The C++ Interpreter Pattern for Grammar Management

The world is rapidly moving away from technology-based solutions toward end-user facilitation. Simple grammars provide a surprising solution to the problem of "driving" IT infrastructure to achieve business ends. In this article, Stephen Morris shows you how to use the interpreter design pattern to create a simple C++ grammar, which can be extended to produce surprisingly powerful capabilities.

Fun with strace and the GDB Debugger

"Programming a UNIX system can be fun as well as educational. With the UNIX strace tool and GDB, the GNU Project Debugger, you can really dig deep into the functionality of your system and learn a lot about the various programs that comprise it. Using both tools in concert can be a rewarding experience as you look under the hood of your UNIX machine." Note: Hey don't look at me, I just copied the title...

Shed Skin Python-to-C++ Compiler 0.0.8 Released

"Shed Skin is an experimental Python-to-C++ compiler. It accepts pure Python programs, and generates optimized C++ code. This means that, in combination with a C++ compiler, it allows for translation of Python programs into highly efficient machine language. For a set of 16 non-trivial test programs, measurements show a typical speedup of 2-40 over Psyco, about 12 on average, and 2-220 over CPython, about 45 on average. Shed Skin also outputs annotated source code."

Finite State Machines in C++; Generic C++ for Networks

Before tackling a seemingly complex code problem with lots of functions and complex logic, Jeff Cogswell recommends trying a finite state machine - a set of states and appropriate rules and actions that go with those states - to greatly simplify your coding. Service oriented architectures sound complicated and daunting, but they're not so hard to implement. The concepts involved are actually fairly simple, and this article describes them by using examples drawn from the networking domain. Software consultant Stephen B. Morris describes some of the principles of service orientation in the down-to-earth contexts of C++ and networking.

LLVM 1.7 Released

LLVM 1.7 has been released. "This release contains a completely rewritten llvm-gcc (based on GCC 4.0.1), a brand new SPARC backend, supports GCC-style generic vectors, supports SSE and Altivec intrinsics, support for Objective C/C++, the X86 backend generates much better code and can produce Scalar SSE code, this release has initial DWARF debugging support, includes a new llvm-config utility, has initial support for GCC-style inline assembly, and includes many target-independent code generator and optimizer improvements."

Leave Eclipse Plug-in Headaches Behind with OSGi

"Find out how to write extensions in code for other plug-ins while not creating a binary dependency on those other plug-ins with the Eclipse V3.2's dynamic-extensions API. Accomplish all of this and more with the Open Services Gateway Initiative services API and the dynamic APIs. This article shows an example of one plug-in taking in XML to register extensions for a defined extension point. We accomplish this complete decoupling of components by having the plug-ins Extension Registry aware and providing an OSGi service."

C++: Defect Removal vs. Defect Survival

Defect removal is preferred over defect survival. If some defect slips through the cracks, however, the C++ exception handling mechanism helps to fortify your software's fault tolerance, as Cameron and Tracey Hughes explain. Also, elsewhere on the same site, old maps were marked with the phrase "Here be Dragons" to help seafarers steer away from dangerous places; in programming the best way to avoid dealing with bad code is to avoid writing it. Diomidis Spinellis points out 10 giveaways to spot bad code that you (or others) may have written.

Demystifying Regular Expressions

"In this article a simple usage of regular expressions is described. Its intention is to bring users to try the most powerful search and replace paradigm available and hopefully start using it. This however can not replace good tutorials available on the sites that are also mentioned in this article. The article is written reproducing actual steps I took to complete my task, to show the specifics and possible problems."

C++ Inheritance and Polymorphism

Good news! Inheritance and polymorphism can facilitate more concise code, which reduces waste throughout the lifecycle of a C++ product. By pushing more generic code into base classes, you can help reduce application code clutter as well as cutting down on code duplication. In this article, software consultant Stephen Morris insists that less code means less testing, lower maintenance costs, and easier upgrades.

Debugging Code Using ptrace

"Nobody can write perfect code, since errors can creep in from anywhere. Hence we need some way to debug the programs. One such way is to use ptrace() system call. Debugging programs like gdb are dependent on this system call. This call gives one process control over another process. The process under control can be run step-by-step and its contents can be read and modified, i.e. you can change the core image of it."