Question

This question is asked in a general way. In case it is hard to understand, I have added a concrete example below. I am interested in the answer to the general question.

I have a lot of experience writing programs of type X, but now I need to write a program of type Y.

Everybody says programs of type Y are easily done in language A with libraries P, Q, and R. However, I'm really only comfortable with language B (and I don't even have A installed).

It's impossible for me to know how much time I will save by using A + PQR. I do know, however, that my task will take a long time using language B.

How do professional software engineers decide what to do? Do they risk spending more time than they save by learning a new set of tools? Or do they go with what they know despite it being slow?



Same question, but A, B, P, Q, R, X, and Y are replaced with a concrete example. This question is not asking for Python library suggestions!

I have a decent amount of experience writing smallish embedded applications in C. Now, I need to write a program that displays a UI and sends/receives messages over the network.

Everybody goes on and on about how Python makes everything easy. However, since I am a Master's student whose graduation date keeps getting further away, I'm thinking about brute forcing this program using C code instead of messing around with a new language.

It's impossible for me to know how much time I will save by using Python (after fixing my broken Python/pip installation and then going through a bunch of tutorials to decide which networking and UI libraries will work for me). However, I know that I will be fighting an uphill battle doing this in C using sockets and threads...

How would a professional developer decide what to do? Invest in new tools, or keep using known techniques?

Was it helpful?

Solution

First of all, let me say this: take your time, go slow. No, I do not mean go with the option that you know it is slow. I mean do not decide in a hurry.

You should learn more languages. You should keep learning. And I do not mean when you have a project that may benefit from that in front of you. Instead, I mean in your spare time.

How long does it take to learn a new language and its standard library? Virtually forever. Often I do not finish learning the standard library of a language before a new version is out. No, you do not learn it all, you just learn what you need.

In fact, I would argue for making yourself confortable with learning new languages. Languages will evolve, the market share of languages will shift.


Alright, there are a few things we know in general about software engineering.

One of those is that the output in line of codes of a programming is roughly constant across languages. This means that using a higher level language (a languages with more and more powerful abstraction) will make you more productive.

Another thing that we know is that reusing code is good. A third party library can help you be more productive.

Treat those as heuristics when deciding.


To reiterate, take your time to decide. This can mean expending a day or two in taking the other languages and trying it out, perhaps following some tutorial. If it is true that domain Y is really easy in language A, that should be enough to confirm it. If you have to go with language X and you know that will take time... well, what are a couple extra days in the long run?


Language A and language B are not your only options. Pretending for a moment that there are no more relevant languages to the domain Y, you could look for libraries for the language B.

Oh, but there are more languages. And learning a new languages similar to B when you know B will be easier than learning a language that is a lot different from B when you know B. Thus, if you have to select a language to learn to do a task, pick one that is similar to one you already know.

Consider that people suggesting language A probably does so coming from their own experience. Similar to how you do not really know how hard it will be to use language A, they would not know how hard it is to use some other language, which could actually be better that bon A and B.


Let us talk a little about economics. Tools have costs (licensing, learning). Development has costs (time, effort, expenses). Deployment has costs (hosting, hardware). In time and money. These costs you balance.

What is more expensive for you? Tools, Development or Deployment?

If development is more expensive, you will have to invest in tools and deployment. For example, you could expend in learning a new language that allows you to complete the software sooner. Or for example, do an sloppy job, have a bad performing application, yet completed sooner, and pay for better hardware to run it. Well, if the run-time of the language that allows you to finish faster is slower, you may also need better hardware.

If deployment where the expensive part (for example, in the case of embedded applications), then you want to put the time and money in development and the tools. In this case, the tools would probably not mean a language with a heavy run-time, but a better IDE, et.al. that help you make sure you do a good quality and performant software.


Let me throw a couple wrenches at the whole thing:

  • There are plenty of libraries that have ports or binding for multiple languages. These have the potential to make the language decision secondary.
  • A software solution could be built with components developed in different languages. Taking the concrete example... How about using a language to do console/terminal application that does the networking, and using another language to do the UI and talk to the console/terminal, for example via standard I/O? If you do that, you do not need a language that can do both parts well. Thus, you could get a couple of language such that each does its part really well.

So... Creating an UI? What better than a visual designer. You could pick a language for which there is a really good visual designer.

About networking... May I suggest ZeroMQ? That is a library. Multiple, actually. There are ZeroMQ libraries for plenty of languages. Yes, including C and Python.

OTHER TIPS

Professionals generally have a handful of languages that are used for different purposes. That list of languages changes rarely, but new libraries are learned relatively frequently, especially when starting a project that's different from what we have done before.

That doesn't necessarily translate to what you should do. In your shoes, I would first look for libraries you can use in the language you already know. Don't be tempted to rewrite from scratch because a library seems hard to learn. It's almost always easier to learn a library than to write one.

If you still feel like you're spinning your wheels after two or three weeks trying libraries in your primary language, then I would try learning the language that people feel are better suited.

Don't write the entire app with one library, then the entire app with another library, then the entire app with the new language. Write a hello world, just barely enough to try it out, then add a little bit at a time.

There are many things to consider.

One of the biggest is that, since you don't know language A (Python), this could be an excellent opportunity to learn a new language. It might seem like it will take extra time, but it will probably be time well spent. At the end of it you'll have some experience in this language the next time it comes around - which is where the real benefit can be felt. Is that unknown language something you'll need in the future?

Is the new language available for your target platform?

Then there's the time and effort saved by using existing libraries that have already been tested, even if they're for a language that you don't know.

Writing any sort of new code (particularly something as complicated as a UI) can lead to spending lots of time debugging, testing, and fixing this new code. It is also possible that what you need is already available in one or more 3rd party libraries, so that is something else to consider.

The answer is probably to learn the new language, but every case is different.

Well ... seeing that I've been a professional software developer for well over thirty (ahem ...) years now, my answer would be that *"I am a student of programming languages and techniques ... always(!) room for one more!" So far I've written two languages (none of which were intended to "see the light of day"), and counting.

Different programming languages have different application because they are more-or-less targeted to different scenarios. For instance, "smallish embedded applications" would properly call for C/C++ because you have very limited hardware resources.

Whereas, for "production-level applications these days," you have sufficient resources available to let you "use C/C++ to let you build a 'higher-level language'" that is more convenient to work with. The Python language, in particular, has been engineered to make it very easy for you to define "an API," which manifests as a built-in Python object, so that no programmer who follows in your footsteps need revisit the undoubtedly very-painful "C/C++ experience" of getting the implementation of "that API" exactly right. Nope ... all they need to do now is to thank you sincerely.

In nearly every case, these days, "slow" is no longer a consideration. But "time to market" (and, generally, "software development cost") still very-definitely is. Today, we can easily afford the "inefficiency" (sic) of these higher-level tools.

Therefore: definitely embrace the plentitude of programming tools that are available to you. And, "confront head-long" the necessity to "quickly ramp-up on one more!"

Licensed under: CC-BY-SA with attribution
scroll top