Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
This week, we're updating our course layouts and descriptions. Presentation and materials always gently change over time, but just occasionally there's a need to make a step change to clear out some of the old and roll in the new. That's now happening - but over a long and complex site it's not instant and you'll see sections of the site changing up to and including 19th September.

See also [here] for status update
 
Introduction to the C plus plus Programming Language

WHAT IS C++?

C++ is an object oriented, compiled, low-level, reasonably portable programming language. It's based on C, and it maintains C's syntax. If you're going to learn C++, you'll do very well to have a grounding in C first, or to take a course that covers the relevant C syntax as well as the C++ extensions.

OBJECT ORIENTED

First and foremost, you'll find the headlines telling you that C++ is Object Oriented.

When you write your first program, you'll write a few lines of code to perform a task and it'll work well for you. As you develop onwards to more complex programs, you'll find that you're repeating sections of code (through cut and paste) and that it's a much better idea to name these sections or blocks of code so that you can simply call them up again by name. Fairly soon, you'll find yourself moving these blocks of code out into separate source files so that you can use the same logic elements from one program to the next.

Name blocks of code in this way give you:

- Code re-use to cut down on development and maintenance time.

- Consistency across applications that make your code more
  user-friendly and less liable to show up obscure bugs.

The approach of having named blocks of code right across your suite of applications, with each code block performing a specific single task, is known as structured programming. It's streets ahead of single-block code. HOWEVER:

- As your code grows further, you can end up with conflicts
  between blocks of code that happen to have been given the
  same name.

- You would prefer a system where you're encouraged to group
  all the bits of code that deal with one data type in one place.
  That way, you'll know you have just one area to update and
  maintain as your data formats or user requirements change.

- You would like a mechanism where you can easily say that one
  type of data and its blocks of code are based on another, and
  just describe the changes in a file.

- You would like to be able to forget what goes on at the low
  level of the code when you're writing at a higher level, and
  just know what you need to put in, what the effects are and
  what you get out.

In turning your design inside out from a structured program by thinking of the data aspects first rather than the code aspects, it turns out you can have all these benefits and more. At the expense of a few surprises early on, as your project grows in size, it turns out to be very extensible under object orientation.

COMPILED

C++ is a compiled language. You write a source code file using any editor that you find convenient and that can produce a plain text file output, and you save that file.

You run the source code file through a compiler, and that produces an object file which is a snippet of binary code suitable for your target computer architecture and operating system.

The object file itself is not a complete application. You then need to use a loader/ linker/taskbuilder to roll it in with all the other pieces of code, both yours and standard pieces from the library, before you come up with the final executable file.

LOW LEVEL

C++ is often described as a low-level language in that you have the full control as you code over how memory is allocated, and you can program down to a bit/byte/ register level if you wish. For some applications where performance is paramount, this is exactly what you want. For other applications where you're rushing to develop the code for use just a few times, C++ won't be the language for you unless you're reusing lots of existing code, and/or you're already very familiar with C++ but you're not skilled in other languages such as VB, Python or Perl.

PORTABILITY

C++ executable programs are not portable between operating systems/CPU types. And yet I said earlier on that it's "reasonably portable", didn't I?

The portability is at a source code level. It's possible to recompile the same source code under a different compiler, to generate object files and ultimately an executable file for different operating system and hardware combinations.

However, even at the source code level libraries do vary and you need to be careful as you develop code. You'll find that there's a great deal of open source code devel- oped in C++, and that the first stage of installing it onto a target machine is to run a configuration script that looks around the machine and finds out all the compiler details, library details, and more, that it needs to get the configuration right.
 
So, C++ is portable. But it is not just a case of transferring source and running (as it would be with Perl or Python), nor is it simply a case of having the right virtual machine at hand to handle object files (as it would be with Java).

BASED ON C

The C language has been around for many years, and is the industry standard in which many operating systems have been developed. C is also the language in which many other languages are written. There days, however, actually writing in C has become something of a niche as most applications are now written using the superb tool sets that earlier C authors have been able to provide for us, anything from languages to servers to spread sheets to word processors with macro languages.

Being based on C, and maintaining compatibility with it, has made some of the elements of C++ quite complex. Decisions to include multiple inheritance and certain other features in C++ haven't helped to make it quick and easy to learn, and a number of other languages such as C# and Java have been developed by Microsoft and Sun respectively which take much of the intent of C++ but break the C compatibility, simplify, and provide languages which are a little more mainstream and much faster to develop.




See also Training Course - C plus plus Programming

Please note that articles in this section of our web site were current and correct to the best of our ability when published, but by the nature of our business may go out of date quite quickly. The quoting of a price, contract term or any other information in this area of our website is NOT an offer to supply now on those terms - please check back via our main web site

Related Material

C and C based languages - C++ - General
  [3809] Dwarf Exception Unwind Info - (2012-07-20)
  [3587] C++ Courses - do I get official certification at the end of my Well House course? - (2012-01-20)
  [3250] C++ - how we teach the language and the concepts behind the language - (2011-04-17)
  [3155] Rake - a build system using code written in Ruby - (2011-02-03)
  [3129] Extra courses - C and C++ - (2011-01-12)
  [3067] Using C and C++ functions in the same program - how to do it - (2010-11-24)
  [3052] Getting your C++ program to run - (2010-11-15)
  [2851] Further C++ material - view new or old - (2010-07-04)
  [2763] Our C and C++ training course are on Open Source platforms - (2010-05-13)
  [2577] Complete teaching example - C++, inheritance, polymorphism - (2010-01-15)
  [2536] All the Cs ... and Java too - (2009-12-13)
  [2504] Learning to program in ... - (2009-11-15)
  [2370] C++, Python, and other training - do we use an IDE - (2009-08-21)

C and C based languages - Introduction to C++
  [3250] C++ - how we teach the language and the concepts behind the language - (2011-04-17)
  [3069] Strings, Garbage Collection and Variable Scope in C++ - (2010-11-25)
  [3053] Make - automating the commands for building and installing - (2010-11-16)
  [3052] Getting your C++ program to run - (2010-11-15)
  [2845] Objects and Inheritance in C++ - an easy start - (2010-07-01)
  [2169] When should I use OO techniques? - (2009-05-11)
  [2004] Variable Scope in C++ - (2009-01-22)
  [928] C++ and Perl - why did they do it THAT way? - (2006-11-16)
  [336] Targetted Advertising - (2005-06-05)
  [318] Choosing a theme - (2005-05-20)
  [317] Programming languages - a comparison - (2005-05-20)

resource index - Linux
Solutions centre home page

You'll find shorter technical items at The Horse's Mouth and delegate's questions answered at the Opentalk forum.

At Well House Consultants, we provide training courses on subjects such as Ruby, Lua, Perl, Python, Linux, C, C++, Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer) many questions, and answers to those which are of general interest are published in this area of our site.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/solutions/linux-in ... guage.html • PAGE BUILT: Wed Mar 28 07:47:11 2012 • BUILD SYSTEM: wizard