Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.programmer > #689

Re: reengineering c++ code that uses pthreads on Sun Solaris

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.programming.threads, comp.lang.c++, comp.unix.programmer, comp.unix.solaris
Subject Re: reengineering c++ code that uses pthreads on Sun Solaris
Date 2011-06-02 13:41 +1200
Message-ID <94o81gF12lU16@mid.individual.net> (permalink)
References <9dfaebc1-94b7-4e0d-b04b-30edfc99282c@d28g2000yqf.googlegroups.com>

Cross-posted to 4 groups.

Show all headers | View raw


On 06/ 2/11 01:22 PM, My Python wrote:
> greetings All,
>
> Please respond to this posting if you have ever involved in a rewrite
> of a complicated software system or driven such a project or have
> insight into reengineering aspects:
>
> Context:
>
> Originally written using C++/pthreads on Sun Solaris, we need to
> rewrite a component of a large system, so (A) the database,
> communications (with other SW and devices), event management
> infrastructure needs to be kept (so some reengineering in order), (B)
> the rest of the logic code has to be rewritten or refactored whichever
> suits the purpose.  (C) The primary purpose of the rewrite is the code
> has become difficult to maintain. Over 180,000 lines of code and uses
> pthreads, code was written about 10 years ago with lot of changes
> impacting the code maintainablity to date.

Read "Working Effectively with Legacy Code" by Michael Feathers

http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052

> Challenges:
>
> 1. Reengineering tool for reusing the classes by feeding this huge
> amount of code (A). Rational rose chokes on this and I need a better
> tool. Do any of you use a reeng tool for this size of C++ code, if so
> throw some light this tool, forums, your experience using this, etc.

No, they tend to be more trouble than they worth.

How does the SunStudio IDE cope with your code?  Once you ave the code 
assistance configured correctly, it is a great help navigating a new 
code base.

> 2. while the logic is complicated (B), there are several portions of
> code which can be treated as modules and adapted to a clear threading
> model, instead of what we have now a hodge-podge of thread startegies,
> this will celar up the data sync issues (deadlocks) and race condition
> related bugs. But I can't find any one book that addresses various
> threading models with pthreads in context with examples (I need good
> books pictures or diagrams). Any suggestions?

Have you considered an abstraction such as boot thread?

> 3. Any suggestions on code maintainability -- that is, the design
> aspects we need to consider while rewriting. (C) Rather than pointing
> to something like design patterns etc, what is really desired is
> learning from how do others refactor/write (original code) large
> amounts of code that interacts with lot of HW devices and SW
> components?

Write unit tests for the code you are about to change.  This will 
confirm your understanding of the behaviour of the code and validate 
your changes.

If they are not already separate, make sure your application logic is 
well isolated from your low level drivers.

-- 
Ian Collins

Back to comp.unix.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

reengineering c++ code that uses pthreads on Sun Solaris My Python <mypython_2010@yahoo.com> - 2011-06-01 18:22 -0700
  Re: reengineering c++ code that uses pthreads on Sun Solaris Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-01 18:31 -0700
  Re: reengineering c++ code that uses pthreads on Sun Solaris Ian Collins <ian-news@hotmail.com> - 2011-06-02 13:41 +1200
  Re: reengineering c++ code that uses pthreads on Sun Solaris Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-02 06:06 +0000
  Re: reengineering c++ code that uses pthreads on Sun Solaris "Richard B. Gilbert" <rgilbert88@comcast.net> - 2011-06-02 10:36 -0400
    Re: reengineering c++ code that uses pthreads on Sun Solaris Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-02 20:42 -0400
      Re: reengineering c++ code that uses pthreads on Sun Solaris Miles Bader <miles@gnu.org> - 2011-06-03 10:39 +0900
  Re: reengineering c++ code that uses pthreads on Sun Solaris "Ira Baxter" <idbaxter@semdesigns.com> - 2011-06-03 10:56 -0500

csiph-web