Cross-Platform Programming: An Open-Source Overview

Since past few months, I have been very active in cross-platform environment and open-source programming frameworks and operating systems. I have found many great tools, many things caused me some troubles, many things needed some experienced vision and some things were pretty much obvious. I find it interesting that open source community is a great community and people who actually share their experience have much more knowledge than any of the individual present in a proprietary software owning company. The reason is simple, the members of an open source community are:

  1. Open and always welcoming new ideas.
  2. They share their experience.
  3. They are welcoming the negative comments on their experience.
  4. They are not looking forward for anything to be repaid with.
  5. They enjoy programming and they like to “solve puzzles”. Most open source contributions are solutions to “real world” problems.

In this article of mine I am going to focus on the aspects of cross-platform programming and open source community impacts, that make the regular day programming even better! If you are a programmer, I would love to recommend that you take a trip to open source community and enjoy a few days off for cross-platform development. Programming itself is not just about C#, Java or Python. There are many programming languages, markup languages, compilers and tools already available in the outside world that you would love to use and get your hands dirty in.

When I started programming, I always thought that I am never going to leave this one framework. But as I started learning stuff, I enjoyed them. I really enjoyed using each and every single framework and I really want you to enjoy that same joy. :-) This article is dedicated to open source community and cross-platform languages and compilers. I will demonstrate a few of the compilers, a few languages (the languages that you know of!) and a few operating systems to try out.

Introduction: Open source community and platforms

If you are a newbie to computer programming, then you may be asking yourself what is “open-source” and what is this term “cross-platform”. Hold your thought, in this section I will provide you with a good introduction as to what these two things are. Pretty much, it could have been done by forwarding you to Google, much rude! Or I could just try to give you a simple-English introduction of these two things.

open source
Open source software is mostly research or helpful programs.

Open-source projects and communities

Ever since computers got introduced, yeah, back in the days of ENIAC, MANIAC and so on. Back in those days, computers were not as easily programmed as they are right now. Programmed? Even there were no “a lot of” programming languages. There were just a few, FORTRAN, Assembly language, COBOL and so on. In those days, Dennis Ritchie, the great programmer at AT&T, developed C programming language because every time a new mainframe was created. He had to re-write the software for it from ground-up. He invented C, implemented the first C program and indeed used Assembly language to compile the C programs. He did not keep it to himself, he created

  1. C language
  2. First compiler for C, at that time it was written in Assembly language
  3. Unix
  4. A concept that, “Everything is a process, unless it is a file“.

He did not keep them to himself. Instead, he shared the compiler, language, operating system. That is a separate story that AT&T claimed the proprietary rights later. But, Dennis did what he could.

This way, open source community started in computer universe. Open-source, as the name states, means a project or program or algorithm, whose “source code” has been provided “openly” to the public without having them to pay anything at all, but respect! Thus open source community means a community where programmers:

  1. Look forward for real-world problems and confusions.
  2. Find a logic for that problem.
  3. Develop a solution for that problem, in a way that they can.
  4. Implement the solution for themselves.
  5. Share the solution
    In its full form. Without claiming anything, and allowing anyone to use it.
  6. Community reviews and share their opinions (positive and negative) on the solution.
  7. Community can also make changes to the solution, to make it better.
  8. Then forward the updated version.

Not only just this way helps other programmers, but it also invites more advanced genius people to contribute their ideas too, forming a big great idea.

idea
                                               Collective thinking can result in a great idea

I am highly convinced that every programmer who plays his part in open source community does earn something, respect. The most valuable factor in this universe. They are the unsung heroes.

superhero
                       Superheroes do not need to be praised! They just do the good stuff.

If you make up your mind to contribute toward open source communities, I would recommend that you do so. It doesn’t only share your views with the world but also makes it possible for others to fix your mistakes so that you know where to focus next time.

How to contribute?

Contributing to open-source community is very simple. Create a new project and just publish it. You can:

  1. Publish the project on one of the open source communities, such as GitHub.
  2. Publish the project on one of the online communities that are available for such purpose. C# Corner is one of such communities. Members there would love to see what you make!
  3. Publish the project on your blog or website to get some audience.

But before you do that, please read the terms and licenses. Even open source projects need a license so that “you continue to earn the respect“.

Open source initiative.

Cross-platform support: Meaning?

That was the discussion for open source projects. Now let us discuss a few things about cross-platform support. But first, you need to understand what a platform itself.

cross platform
Did you know: Cross-platform is also a platform, supporting minor platforms?

What is a platform?

A platform is a computer hardware and software combination on which a program runs. A platform is a combination of both hardware resources, such as:

  1. CPU frequency
  2. RAM size
  3. HDD space
  4. GPU capacity
  5. Much more based on your program.

And also the software platform being provided to install on, such as:

  1. Operating system
  2. Third-party or extended framework; .NET or JVM for example.

These collectively create a single platform. You develop an application that runs on a platform, for example if you create a C# application for .NET’s WPF or WinForms platform, application will only run on that framework; .NET framework. Similarly, the applications that you develop for Windows won’t run on Linux and the ones for Linux won’t run on OS X for Mac. That is why, keeping the platform in mind is one of the most important factor to be kept in mind while programming.

What is cross-platform support?

Cross-platform support means to support and run on multiple platforms. In a sense, it means that a code is able to run on multiple frameworks, platforms, operating systems and machine architectures.

A cross-platform programming language is the one that is able to run on multiple frameworks, operating systems and machine architectures. There are many factors that cause the language or tool to be able to run on multiple machines and platforms. Compiler, language used, statements and resource consumption is one of these things that you should consider while programming.

For example, C and C++ code is cross-platform because the compiler translates the code to Assembly language for the architecture of the machine being used. Same thing happens. I will demonstrate the use of C and C++ on multiple frameworks a bit later. For now, you should only understand what cross-platform support it.

Cross-platform also means to support devices of any size, from mobile to big screen computers.

device
Cross-screen development has been popular in web development.

Cross-platform support not only provides you with good experience on multiple platforms, operating systems or tools. It also provides you with a great set of audience. Cross-platform support “exponentially” increases the users for your application. Consider this, if you have an application that only runs on Windows. What if you can run the same application on Android, iOS, Xbox and so on and earn revenue from those platforms too?

That is why, it is always recommended to consider “cross-platform” standards also while developing an application. There are many great tools for cross-platform development. For example, you can build using:

  1. C#: C# can be used to develop for Windows, Linux and OS X using Mono.
  2. Java: Java is a very great language, high-level yes, and the bytecode can be executed by JVM wherever it can be installed.
  3. C or C++: these languages just need your compiler to be translated and fine-tuned to support a platform. The languages are fully packed with excellent power and toolset to “make your computer do anything! “

Exercise

Ever wondered how does the following C++ program always work on every platform in a similar manner?

  1. #include < iostream > int main()  
  2. {  
  3.     std::cout << "Hello world from C++.\n";  
  4.     return 0;  
  5. }  
Compile it on Windows, it would work. Compile it on Linux it would work on Linux too. Why? I would recommend that you find answers to these problems before I actually write and complete my next article, which is about how programs are executed on different platforms and frameworks.
See you in the next post.

Up Next
    Ebook Download
    View all
    Learn
    View all