If you only have a hammer ... or

I need to download some csv files via http from the Internet, analyze it and convert it to a more useful fomat. In the end, the C ++ program will use the data. A few years ago, I would pull out my Perl books and start writing Perl scripts to download and parse. But now with Boost and Qt, I can do the loading, parsing, and drop it into the C ++ GUI with minimal effort. Last time I wrote Perl / Python about 6 months ago. It'll probably take me more time to do this in Perl / Python, and my Perl / Python code will be shit. If the only tool I have is a hammer, does everything look like a nail? Or has time changed, and C ++ can be productive in an area traditionally dominated by script languages ​​such as Perl or Python?

+4
source share
9 answers

What is the meaning of other people awaiting a decision? If you can do work in C ++ faster and faster, do it in C ++, the end of the story.

+9
source

For your example, it seems that you will be more productive and be able to more easily solve your problem with C ++, as that is what you know.

But usually I would expect more people to use python / perl for this task.

+3
source

Why not?

If you code will be hacks due to lack of libraries / functions, then C ++ might not be the best. If this needs to be changed often, then C ++ may not be the best. If others who know Perl / Python will support it, then C ++ might not be the best. and etc.

Do you really need a GUI? Do you need speed? Nothing has changed to make C ++ a scripting language, but that doesn't mean you shouldn't use it.

If he passes common sense tests like this, then why?

+2
source

Well, if you need to build a house, the hammer will work fine. But building a house using a pneumatic frame nail is much easier.

C ++ is a great language, and you can be productive in areas dominated by scripting languages, but all else being equal, you will be more productive in using perl / python to parse text.

+1
source

C / C ++ performance issue vs. python / perl seems irrelevant to me. If you want to write your parser using Qt, Boost and any other toolboxes on the shelf, do it. You have not actually indicated whether parsing speed is a problem, but even if that were the case, it would even be important to your case.

Even if you think it might be easier in X, write it in Y if you want to try something new about this language. This seems like a pretty easy task, so just write how you want to write it.

You also need to think about future use. If this program needs additional expansion and expansion, it can provoke a certain choice of language.

+1
source

If you are more productive in C ++, then, in any case, use C ++. It’s still a good idea to learn other languages, but sometimes you need to go with what you know so that everything is done.

By the way, you probably already know this, but the Boost.Tokenizer library has CSV parsing capabilities built in through the separator of shielded lists .

0
source

From your description, it looks like you have other tools besides a hammer. The more tools you have, the more efficient you can be. Use any tools you have to complete the assignment, and sometimes buy (learn) more tools.

0
source

I like C ++. I hate compiling, starting, testing, closing a loop - especially when I need to test data.

My solution: I created a small programming environment [powered by Lua] that I embed in my C ++ applications, and I open it at runtime and do the stuff interactively. Why stay in one programming environment? Use the best of two worlds .

0
source

C ++ was not specifically designed to handle long lines of text. (Look at the old C-strings ... they were a nightmare for something serious.) In contrast, Perl was created for this kind of use.

You may be able to hide something in C ++, but the Perl solution is likely to be more reliable and convenient.

-1
source

All Articles