DEV Community

Coral Kashri
Coral Kashri

Posted on • Originally published at cppsenioreas.wordpress.com on

Before starting a new project – The Most Important Decision

You got an idea, know some languages, have some techniques, so what are you waiting for?! Go and code up your idea! But... Is there a better/right way? Should you take something into consideration before? Will there be consequences? Before you start coding your idea, it's better to read this post, just to make sure you don't fall off the cliff.

Which languages to use?

This decision might define how good you'll be able to make you idea more than just in your head. There are hundreds of available languages, and every one have purpose, which supported by each language's pros & cons. The important thing to understand, is that you might don't know how to code with the right language for your idea, but there is nothing to be afraid of. The worst case will lead you to more knowledge and to new opportunities, there is nothing to lose.

Delivery Deadline

This might be the first thing to consider before making the language decision. Long-term deadline is the easy case. Search for similar projects that made by other people around the world on GitHub, search for libraries that support the features you need, read about languages that have required features, and when you have a complete plan how to code your idea: Go ahead and start!

Short deadlines, on the other hand, are completely different story. They might have a bad effect on the final product, because they usually force us to make bad decisions. For a young and an inexperienced developer, short deadlines usually have a negative affect, mostly, on the language selection stage. "My best language is C#, so I'll build this Atomic Bomb Simulation using it!"- as much as it might be a good decision, it might be the decision that will prevent you from successfully create this simulation. The success key here is to define short deadlines to each stage of the code, and the first deadline should be saved for the language selection stage.

Now, you don't have a lot of time to consider each and every detail for your project, and to make sure that every little detail that you want to implement is supported by the language, so you'll have to make assumptions. There are several things to consider at this point:

  • Every language you know at this point is a leverage. Look for similar projects that made using the languages you already know and see if there is a known support by the languages you already know, for your project.
  • If you didn't find any, don't be panic. As I said before there are hundred of languages out there, waiting for someone to make use of them. If you didn't find any similar project that was made using one of the languages you already know, you probably found a similar one that made with languages you still don't familiar with. If this is the case, you have to do a quick research about this language, and it might just be similar to other languages you already know, which means that the catch up shouldn't take long for you to do.
  • Worst case just triggered you: You don't know a lot of languages, and you couldn't find any project that made using one of the languages you already know, and any project that you find that much similar features that you want is written with some kind of symbols from outer-space. PANIC TIME! It's just the time to go and drink some cold juice water and relax for a little while. There is still time for creativity and for finding an appropriate solution in one of the languages you already know - but which one?

Languages - Pros & Cons

There are several main programming languages categories, which have similar pros & cons. Here we'll discuss about some of the categories, to help you with the choose for most of the projects you'll most probably deal with.

Script Languages

Simple, high-level languages, usually work best for most of the little projects. Just write some code, and launch line by line. No compilation time, easy & readable syntax, most of the time even looks like a real human speaking syntax. Script languages tend to come with a lot of external support libraries, usually with good documentation. Within no-time you can implement a really complex functionality, with only few lines of code, which in compiled languages would take hundreds or thousands of lines of code.

The cons are usually for the long term. It's really easy to lose track of the project as it grows. Script languages are usually less care about syntax and more about simplifying complex functionality.

Another con is the run times. If you care about the time it takes to the code to complete its functionality, and you have to implement some really complex requirements (E.g. simulators, real-time [RT] statistics, RT machine learning [ML] / deep learning [DL] algorithms, etc.) script languages are probably not the best choice, with one exception: As deep as you go with the language level, the harder and a time consumer the coding stage. If you don't have much time to work on the project, you probably have to consider reducing the requirements for the first product, and to come with a Demo Product, which will only demonstrate the abilities of the future complete product. This move has some pros like focusing you on the base functionality in the planning stage, giving you more time to consider the language you'll use in the final product, and it'll help to focus you on the abilities that the final product should contain.

Example Languages

  • Python - Good for general purpose projects, best to create ML/DL demonstrations/to perform research.
  • Matlab - Good for mathematical/theoretic educational practice. Today also include ML/DL features.
  • JS - A script language, usually used on websites building, we'll talk about websites later.

Web Languages

Websites are the easiest way to create beautiful & dynamic GUIs (Graphic User Interfaces). Easy languages, easy and simple syntax, simple rules, best for short term projects (Note: it also good for long-term projects with the right experience, but with more rules and frameworks which might be a little difficult at the beginning).

Web applications are built from a combination of three major parts on Client Side:

  • Page Structure - HTML tags language.
  • Page Style - CSS language.
  • Page Script - JavaScript (JS), responsible for interaction with the viewer/client.

