Question:
Can you explain the differences between these programming languages?
Spec Tac
2009-12-24 05:34:57 UTC
I've decided to pursue learning a programming language, and have received some great suggestions. Now, of the few that sound interesting, I wanted to ask what the pros/cons and differences of each of the following may be:

Visual Basic

C
C#
C++

Python


Thanks
Seven answers:
2009-12-24 06:13:44 UTC
The evolution was C -> C++ -> C#



C or C++ are "basically" the same language used for systems programming mostly. There is no built in support for Windows type of application and the interface to create windows, etc. is very difficult for new programmers. The difference between the 2 is C++ extends C by adding support for object oriented development.



C# has a lot of support for windows develoment and accessing the O/S components. To me, if you want serious Windows programming then this is the place to start these days. It has a lot of internal features in the IDE that help with developing the code. The functions and components provided make C style of programming a lot easier.



If you get into VB then you only have VB.NET these days (standard VB is no longer supported) and with that C# and VB.NET are very similar. C# eliminates pointers which is the complex part of C/C++. The only real difference between C# and VB is the language. You can do the same things with both using the same components given the .NET infrastructure and the IDE support.



These days, there is no benefit to starting with VB over C#.



Python is used as primarily a scripting language. It is always good to have at least one scripting language under your belt.
2009-12-24 06:08:01 UTC
Man, I have to desagree with the last answer.



C is a basic programming language. Basic, doesn't mean necessarily that it is an easy programming language; C is semiliar to C++, as C++ is an "extended" version of C; It introduces objects (classes) and other features that couldn't easily be made on C;



C# isn't - really, it isn't - similiar to C or C++; If you compare it to C and then to Java, you will see that C# looks a lot more like Java then C;



C# is an Object Oriented Language and C is a Sequential Language; Something like that, don't know if those are the correct terms.



C# and Visual Basic can do the exact same thing. They are both .NET based; The only diference remains on the language programming syntax, where I (against other opinions) prefere C#. Visual Basic is recommended for absolute beginners...



I can't say nothing about Python tho... I've never tried it and I don't know what can someone do with it;
Steven J Pemberton
2009-12-26 09:26:13 UTC
Very good answer from Liars never Lies.



I've been programming for about 30 years (been getting paid for it for the last 10), and of those languages, I've only ever used C. (I've used lots of others that aren't on your list.) I'm not sure I would recommend C as a language for beginners (or anyone else, for that matter). I agree that people who start with BASIC tend to pick up a lot of bad habits, which are hard to unlearn when they move to other languages.



I think I would go along with the recommendation for Python, though it maybe depends on your motivations for wanting to learn programming. Is it to improve your job prospects? Pick the one that returns the most hits on monster.com. To improve your understanding of how the computer's hardware works? Pick C or C++. To write graphical applications for Windows? Visual Basic or C#. Because you think it might be fun? Python.



In a way, it doesn't matter which one you start with, because at a very deep level, they're all the same. There is no problem that one of them can solve that the others can't. (Look up "Church-Turing Hypothesis" for the reasons why.) But this is a bit like saying, "It doesn't matter who you go on a date with, as deep down, everyone's the same. We're all Homo sapiens." Some problems can be solved much more easily in one language than in another. I wouldn't try to write a device driver in Visual Basic, nor a drawing application in C.



