PDA

View Full Version : Learning a language


Zegg90
02-14-2006, 08:13 PM
I want to learn a computer language...
So I am wondering, what would be best for me? I know PHP and some MySQL right now. A lot of people say that if you have a background in PHP, you should try C++. I don't mind learning C++, but I'm also wondering, what's the difference between C, C++ and C#? Apparently C# is far less popular than C/C++.
And what about java? Can java create computer programs? So far, the only java programs I've seen are browser based applets/games.

I've been starting a tutorial to learn C++, but I'm confused about compilers... How do I install a compiler? When I download a compiler from the internet, there are loads of files and folders, but I see no program that's labeled 'Install' or 'Setup' or anything like that... Yes, I'm not very 'professional' with computers :P

Thanks!

oracleguy
02-14-2006, 09:21 PM
Well to answer your first question, the difference between C and C++ is that C++ has things like classes, you can use cin and count instead of printf and scanf and a few other things I can't remember off the top of my head, its basically an improved C. Then C# is a C like language that came out a few years ago from Microsoft, one of its interesting aspects is that everything is an object. Right now C# is more or less limited to Windows though I recently installed Mono on my Gentoo box that lets your write C# on linux. I have yet to try it yet.

SteelValor
02-14-2006, 09:34 PM
I would suggest getting a book by oreilly or trying this site. http://www.pixel2life.com/tutorials/Cpp_General/All/

Either way grasping c++ isn't going to be easy unless you've had some other languages like basic or php or java

Ender
02-14-2006, 09:35 PM
Ok, I'll give you a jumpstart on learning programming languages ^_^. You can also feel free to aim me.

First of all, just about all (non web-based) programming languages can create applications. Java is no exception. There are two types of Java programs you can make, applications and applets. An example of an application is Jabber. An example applet is Yahoo's chess applet.

You may wonder why there are so many programming languages. Programming language share a lot in common but they all have different strengths and weaknesses. Languages are suited to specific purposes. The most straightforward way to differentiate between language is in their closeness to the processor. In order to avoid having to reinvent the wheel all over again, programmers built languages ontop of eachother. There are low-level languages (close to cpu) and high-level languages (far from cpu). This terminology has nothing to do with difficulty. High level languages are often translated or interpreted into low-level languages, so as to make it easier to create new languages. This concept of languages stacked ontop of eachother is often referred to as the virtual machine concept, where levels of software act as the virtual machine.

For languages to be converted to lower level languages, such as assembly or machine language, they go through the process of either translation, interpretation, or both. Translation is when you compile a source file into a binary representation and store it in an executable before runtime. When the executable (also called a binary) is run, the program is loaded into memory and starts sending its instructions to the processor when called upon. Interpreted languages are converted into machine language during runtime. Ofentimes the sourcefile is first compiled (translated) into a medium representation, such as Java bytecode, and then sent to a virtual machine for interpretation at runtime.

After that lengthy paragraph, I'll give you a brief description of the popular languages.

Java is an abstract, high-level, interpreted language. It is a very OO (Object-Oriented) language, and it was heavily based upon OO. Its fundamental OO concepts forces the programmer to conceptualize a lot, but after understanding OOP (Object Oriented Programming), the programmer can develop reusable, maintainable, and easy-to-build programs.

C++ has the duality of having low-level capabilities along with high-level capabilities. Whereas the Java Virtual Machine (JVM) does a lot of memory management for you, C++ requires the programmer to be very aware of memory management. At the same time, C++ is also OO, but not as much as Java.

C has syntactical and structural differences from C++. Basically, C++ has more features than C, and is more compatible with OOP. The reason C is still used so commonly today is because it is essential to embedded systems and is more portable than C++. If you check out GNU's open-source projects, the majority of code is written in C because they have such a wide target audience.

ASM is a very low level language. Technically, some humans do some modification and debugging in machine language (hex representation of data) , but this is very rare and you can consider ASM to be the first level language upon which humans are meant to program. As you go higher and higher up the ladder of languages, it becomes easier and easier to develop large, maintanable, and reusable software. But at the same time, you lose control over the computer as a consequence. You simply don't program large business applications with ASM. ASM gives you a lot of control in manipulating memory and fully using the processor's instruction set. As ASM is so closely linked to the processor, there are different kinds of assembly language suited to different kinds of processors and operating systems. The most common are MASM and NASM. MASM is for Windows IA-32 (the whole x86 family) and NASM works with both Windows and *nix, I believe, with the x86 family of processors (I'm not as sure about NASM, since I currently use MASM). Some examples of practical ASM uses are embedded systems programming, BIOS programming, and gamehacking.

There are many other languages like the ones above. I'm not going to go into them though, this is already a long enough post =p

ghell
02-15-2006, 01:33 AM
If perl can make executables (not sure, i know its interpreted) surely that would be the next logical step from php.

C++ is probably as low level as you will ever need, its slower and harder to write but much faster for the computer to execute, native c++ apps require no .net framework or mono or jre etc

C# is pretty much microsofts crack at java, i use it a fair deal (i also use java a lot) and its ok but it needs .net framework installed which is a real pain especially when half your users readily tell you that they cant install .net 2.0 because they dont have a legal copy of windows)

Mhtml
02-15-2006, 06:18 AM
its slower and harder to write
I disagree, well not completely... You are correct, but I think it's more of an each to their own thing. I prefer C++ because of I generally like to handle most of my memory myself and I have plenty of custom libs to provide a level of abstraction from OS/API to give me an almost RAD approach to C++ development without a large overhead. I am so used to using C++ that I barely have to think when writing it...too much time in front of the computer I guess.