General discussion

Locked

What's the best way to learn programming??

By ObiWayneKenobi ·
Hey all, I have some quick questions I'm hoping I can get advice on. I primarily deal with support and networking, but I want to start learning how to program. The problem is that I have absolutely no background in it. I've never taken any programming courses (was not required for my degree) and the only exposure I've had is very little VB.NET for an ASP.NET application.

I want to learn VB.NET and possibly C# (can't decide which) but I don't know where to start short of waiting until I can take some courses at a community college. I've bought several books on VB.NET but I have a very hard time sitting down and reading them because I feel the silly little examples they use to teach doesn't demonstrate anything useful; I prefer to learn by having a case study and working to build that up, not doing a bunch of independent examples that I feel don't teach me anything.

Maybe I'm going about it the wrong way? I'm just confused by the prospect of it all and have a difficult time comprehending what I do, probably because I have had no classes on theory and logic.

So, is there any way that I could get myself into the right mindset and try to learn this.. I want to make myself as diverse as possible, plus the little programming I have done is enjoyable, I just don't know enough to do anything useful yet. Are there any good books that teach in the way I described (i.e. includes a case study of some kind that allows you to learn by developing a 'real world' type application and/or has one as the final chapter to let you use what you've learned already), or is this a lost cause and I should try and take some courses?

Many, many thanks in advance!

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Disagree . . .

by inet32 In reply to Wrong languages to start ...

"You need to learn that in a 'lower level' language. Choose C or Pascal. "

I disagree because those are procedural languages and C# is O-O. He's going to have to unlearn too many things. Also, if he starts off with Pascal or C then even writing "hello world" in a Windows environment is about 80 lines of code (to use the Petzold example). Or he's going to be stuck in a command-line mindset in a GUI world.

I suggest starting off in C# and biting the bullet by actually cracking the book!

Real programs ARE made up of lots of little parts and DETAIL, so if he insists on only doing grand-vision stuff and not little exercises then maybe programming isn't for him.

Collapse -

Start with a simple programming Laguage..

by Tekillaah In reply to What's the best way to le ...

Learn the ropes.. Improve your Logic.. Programming will be easy for you if you know how to design your software....the simplier the better.....Try HTML first ... or VB 6 ... dont use .NET .. although most sysntax are thesame...... www.w3schools.com <---------- This site could help...... I always think Python is a good start.... From thes you ca jun\mp to ASP ... Etc............

You cannot study all programing languages but you can understand some of it.. .nET is where the money is but u must learn the basics first.. Good Luck.......... Always put a remark on your codes... GOod programmers practice that everytime...

Collapse -

Arrrgh !

by Tony Hopkinson In reply to Start with a simple progr ...

Writing simple code is not about using a simple language. It's about not making it complicated for a laugh, and unreadable out of laziness.

Not VB6. You'll never learn good programming with that. Bleedin' terrible language. HTML is n't even a programming language. If you are talking scripts that's a bad way to go as well.
If you want to learn programming, choose a language where you have to declare your variables to be of a type. Get good coding habits and then move on to wysiwyg/scripted coding environments.

Do it the other way round and you'll at best struggle, when you want to do something that's not simple.

As for remarks.
They are only useful if they tell you something, and they are up to date. A wrong comment is worse that none at all.

A variable/object naming standard, meaningful names and making each function/subroutine only do one thing are a 1000s times more valuable than a comment.

Public Sub DoMonthlyInvoices(ByVal InvoiceMonth As Long, ByVal SelectedPrinter as Long)
' Extract Invoices for the passed month and output on the passed printer.
Dim InvoicesToPrint as colInvoiceList

Set InvoicesToPrint = New colInvoiceList
Call InvoicesToPrint.GetInvoicesForMonth(InvoiceMonth)
If InvoicesToPrint.Count > 0 Then
Call InvoicesToPrint.Print(SelectedPrinter)
End if
End sub

You could even argue that the one comment is unnecessary.

Collapse -

Indentation and spacing

by Montgomery Gator In reply to Arrrgh !

Tony's comments are right on target. I would only add that indentation makes it much easier to read the code, along with spacing to separate subsections of code.

Collapse -

Indentation is good

by Tony Hopkinson In reply to Indentation and spacing

also where you bracket compound statements
if condition then {
Blah Blah
}
vs
If condition then
{
Blah Blah
}
prefer the latter myself but that's the way I've always done it.
Some people can get positively **** about it, though insisting on a number of characters.
Avoid these two as well
if condition then ... else ...
does not help when debugging

and the classic confusion of
if condition then
if condition then
...
else
...
Different compilers have different rules for which if the else belongs to, even if you know when you write it you're not likely to remember.

s = (((a*(v*v))+x)/(m/y)-h)
well no comment required again, apart from the door's that way.

In Programming like XML terseness is not a requirement, in fact it's a major handicap.

Collapse -

Agreed

by Montgomery Gator In reply to Indentation is good

I too prefer

If condition then
{
Blah Blah
}

Easier to match up the curly braces.

I have also noticed how posting on Tech Republic removes indentation, even if entered by space bar.

Collapse -

Me too

by Tony Hopkinson In reply to Agreed

Some more tips.
Come up with some standard names.
e.g. If I write a class/component that loads it self from a store (database or file) the method that does it is always called Populate....
Any form that then displays the data in the class has a method called DisplayData. Simple conventions like this can save bucket loads of time. Either in a team environment or just in 3 months time when you re-visit the code. 99% of the time in a GUI, you want to change the way the data is displayed and or change the way you load it. The more familiar the environment the quicker you pick it up (again) and the more confident you feel about what you have to do to solve a problem.

Collapse -

brace location

by apotheon In reply to Indentation is good

I definitely prefer using braces on separate lines from code (as I did in the pre tags post), as well. In fact, it sorta drives me up the wall when I see code with the opening brace on the same line as the beginning of an if statement. It's much uglier formatting to do it that way (I tend to call it the "Visual Stupido" approach because the people I see doing it most are Microsofties that only know how to program in Microsoft's IDEs), at least in my opinion, and much more difficult to follow.

Collapse -

well...

by jck In reply to brace location

I'm a VB.NET programmer...and when I write C or C++, you'd never see the opening or closing brace on the same line as the code it encloses.

Of course, I was trained on Unix boxes in college :)

Collapse -

See what I mean?

by apotheon In reply to well...

You learned the Unix way, not the Microsquishy way.

You should have a look at The Art of Unix Programming. If you really learned the Unixy programming philosophy, that book will help you figure out why you do the things you do, and will help you figure out how to do them better in the future.

It's available online (from the author) at http://www.catb.org/~esr/writings/taoup/ for your convenience.

Related Discussions

Related Forums