Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A new programmer 2

Status
Not open for further replies.

xjlkx

IS-IT--Management
Nov 21, 2002
107
0
0
US
I'm in the IT field, but I've never had any programming experience. I'd like to delve into the programming world, but its a little intimidating and I'm not sure where to start. I'd eventually like to get into something that might come in handy, but I realize that I may need to learn something real basic to start. Does anyone have any suggestions as far as languages, books, approaches, etc...for someone just breaking into the field?
 
Java is great, but Microsoft is trying to fragment and crush it so it doesn't catch on. Currently, Java is big for servers and devices, but its desktop presence is limited.

Standard C++ is an OOP language also, and is here to stay.

Microsoft is trying to introduce proprietary languages to maintain market dominance, and as crappy as it is, Microsoft has enough control that what they say goes. Therefore, for anything Windows, you should probably learn about .NET also.

But wait, there's more! Alot of the demand in today's market is for web developers (which is covered by .NET), so you may also want to learn a little script.

Database work is crucial too.

That being said, I don't actually work as a programmer yet, this is just what I have learned in all of my research, and what my plans revolve around.

 
Thanks for the tips. Can you recommend any resources, books, methods? I realize that its going to take experience to get skilled, but I am looking for something to get the ball rolling.
 
If you want to get serious about programming learn the basics of the 'C' language first. Any book on ANSI C language will help you get started.
You can buy development books and software cheap off ebay.com plus there are some free compilers available for download such as DevC++ from Bloodshed software and the GNU C/C++ compiler.

Once you have learned the basic "building blocks" of 'C' you can then move up to Object Orientated Programming (OOP) and the C++ language. C++ is based on C but the OOP model makes more sense to program in.

Also, a working knowledge of C and C++ will help you when or if you decide to start dipping your toes into Java and the such because Java is largely based on the C language.
However, I don't suggest Java as a 'serious' language for developing mainstream Windows/Mac/Unix programs because it is still rather slow. You may wish to reserve this language for web-based development areas for the time being.

I'm assuming you are using Windows at the moment so I would suggest doing a search for and downloading the GNU C/C++ compiler for Windows to get a foothold.
All C programs have what's called a 'main' function where the program kicks into life. If you use GNU C/C++ to build your first program, you could enter the following code and compile and run it into a console window:

[tt]#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
printf(&quot;Hello World!&quot;);

return (0);
}[/tt]

the [tt]#include[/tt] directives at the top of the code are essentially telling the compiler to 'import' header files. There are a handful of basic header files for ANSI C. The three above (although not all required for this simple program) should be included in all your programs just out of habbit!

The [tt]int main(void)[/tt] is the 'main' function and starting point of the program. The body of a function is always enclosed in curly brackets { and } as you can see.
The word [tt]int[/tt] preceeding the function name is the return type of the function. In other words, the function is expected to return a value of type [tt]int[/tt] which means 'integer' or any whole number. You can see that once the function has completed in our case it [tt]return[/tt]s a value of zero (0).

The code in the function body gets executed in order from top to bottom. In our case, we have one simple statement[tt]printf(&quot;Hello World!&quot;);[/tt] - this tells the program to display the text &quot;Hello World!&quot; to your console window.

All statements in C/C++ end with a semi-colon (;) - this tells the compiler that it is the end of the statement.

You can also do loops and branch off into different parts of your code by using [tt]while, do, for[/tt] loops and by defining other functions - here's a piece of code that uses both:

[tt]#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void some_function(int counter,char* str)
{
while(counter>0)
{
printf(str);
printf(&quot;\n&quot;);
counter = counter-1;
}
}

int main(void)
{
some_function(10,&quot;Hello&quot;);

some_function(5,&quot;World!&quot;);

return (0);
}[/tt]



The above code first calls [tt]some_function[/tt] with parameters of 10 and &quot;Hello&quot;. Control slips into this function called [tt]some_function[/tt] - once in the function, the code in there is processed in order.
We enter a [tt]while[/tt] loop which has an integer (int) counter of a value of 10. While we're in the while loop, we print the word &quot;Hello&quot; which was passed in as the second parameter. We then print a newline character (&quot;\n&quot; = newline). The counter is then decremented by a value of one [tt]counter = counter-1;[/tt] so the value of counter is now 9.
The while loop compares the value of [tt]counter[/tt] to make sure it is 'greater than zero' ([tt]while (counter>0)[/tt]) before entering the loop again.
Obviously, once the value of [tt]counter[/tt] is zero, the loop completes, we exit the function (with no return value - hence the [tt]void[/tt] return value from [tt]some_function[/tt] and go back to [tt]main[/tt].

From [tt]main[/tt] we then enter the same function again but with different values as parameters.

This program should print &quot;Hello&quot; 10 times and then print &quot;World!&quot; 5 times to your console window.

I could have used certain shortcuts for decrementing the counter and such but I didn't want to confuse you at this point.

A word of warning: once you start programming, you can't stop! It's addictive!!

You start learning the basic stuff then use that knowledge as the building blocks for bigger and greater things. The possibilities become seemingly endless and before you know it, you have a copy of Visual C++ and you're building full blown windows apps which work and do things exactly as YOU want them!

[rockband]
tellis.gif

[sup]programmer (prog'ram'er), n A hot-headed, anorak wearing, pimple-faced computer geek.[/sup]​
 
Seriously, go here: . I have 4 of their books so far and I'll be buying more. They give thorough explainations of OO design and a detailed explaination of how languages work (instead of the superficial brush-over that some &quot;Learn this Language Quick!&quot; type books give).

I would recommend you buy a learn to program book in C++ or Java or something, then check into books geared toward more experianced programers so you're not re-learning fundamental concepts (see Deitel & Deitel's Developer Series).
 