I think more important than starting with the "right" language, once you've spent a while learning it, you should start learning another one, preferably very different from it. That way, you'll understand not only the differences between languages, but also the similarities. You'll be able to pick up new languages more easily, and be better able to pick the right language for solving a particular problem.
Andra
2016-05-26 12:07:09 UTC
That is a very broad question, too broad to be answered in detail here. The ideas about the best ways to write programs have changed over the years, and that has affected the way that programming languages are developed. Also, different programming languages are written with different purposes in mind. For instance, COBOL was designed with the idea that non-programmers in business could read the programs. FORTRAN was designed for mathematicians. BASIC was originally designed as a language to teach programming, before structured programming became popular. People learned using BASIC, and then started writing production programs in BASIC. This led to a lot of problems, and BASIC evolved to address these problems. Many modern versions of BASIC, such as Visual Basic, bear very little resemblance to the BASIC of old. PASCAL was designed as a teaching language that includes structured programming methods. C was written for programmers. As such, it is very powerful, and very dangerous. It assumes that the programmer knows what he/she is doing, and lacks checks for dangerous things. You can do things like treat an integer as a floating point or a character, or write beyond the end of an array. C++ tried to take the best features of C, but add protections against doing dangerous things. It also added object-oriented features, which is one of the newer programming paradigms. Java aims to allow write-once, run-anywhere programming. While the other languages here are implemented on each platform where they run, and programs have to be modified for those platforms, Java is implemented on a pseudo-machine, the Java runtime. The pseudo-machine takes care of the differences between the physical machines, so the programs don't have to. This barely scratches the surface of this subject.
itk
2009-12-24 05:56:13 UTC
C language is basical. C++ has other architecture (added classes)

C# is almost same, but only for .NET (Microsoft pack of libraries)



Visual Basic is not so C-like one, its structure is of other kind. For example, it has no inheritance. Also it has same as C# property - just for Windows OS. Latest versions even require .NET too.



Python was influenced by lots of other programming languages. It can be ported for almost any system.



