Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Arfus

macrumors member
Original poster
Aug 11, 2010
56
0
How do ig et into coding? i have never done any coding before
 

uberamd

macrumors 68030
May 26, 2009
2,785
2
Minnesota
Loaded question. Grab a good book, sit down for a weekend or two, read it and go through the examples, then try a project on your own.
 

Sander

macrumors 6502a
Apr 24, 2008
520
67
Witout giving any background, it's going to be hard to suggest a good book to you. It depends on what your goals are, what type of learning fits you, etcetera.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
What are your goals? Why do you want to do this? Have you heard it is cool and a fun way to spend your spare time? Do you want to make a career change to programming/software engineering? Do you want to build iOS apps in your spare time for your friends or to sell on the app store to make money on the side? Do you have some tasks that you want to automate on your own machine? Do you have piles of meteorological data that you want to process in an interesting way?

How much money to you want to spend learning this? Do you have time to take classes? Do you have money for a bootcamp-style course? Can you afford books?

What level of proficiency do you wish to reach? Do you want to be able to get things to sort of work for personal projects or be able to teach others about programming and write rock solid code?

We really need a lot more information before we can give you any worthwhile recommendations. Based on what you've given, open terminal and enter:
echo "#include <stdio.h>
int main(int argc, char *argv[]) {
printf(\"Hello, World.\\n\");
return 0;
}" > myHello.c
gcc myHello.c
./a.out

Now you're into coding.

-Lee
 

Mactrillionaire

macrumors regular
Oct 16, 2010
211
0
For anything basic, you can probably start learning to code from reading a few books. However, if you are responsible for anything of sizable complexity, you need a deeper understanding of programming and the proper math background. Let's face it, even if you succeed at writing a popular program, no one will use it if doesn't use a pragmatic approach (for instance, using cubed or exponential sorting algorithms, or, the big no no on iOS: running out of memory because you coded the program for a desktop instead of a mobile run environment). Successful programming is largely about making the right design decisions before you even begin to code. You also need to test your code thoroughly in order to maximize the efficiency and security of your programs. So, while you may able to get away with writing a couple hundred line program without much experience, that will be less possible as you progress onto complex programs and challenging to implement algorithms. If you are not writing anything terribly complex, there are plenty of free online guides that can help get you started. I can't really tell what is right for you since I didn't get a sense of what you intend to do.
 

Bill McEnaney

macrumors 6502
Apr 29, 2010
295
0
Here's a link to an online edition of a book called How to Design Programs. The authors wrote it for high school students, but professional programmers learn from it, too. It'll be much different from many books that lots of other people would suggest because it's about the Scheme programming language. I'm suggesting it because it teaches more than Scheme. It shows you how to design programs.

http://htdp.org/

This http://racket-lang.org/download/ link takes you a site where you can download the Racket programming environment that HTDP's authors used to call DrScheme.
 
Last edited:

chrono1081

macrumors G3
Jan 26, 2008
8,451
4,149
Isla Nublar
We really need a lot more information before we can give you any worthwhile recommendations. Based on what you've given, open terminal and enter:

echo "#include <stdio.h>
int main(int argc, char *argv[]) {
printf(\"Hello, World.\\n\");
return 0;
}" > myHello.c
gcc myHello.c
./a.out

Now you're into coding.

-Lee

I'm pretty ashamed to not know how to do this after coding since roughly 1998. Granted I don't do it full time but I should at least learn this.
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
I should at least learn this.
Which part? The file creation with echo or the compilation and execution from the command line? :p

You would generally have an editor around (vi, nano, pico,...) so I wouldn't worry too much about using echo to create files. Definitely handy in a pinch, but far from essential.

B
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Which part? The file creation with echo or the compilation and execution from the command line? :p

You would generally have an editor around (vi, nano, pico,...) so I wouldn't worry too much about using echo to create files. Definitely handy in a pinch, but far from essential.

B

I was just too lazy to type up instructions for an editor, and was afraid if a graphical editor like TextEdit was used they'd end up with an RTF.

-Lee
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
I was just too lazy to type up instructions for an editor, and was afraid if a graphical editor like TextEdit was used they'd end up with an RTF.
Sure, it's much easier to deliver as "type this" instructions and actually have a chance of getting the expected results.

I was just curious as to what chrono1081 thought they should learn from it.

B
 

chrono1081

macrumors G3
Jan 26, 2008
8,451
4,149
Isla Nublar
Sure, it's much easier to deliver as "type this" instructions and actually have a chance of getting the expected results.

I was just curious as to what chrono1081 thought they should learn from it.

B

I'd just like to learn how to do it. I have friends who are programmers for a living and they know how to do all of that stuff where as I've been using IDE's my entire programming life.

If I use linux for example, I don't even know how to compile a program from source.

I'd like to learn it more out of curiosity than anything.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I'd just like to learn how to do it. I have friends who are programmers for a living and they know how to do all of that stuff where as I've been using IDE's my entire programming life.

If I use linux for example, I don't even know how to compile a program from source.

I'd like to learn it more out of curiosity than anything.

This is the primary reason I advocate text editor + command line for beginners. I feel like it's a lot easier to go from a separate editor, a compiler, a debugger and console I/O at the command line to an IDE that pulls those pieces together (although sometimes heavily obscuring the console I/O) than try to go from an editor window and a "compile/run" button to performing the steps manually.

I know you "always have an IDE" these days, but at least in my job there are times that i have a shell on a remote system and need to get something done. I know how to setup X-forwarding, and i could probably get some sort of graphical environment going, an IDE installed, etc. but it's a lot easier to fire up vim and get the job done and go back to bed.

I guess it makes me feel better to know what's going on at various steps. It helps me work through problems, etc. Certainly the same solutions and approaches are available with an IDE, but I guess I feel like sometimes they are too clever.

The only exception I make is large-scale Java projects. I'll bang out a small tool with javac and jar, but once a project gets complex I definitely prefer an IDE. I don't mean to knock Java, but it is incredibly verbose. I am a fast typist, but I definitely like having completion available when working with Java.

If one were to want to get started learning a "terminal-only" workflow I'd say:
http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html
(Queue emacs lovers flaming)

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/gcc.1.html

If you aren't familiar with piping things around a terminal:
http://www.injunea.demon.co.uk/pages/page208.htm

Once you're spending too much time managing dependencies when compiling:
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/make.1.html

I don't believe IDE addiction is incurable. I had a mild dependency for a number of years, but once I started running OS X instead of Windows and developing primarily on Unixes the command line just clicked.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.