telecom • networking • design

an EventHelix.com blog


Leave a comment

More Object Oriented Design Tips

We have already covered object oriented design tips in a previous article. Here we will look at more tips that will help you improve your object oriented design skills:

  1. Class with just get-set methods points to missed delegation
  2. Replace an array of structures with an array of objects
  3. Delegate work to helper class
  4. Multi-dimensional arrays point to incomplete class identification
  5. Multiple nested loops point to incomplete delegation
  6. Class with very large numbers of methods points to incomplete class identification
  7. Don’t go overboard with inheritance
  8. Prefer delegation to inheritance
  9. Don’t scatter the abstraction
  10. Consider group of objects to split work amongst team members
  11. Use nested classes for lightweight helper classes
  12. Use templates to improve type safety and performance
  13. Divide your code into framework and application parts


1 Comment

Object Oriented Design Tips

Here are a few object oriented design tips to help you with class design:

  1. Stay close to problem domain
  2. Object discovery vs. object invention
  3. Pick nouns or noun phrases as classes
  4. Method names should contain a verb
  5. Prefix adjectives when naming inheriting classes
  6. Do not add suffixes to class names
  7. Avoid one-to-one mapping from structured design
  8. Replace multiple get-set methods with operations
  9. Model classes that handle messages as state machines
  10. Use const whenever possible
  11. Restrict header file level dependency
  12. Don’t reinvent the wheel; use STL

Manager design pattern


Leave a comment

Map C switch and if statements to assembly code

This article covers the code generation for if-else and switch statements.

Switch jump table

The code generated for a switch statement varies a lot from one compiler to another. In fact, a given compiler might generate different code in different scenarios. The choice of the code to be generated depends upon the number and range spread of individual case statements.

Different cases of generation of a switch statement are:


Leave a comment

C Function Call to Assembly Translation – Frame Pointer Operations

Even though most programming is now carried out in high level languages, a good understanding of the generated assembly code really helps in debugging, performance analysis and performance tuning.

In this article, we will discuss the assembly code generated for function calling, parameter passing and local variable management. Frame pointer operations in a function call are described in detail.

C function call mapped to assembly - learn about frame pointer operations

We follow the lifecycle of a function call:

  1. Pushing parameters
  2. Invoking function
  3. Setting up the frame pointer
  4. Dismantling the frame and restoring the callers frame at function exit
  5. The caller popping the parameters.

C to Assembly : function calls and frame pointer operations


Leave a comment

Introduction to Git with Scott Chacon of GitHub

This talk introduces the Git Version Control System by looking at what Git is doing when you run the commands you need to do basic version control with it. The talk covers how to use Git to do the basics, while seeing how it differs from Subversion, what staging and committing actually looks like, how it stores it’s data, how it branches and merges so nicely and how it talks to a server when pushing and fetching.

The video then describes how to look at your history with log in interesting ways. This should help Git newbies get acquainted with the popular VCS and other Git users get a glimpse of what’s happening under the hood.