Handmade Hero»Forums»Code
117 posts
Code hacker/developer
Why are people always trying to convince me to switch languages for small tasks?
Edited by Todd on
This is more or less going to be a rant post, but I think the discussion point could be useful or at least something others here may be able to relate to.

I do security engineering for work which is essentially low-level code auditing and writing programs which are designed to break and compromise other people's programs. In my space, knowledge of OS and native coding is extremely valuable but we also often use Python and tons of Python tools from GitHub too.

However, when I personally need to code up a tool (which is pretty often because I need to test things which are specific to my work environment and making my own tool is often the most effective way to do this), I often receive flak from others about using C.

People make arguments that I should be using Python or some tool. However, because I am pretty proficient with C at this point, this is what usually happens:

1. I have problem X

2. Somebody says (or I Google) a tool which is in theory supposed to aid in or completely solve problem X.

3. I spend hours or sometimes days trying to properly set the tool up because of some stupid configuration crap, poor documentation, etc...

4. Sometimes even after all of that, the tool doesn't even really solve problem X.

5. I say fuck it and I write a C program in a few hours that solves the problem.

Yet I get tons of people saying "well you had 200 lines of code, you could have solved in in 25 with Python"

But they fail to realize that my WPM on the keyboard is extremely high and thus 200-300 lines of code vs 25 isn't a problem for me at all and they both take roughly the same amount of time because the "slowness" doesn't come from actual typing text, it comes from design and implementation decisions.

People act like C cannot be used for quick and small tools effectively when it can... There's pretty much built-in quick support for argument parsing, opening files, dealing with buffers, etc... On top of that, I have access to world-class static analysis tools which I can run my tools through and they will point out any leaks, integer overflows, type problems, etc in just a few seconds.

I don't understand the fascination in our trade with constantly making new languages (which all have the exact same constructs under the hood, btw), writing 800 page books about them, and claiming that spending a week setting up a trivial tool saves time. There must be some value in someone getting really really good with 1 language and being able to solve most problems quickly with it... Let's compare it to skateboarding... Tony Hawk probably has a favorite board and the rest is up to his skateboarding skills... Why force him to keep getting new boards assuming that will make him better?

Does anyone else run into this? Discuss.

Disclaimer: NO, I do not think C is the best choice for all problems, and I do not think everyone should use it for everything. Also, Yes, I'd rather spend a week configuring a tool properly if that tool with save the company/team hundreds or thousands of hours of work... But if we're talking about a few hrs I don't see the point. This is mostly for small C programs.
4 posts
Why are people always trying to convince me to switch languages for small tasks?
Edited by mapper on
I think they just want their favorite thing to be ubiquitous.

Todd
Let's compare it to skateboarding... Tony Hawk probably has a favorite board and the rest is up to his skateboarding skills... Why force him to keep getting new boards assuming that will make him better?


In my experience, people who skate don't spend any time worrying about what gear they use.
511 posts
Why are people always trying to convince me to switch languages for small tasks?
mapper
I think they just want their favorite thing to be ubiquitous.

Todd
Let's compare it to skateboarding... Tony Hawk probably has a favorite board and the rest is up to his skateboarding skills... Why force him to keep getting new boards assuming that will make him better?


In my experience, people who skate don't spend any time worrying about what gear they use.


You do have those people that will spend hours tuning their own gear though.
45 posts
Why are people always trying to convince me to switch languages for small tasks?
At a certain level, not only is writing your own stuff often quicker than or as quick as trying to get someone elses stuff to work, but you actually learn useful things doing it - which makes it a no brainer.

For a small program the actual size matters in relation to minimizing complexity, WPM is totally irrelevant. So to the extent that a language like Python would allow you to be more expressive using less syntax than it may be a better fit for a given problem assuming you're equally comfortable with both languages. The simpler the program, the better the program.

I have no problem with informed hatred of C, but more often than not you have mediocre programmers who've merely dabbled in it at some point repeating cherry picked tropes about how inefficient or long a given program type is in C vs. Python/Ruby/etc. Those aren't even apples to apples comparisons since most C programmers are working with a custom set of libraries which give them access to the higher level stuff like dictionaries that come built into Python for example.