What are important topics in the C.

Get the code!

You don't have to be a computer scientist to program meaningful things: Almost everything that requires monotonous manual work on the computer can be automated with a little program code, without having to dig deep into algorithms, data structures and protocols. The transition from a simple batch or shell script, which only calls a few commands, to the "right" program is fluid thanks to scripting languages ​​such as Powershell or Python. Thanks to powerful libraries and frameworks, just a few lines of code can do amazing things.

Many tasks can be solved faster with a few lines of your own code than with trying to do something with a finished program for which it was not developed. That doesn't mean at all that you have to write an office suite just because the spreadsheet lacks a required function: Many applications can be expanded using macros, a built-in scripting language or plug-ins. And numerous open source projects are just waiting for new comrades-in-arms to contribute their ideas to make the software better.

Which language for what?

Programming can be learned in any language. Most of the way from the idea to the program takes place in the head anyway: breaking down the problem into manageable functional units. For example, to program the best search engine of all time, you first have to ask for the search term, then browse through the database, sort the hits and finally present the results. Writing the code in the specific syntax of the programming language does not play a major role in programming.

The same program in C, Java, Haskell, Python, PHP and JavaScript: the code outputs the numbers from 1 to 10 along with their square.

In addition, the basic concepts are similar in most programming languages: Anyone who has mastered the basics of Python will quickly find their way around C, JavaScript, VisualBasic or PHP. The methods for testing the code and troubleshooting are also similar for all languages.

Still, it doesn't matter which programming language you jump into. On the one hand, languages ​​are of different complexity and therefore different degrees of ease to learn: Before you start your first real Java program, you can't avoid thinking about classes and objects, while in Perl or Python you just go for it, similar to a batch script can type. In C, you have to do a lot of things on foot with many lines of code that are built into more modern languages ​​like Python or Ruby.

The prerequisites for starting also differ: Compiler languages ​​such as C and C ++ require - the name says it all - a compiler, typically embedded in a development environment such as Visual Studio or Eclipse. These offer a lot of help for experienced developers, but programming beginners are more likely to confuse them. It is easier to start with a scripting language such as Perl or Python, which are included with most Linux systems and installed under Windows with just a few clicks of the mouse: Here you can type your first lines of code directly into the interpreter or into any editor and see the result immediately ( see page 118).

Last but not least, the learning curves vary in steepness. In a language like Python, knowing a few basics about variables, control structures, and system functions is enough to write a program that does something useful. The Python standard library also contains a wealth of ready-made functions for reading and writing a wide variety of data formats, for data exchange over the network, for compression and encryption. Reading and parsing an HTML page is done with just a few lines of Python code. In a low-level language like C, you need additional libraries that you have to find and install first, and still have to write more of your own code.

For your project

The choice of language should also be based on what you want to program. If you already have a specific project in mind, the programming language often arises automatically. For example, once the target platform has been determined, it is best to use the language and development environment recommended by the manufacturer.

Do you want to write an Android app? Welcome to the world of Java and have fun with Android Studio. Or an app for iOS? Then the answer is currently Objective-C and Xcode - with the prospect of switching to Apple's new, modern programming language Swift soon. Desktop applications for Windows are typically written using Visual Studio in C #, C ++, or Visual Basic. For low-level Linux programs, C is the language of choice, otherwise you can write Linux applications in almost any language. Many Linux programmers forego an integrated development environment and write their code in the editor in order to then call the compiler or interpreter on the command line.

Web applications are still often written in PHP, but a modern web interface is hardly imaginable without JavaScript. Thanks to Node.js, you can now also write the server part of your web app in JavaScript. Some tasks can best be done with domain-specific languages: R specializes in the statistical analysis of data, SQL is perfectly suited for querying databases.

If you're looking to gain a professional qualification, Java - which has been the number one choice in enterprise application development for years - should be at the top of your list. Take a look at the programming language ranking from RedMonk or the TIOBE index, which sorts languages ​​according to their popularity - this also includes the demand on the job market. Both rankings have their problems, but some conclusions can be drawn from them: In addition to Java, the C family (C, C ++, Objective-C and C #), PHP, Python and JavaScript are among the most popular languages.

We would rather advise against exotic and cross-platform approaches. Of course, it sounds tempting for a web developer to program iOS and Android applications with a framework such as PhoneGap or Appcelerator in HTML, CSS and JavaScript, but the result will ultimately not be able to compete with native apps.

For everyone and everything

A multitude of everyday problems can be tackled with any programming language. Codingame.com's programming tasks, for example, can be solved in over 20 different languages ​​from C to JavaScript to Haskell (see page 130). You may have already noticed that we think Python is a good candidate in such cases because of its relatively easy introduction, the power of the language and the extensive libraries. It is not for nothing that Python is also the number one programming language on the Raspberry Pi.

In general, the libraries: don't make the mistake of reinventing the wheel! If you write routines yourself to read XML or CSV files, load a website over the Internet or sort a list alphabetically, you are investing your energy in the wrong places. Such problems have been solved hundreds of times; use the preparatory work of other developers and concentrate on what makes your application special.

There are frameworks for common tasks that do a lot of work for you. With game engines like Unity, the Unreal or the Cry engine, you can take care of the actual content of your game more quickly instead of worrying about which object is loaded into the graphics card's memory first. Web frameworks make it easy to develop web applications in your favorite programming language: Symfony for PHP, Ruby on Rails, Django for Python and Play for Java are popular. When it comes to client-side JavaScript, jQuery and AngularJS do a lot of work for you. Graphic applications on the desktop make Gtk + or Qt platform-independent. Most of the time, a framework saves you enough time for just one project so that it is worthwhile to familiarize yourself with it.

If we have made you want to start programming (again): The web is teeming with platforms on which you can also learn exotic languages ​​(p. 124). You don't need much to get started: A simple editor, preferably with syntax highlighting for the language of your choice, and a compiler or interpreter are all you need. When the projects get more complex, it is worth switching to an integrated development environment with debugger, profiler, project and version management at some point. ([email protected])

Concepts

A basic distinction is made between imperative and declarative Programming languages. The former tell the computer what to do, step by step; The latter try to describe the problem to be solved in such a way that the computer (more precisely: the compiler or interpreter) understands it and finds a solution.

Procedural Programming languages ​​- the classics of imperative programming - have freed the world from the confused, unpredictable spaghetti code of the early days of computers. They structure source texts by breaking down a program into manageable functional units - called procedures, functions, routines, modules or subroutines, depending on the language. These procedures can be called from other parts of the program with parameters and can return a result. A typical representative of the procedural languages ​​is C.

Object oriented Languages ​​- popular representatives are Java, C ++ and C # - package data ("attributes") and the functions that work with this data ("methods") in objects that interact with one another. That sounds pretty abstract, but it should make it easier to map the real world in software: A “customer” object has attributes such as customer number, name, address, payment information, etc. and offers methods that can be used, for example, to change the address or place a new order can handle. There is a separate customer object for each customer; the “customer” class defines what a customer object looks like. Object-oriented languages ​​are designed to facilitate the design and implementation of complex programs.

Functional Languages ​​belong to the declarative approaches and are particularly popular with mathematicians and computer scientists. Some classes of problems that require a lot of effort in other programming languages ​​can be solved very elegantly with just a few lines of code with Haskell and Co. Functions in the sense of functional programming have no side effects, which makes these languages ​​ideal for the development of distributed software. Functional concepts are also increasingly appearing in procedural and object-oriented languages.