Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this questionI remember that in the past I found some statistics that were telling the expected size of a program based on the SLOC and programming language.
I would like to do a rough estimate for reimplementing a let's say 100k SLOC C++ project in Python.
Does anyone know where I can find these numbers?
You might want to try the program sloccount
. It is able to estimate the SLOC in a whole bunch of languages and even runs on mutiple OS'es
Well, to get your initial count with a language like C++, I'd just do the most simple thing possible:
grep -c ";" *.h *.cpp
There are sexier ways, and you can argue that it undercounts some stuff and overcounts some stuff, but SLOC is a dumb metric anyway, so spending any more time on it than nessecary is really a waste.
Now to covert to Python? Well, if we are talking a mechanical port, then I'd say use the C++ number. If you are talking a total recoding, then I'd multiply by an expressiveness factor. Wikipedia has a nice expressiveness chart for this. Again, the numbers are debateable, but debating isn't worth the effort. If we divide C++'s 2.5 by Python's 6, we get 0.416(6 repeating). So multiply that number by the total you got from your grep
, and you have your number.
Now, Let me take a moment to say that reimplementing working software in another language for no other reason than to switch languages is a really Dumb Idea. At best, if nothing goes wrong, you will have essentially just the program you started with. More likely you will have a ton of debugging work to slog through just to get back to where you were before.
First of all to estimate the development time of the original C++ source code I'd recommend taking a tool like ProjectCodeMeter and scan the source code (It will give you the number of lines of code and tell you how many hours it took an average programmer to do it from scratch), then you can divide it by some factor to account for the fact it's easier to recode rather than coding from scratch (I guess something like 1/4 of the time, but it's just a guess).
精彩评论