He he, I should learn to type faster - BoulderBum is right about Java - like I said I would take things one step at a time... 'C' is probably the worlds most popular programming language - it is NOT the easiest BUT I think it's the best when it comes to serious application development.
Don't confuse yourself by trying to learn C, C++ and Java all at the same time - learn the basics of ANSI C first and use that as your building blocks to learn the rest. Once you've learned these basics the rest will make more sense and everything will fall into place.

The 'ANSI' means that it is the industry standard of the language (if you like) and means that your code can be compiled for all platforms including Macs and Unix etc. There are not many ANSI functions to learn so it should give you a great starting point.
tellis.gif

[sup]programmer (prog'ram'er), n A hot-headed, anorak wearing, pimple-faced computer geek.[/sup]​
 
Gednick, do you really think it's worth learning C? It seems to me that the language is sort of dying now, though I guess I could see learning it to help maintain legacy code.
 
It seems that C is the basis for most modern languages and also languages such as Perl and Java have roots in the C language. The way I figure it is that anyone wishing to start programming would be able to learn ANSI C quite easily - that way, the concepts of OOP, C++, Java, .net etc will be much clearer.
A new programmer should learn to walk before he can run. ANSI C may be limited to old console apps but it is essential knowledge for any C++ programmer. Once mastered, the new programmer could invest in a copy of Visual C++ and begin building cool looking windows apps.
To start out with VC++ and MFC and Microsoft's generated code will obscure the basics of how everything is working (and works together!) to a brand new programmer.

I don't think learning C first is such a bad idea. Armed with a reference book (or even a good web site) and simple C compiler such as GNU, the average beginner will pick up the basics after a single day of tinkering with functions, basic data types and conditional statements. This day of learning would pave the way (and whet the appetitie) to the bigger and better things such as programming actual windows, dialog boxes and the like.
tellis.gif

[sup]programmer (prog'ram'er), n A hot-headed, anorak wearing, pimple-faced computer geek.[/sup]​
 
I see. For me, &quot;learning a language&quot; means spending about a year of intensive study developing projects and learning the intricacies of it. I see what you're sayin, though. I wouldn't recommend a begginer start programming in VB or something, because it's too tempting to take everything for granted and not really know what's going on &quot;under the hood&quot; so to speak.

That being said, the Deitel C++ text teaches ANSI C++ with console apps exclusively. In all my coding with C++, I haven't touched the MFC (yet) because I'm learning from that book.

I just setup my computer to dual-boot XP and Ret Hat 8, but I haven't tinkered with the Linux development tools yet. How would you say they compare to VC++?
 
In all my coding with C++, I haven't touched the MFC (yet) because I'm learning from that book.

See.. that's good! My whole point is this: if you had just dived straight in with VC++ using MFC and Microsoft's generated code then you probably wouldn't have an understanding of the basic concepts of C/C++.

I just setup my computer to dual-boot XP and Ret Hat 8, but I haven't tinkered with the Linux development tools yet. How would you say they compare to VC++?

I haven't got Linux yet and I've only just started delving into Linux development. Basically, all I'm doing is getting my Windows apps to talk to simple apps on my Linux web server using sockets and stuff like that. I'm uploading my code via FTP and using Telnet to compile it on the Linux server using GNU C/C++.
For simplicity reasons all my UNIX coding so far has been with ANSI C and some of my own C++ classes based on ANSI C.
To cut a long story short - I can't give a fair comparision but I can say that my ANSI C knowledge has come in very useful for this reason and that I'm managing to get everything working great so far.
tellis.gif

[sup]programmer (prog'ram'er), n A hot-headed, anorak wearing, pimple-faced computer geek.[/sup]​
 
I agree, everyone needs to start somewhere and where better than basic C functions to understand the concepts
 
I guess I just don't understand why one shouldn't learn C++ at a basic level (using ANSI standards) then expand from there. It seems more practical since the basics of the languages are pretty much identical, and the C way of doing things seems outdated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top