I think the best way for beginner is C++. It is not easiest, maybe even hardest. but this language is widely supported, it doesn't require any necessary libraries and can be used in absolutely any kind of cases.
2016-02-21 15:06:25 UTC
El día que tienesa tu bebe recién nacido en tus brazos manos es el mejor momento de tu vida, no te prives de esta felicidad aunque todos los médicos te han contado que no hay ninguna duda y eres infértil, se confunden, consigues con esta fórmula https://tr.im/EHs6k de la misma forma que he logrado y yo. Después de una larga espera y noches en lágrimas el día que quede embarazada de mi hija, ha sido y será la más perfecta de mi vida.
Lie Ryan
2009-12-24 07:31:05 UTC
Visual Basic is Microsoft's implementation of the BASIC programming language (point is: it's not a language, it's a language implementation). BASIC was originally designed as beginner's language, it is designed so ordinary people can write programs (this is important in the past, when software distribution wasn't as developed as now). This is how a typical VB program looks like:



' note: This is VB.NET syntax

' comment starts with '

REM an older style comment uses the REM keyword

REM the function finds the highest number in an array

Private Function max(ByRef arr() As Integer)

  Dim currentMax = arr(0)

  For Each number In arr

    If number > currentMax Then

      currentMax = number

  Next number

  Return currentMax

End Function



BASIC's has type inference, notice that in "Dim currentMax = arr(0)" line I did not declare currentMax's type. BASIC does not require type declaration and this is often convenient for newbies, but this also often leads to subtle bugs (e.g. if you mistyped a name).



BASIC is verbose and uses very little symbols apart from mathematical symbol, instead it uses keywords (Then, Next, End Function). In BASIC, array is accessed using parentheses, it's the same syntax as function call which might be confusing sometimes



Visual Basic is Microsoft's implementation of the language, have a tight integration with the Window's GUI-builder. Building GUI in VB is among the easiest among the languages I know of.











C is originally developed for UNIX system programming language. The language was simple and minimalistic since it is designed to be fairly easy to write a C compilers for a new platform. Due to this, there are C compilers for even a very exotic platforms. The language was designed to write OS kernel, hardware drivers, and various other low-level jobs. This is how a typical C program looks like:



#include



// the program finds the highest number in an array

int max(int[] arr, int arr_length) {

  int i;

  int currentmax = arr[0];

  for (i = 0; i < arr_length; i++) {

    if (arr[i] > currentmax) {

      currentmax = arr[i];

    }

  }

}



int main(void) {

  int i;

  int[] arr = {2,3,6,2,7};

  for (i = 0; i < 5; i++) {

    print("%i\n", max(arr, 5));

  }

  return 0;

}



C uses braces instead of keywords to delimit blocks, and every statement ends with a semicolon ";". Unlike VB, C is case-sensitive, that means max and MAX and mAX and MaX is four completely different names in C. C is strictly-typed language, every variable must be declared and its type must be explicitly specified (unlike Basic where you can sometimes omit them). This makes for a more robust code (mistyping will generate a compile-time error).







C++ is C with support for object-orientation. As you go along with programming, you'll learn about Object-oriented programming. A C++ programs looks like C program, though there are differences in what the two languages considers as best practices due to the lack of object-orientation in C. This is how a typical C++ code looks like:



#include



using namespace std;



// the program finds the highest number in an array

int max(int[] arr, int arr_length) {

  int i;

  int currentmax = arr[0];

  for (i = 0; i < arr_length; i++) {

    if (arr[i] > currentmax) {

      currentmax = arr[i];

    }

  }

}



int main(void) {

  int[] arr = {2,3,6,2,7};

  for (int i = 0; i < 5; i++) {

    cout << arr[i] << endl;

  }

  return 0;

}



The short program does not showcase the difference between C and C++ enough. Indeed object oriented is only useful on a mid-sized to large program. Unlike Java, C++ does not force you to use object orientation (you can write your program in procedural way if you wish in C++).







Python is my personal favorite language. Python's strength is a very clean syntax and a very large standard library, and the REPL (Read-eval-print-loop, will describe later). This is how a typical python code looks like:



# actually, there is a max() built-in function that does this

# but if I used that we're kinda missing the point...

def max(arr):

  currentmax = arr[0]

  for number in arr:

    if number > currentmax:

      currentmax = number



a_list = [2, 3, 6, 2, 7]

print max(a_list)



Python uses indentation (whitespace) to delimit blocks of code, the indent is part of the syntax. This is unlike C/C++ which uses braces {} or BASIC which uses keywords (Next, End If). This reliance on indentation makes for a clean syntax, you don't need to worry about unmatched braces/keywords and forces programmer to indent their program properly.



The other strength of python is the huge standard library. Often you'll find that you won't need to write any code (or you can cut down the lines of code you write) because you'll find that the standard library already contains what you want to do. The standard library contains lots of thing you'll ever need like HTML/XML, GUI, string processing, regular expression, email/MIME, urllib, zip/bz2/gzip compression, cookie, ftp, cryptographic hashing, diff, url manipulation, OS-agnostic path manipulation, XMLRPC, profiling, unittesting framework, data structures, datetime manipulation, and others.



A unique feature of python is the python shell, you can start the python shell and *interactively* write programs while the interpreter prints the result of computation (this is called Read-Eval-Print loop http://en.wikipedia.org/wiki/Read-eval-print_loop). This is a typical REPL session:



C:\>python

Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on

win32

Type "help", "copyright", "credits" or "license" for more information.

>>> arr = [2, 3, 4, 2]

>>> max(arr)

4

>>> def foo(n):

... print n + 20

...

>>> foo(10)

30

>>> 10 + 20

30

>>> 'hello world'

'hello world'

>>> import math

>>> help(math.sin)

Help on built-in function sin in module math:



sin(...)

sin(x)



Return the sine of x (measured in radians).



>>>



The REPL is useful while learning language as it makes experimenting easy, you don't need to go through the length compile, execute step. The REPL is also useful as a very powerful programmable desktop calculator. Python has infinite precision integers built into the language, which means your numbers can be as large as your computer's memory allows. This is unlike BASIC and C/C++ which has a maximum size on their integers (typically 2**32 or about 4 millions on 32-bit machine, though it varies by the compiler). On other languages you *can* use an external library for infinite precision integers, but a built-in language support offers seamless integration with the rest of your code.



My suggestion is to start with Python. Python is very easy to learn, it is as easy as BASIC but is much more better designed. Many people complained that BASIC teaches bad practices and programmers that only ever uses BASIC would never be a good programmer. I don't personally believe that as I start with BASIC. C/C++ is a good language, but they're difficult to learn since you have to manage low-level stuffs yourself. I would only recommend C/C++ after you've got a good grasps of the fundamentals of programming. Avoid C# at all costs, it's a cheap Java-clone; and Java bests out C# at all aspects, and C# cannot be used for systems programming unlike C/C++.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...