Don't panic, it's true those are three languages, and only for the client side, but it's easier than you might think.

The cons are again: Run-times performances, and that everything you write on the client side is completely visible to your clients. If you want to hide some code from a viewer eye, you'll have to involve some server coding, but we'll discuss about it later.

Note: If you don't have time to learn the basic of the Web development (from my experience with people who did't know anything of web development, it took them less than a week to create their first simple web application), you can always use free tools to create simple & dynamic web applications.

High Level - Compiled Languages

Relatively simple, easy to learn and usually supported by external libraries. Those languages are taking care for most of the troubles of low-level languages, with a noticeable price of run times. Good to create edge-to-edge systems in a single unit, GUI & Algorithms behind. These languages are usually force OOP (Object Oriented Programming), which make the project more readable and easier to maintain in the long term.

Usually, these languages are the first students learn, because it's easy to start when everything just working as expected and it's easy to expand the functionality in no-time.

Example Languages

  • C# - One of the easiest languages to start with (Spoiler: My native language). With advanced use, allow to create powerful GUIs in almost no coding time. Also supported as Server Side language (.Net). These days, Microsoft (who created this language) makes a huge step and turning this language into a Cross-platform language.

  • Java - easy language to learn too, safer and simpler than C#. At the end, almost the same as C# for coding times, but less trivial as this language is older. The important feature: It's a Cross Platform language for many years, so this feature supported more here than it is in C#.
    An important note: Java is not exactly a compiled language, it get translated into byte-code, that runs over JVM (Java Virtual Machine). This fact is what make any Java code a Cross-Platform (as long the other platforms contain JVM).

Low Level Languages

When performance are important (maybe the most important), low level languages are probably your best bet. Freedom to do almost whatever you want to, implement complex algorithms, do mathematics calculation with high precision, complex simulations - However a great power comes with a great responsibility. You are free to do whatever you want, on your own risk. Unlike high level languages, who protect you from making terrible mistakes, no one will hold your hand here, and if you point the wrong gun in the wrong direction, which is really easy in a kingdom that allows you to do anything you want, you can get hurt.

Those languages are not for beginners, and also not for short deadlines. They give you a real power to control the system, even modify/monitoring your OS, but it easy to forget a line you should write, and to crash you system with no warning at all. Above all of that, those languages come with a complex integration process with external libraries, which will sometimes have complex documentation. Looking for easy life? A safe zone? Turn away, wrong direction.

Why using those languages at all?
The important thing to remember about those languages is their purposes: Performances & Abilities. Experienced low level developers write code sections that runs thousands times faster than the same algorithm in higher level languages, and can perform tasks than no high-level language capable of due to its protections.

Example Languages

  • Assembly/Machine Language - The lowest level language, a collection of instructions that the CPU directly performs to do a very specific task. Capable of everything, with thousands of thousands of lines of code. Very hard to code & maintain for long-term projects.

  • C - A little bit above Assembly, every line of code compiles into several lines of Assembly code (some of them even for a single line). Easier to maintain for long term.

  • C++

    This language is a little different from C and from standard low-level languages. It still affords you to be the king of the freedom kingdom, almost without limitations at all, but helps you to save yourself from memory troubles with it's special Constructors & Destructors functions.

    This language also help you to prettify your code and to make it more expressive using tools like operators overloading, user-defined literals, with C++20 also concepts, and much more.

    I always describe this language as the pros collection of both C & C#. The OOP of C#, with spicy taste of templates, and the low of C with high performances, RT support, pointers operations and more.

    This blog will be focusing on C++, due to my personal inspiration from this language. After 3 years of coding using it, I believe it has the right trade-offs between code readability, safe operations, OOP functionality, generic programming, low level operations, and challenge.

Combination

Probably the best product is a combination between some of the above. You might want to build a beautiful client application and use Web languages to do so, and also to perform some RT operations in the background and use a low-level language as a REST API for that.

Another way of combination is to call a specific part that written in one language, for an application that is written in another language. For example, calling a high performance function that got written in C, from a program that you are writing using C#. Or to call a low performance function, that performs a very complex algorithm in a few lines of code in Python, from a C code. All those combinations are legal, although very hard to perform.

Conclusion

Choosing the right language for a new project might be a very hard decision at the beginning, but by the time you'll be able to do it in no-time at all. All you need to do is to practice, and you'll get there. Please comment and share the interesting decision you've done with your projects, and the languages you like the most.

This article originally published on my personal blog: C++ Senioreas

Top comments (0)