473,378 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Extracting common functionality/ OOPL in C

Hi,
Can anyone help me on this?
Right now I have approximately 30 driver files for 30 different devices in .c (each of them have 30 ~ 40 object files dependencies). I am asked to find all the commonalities between the 30 driver files and make it a common.c or common.h. The 30 drivers files are each like 2000 lines long, with a lot of macros, registers assignments, forward declaration and function calls.

Does anyone have any idea how to approach this project?
It would be easier if C is OOPL........
all I can thought of is using struct {} and enum .......
but I don't know what to do with those common functions with little changes in them ...

Any help will be appreciated!!
Jul 12 '07 #1
5 1356
weaknessforcats
9,208 Expert Mod 8TB
Whatever you do, do not change a lot of things at once.

Create an empty common.h and common.c and find one thing to put in there.

Then change the 30 drivers to include your common.h and add the common.c to the builds. Verify the drivers still work.

Then move to the next common thing.

I had this same problem with 280 programs of 4000 lines each. I did manage to identify large areas of duplicated code, the the management was fearful of my changing them and screwing things up. I ended up doing nothing after four months of work.

You might consider doing nothing as an option for these 30 drivers and resolve to use a common.h and common.c on future drivers only.

This will definitely be a judgement call.
Jul 12 '07 #2
This is what I am afraid of.........
The files are so huge with massive dependecies,
I don't want to spend my 4 month and eventually turn out to be nothing useful...
This project has been postponed for 2 years already, and they ask me to finish it....geez!
Jul 12 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
Persionally, I wouldn't touch anything that large that is working. I would wait until a replacement project is initiated and then discard the current 30 drivers when that project implements.

Have you done a cost/benefit analysis to show how you can make money by changing a working system and possibly introducing new bugs???
Jul 13 '07 #4
No.....
I think I should..
However I am not familiar with the cost/benefit analysis..
you have any website/demonstration/sample?
Jul 13 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
A cost/benefit analysis is just adding up the cost of making all those changes, teseting them and redistriubtung code and comparing that cost to the money you will save by doing that. If you can't save more than it costs, your company loses money. Do that enough and you lose your job.

Are there any project managers where you work? They do this sort of thing all the time.
Jul 14 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Claus - Arcolutions | last post by:
I got a word document as a stream, and I want to get the text from the word document. But I cant seem to find anything to use for that purpose. The "Microsoft office ?.object" com reference, only...
11
by: fortepianissimo | last post by:
Say I have the following package organization in a system I'm developing: A |----B |----C |----D I have a module, say 'foo', that both package D and B require. What is the best practice in...
6
by: Steve Barnett | last post by:
I need to include a wizard in my application that will, as one of the steps, ask the user to select a file to open and (later) a file to save it as. The naff way to do this would be to have a...
6
by: Steve Barnett | last post by:
I need to include a wizard in my application that will, as one of the steps, ask the user to select a file to open and (later) a file to save it as. The naff way to do this would be to have a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.