How you learn a programming language?

ChatIndia

Community Advocate
Community Support
Messages
1,408
Reaction score
30
Points
48
Today I started reading a book on php and mysql. (again)

and i am like, oh great, only 600 more dry dull boring pages. had you made notes or joined any tutorial classes or what to keep yourself interested all the way till end while learning php?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
When I started out, I didn't learn a programming language, I learned to program. The depth of the topic was enough to keep me interested. After that, learning programming languages was fairly inconsequential; learning a new one now is simply a matter of recognizing which features it supports and learning the rare new feature.

I didn't learn relational algebra or relational calculus until after studying SQL, and the former were much more interesting and made many aspects of SQL trivial. It also makes you realize how limited SQL is.

Having a project can help, but development is a larger topic than programming. Small projects (individual functions, then small groups of functions, then individual classes, then small groups of classes) are more suited when starting out. Number classes can be fun as you develop your own implementation for arbitrary precision integers and rationals, then more exotic constructions such as polynomials and the Cayley-Dickson construction (which can create complex numbers, quaternions, octonions and so on). Project Euler has hundreds of puzzles roughly in order of difficulty. Games are a perennial favorite, starting with the higher-lower guessing game and going all the way up to 3D simulators. I bet if you searched the web for "programming projects for beginners", you'd find tons of possibilities.
 
Last edited:

gameaddict2085

Member
Prime Account
Messages
111
Reaction score
1
Points
18
I personally found w3schools php/mysql tutorials very helpful, but I did already know how to program in other languages before I used it so maybe its not suited to everyone
 

miguelkp

Member
Messages
304
Reaction score
7
Points
18
I completely agree with misson. It's most a matter of learning to program than learning languages. It's only a matter of learn the new syntax and the changes in features specially once you understand the basis of the programming paradigm you're using.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
I personally found w3schools php/mysql tutorials very helpful, [...]

Not again.

W3Schools is outdated, inaccurate and incomplete, and that's not just my opinion. Some improvements have been made in recent years, but it's still inferior to other sources. It still teaches bad habits, and there's too much you'll have to unlearn.
 
Last edited:

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
Building things helps an awful lot.

Mathematically-minded people have a bit of an advantage here, in that we are (relatively) easily amused by things that seem to fall into the category of "so what?" to most people. Misson's arbitrary-precision and rational number classes are good examples of the genus—when you understand that asking the machine to add 9/32 and 3/32 and having it tell you the answer is 3/8 is a Big Deal™, you do a little happy dance and dig deeper. Similarly, building something where 0.3 actually equals 0.1 + 0.2 for a change is cause for celebration (whether you understand that or not).

Finding something to build that will hold your interest as you progress can be a little more difficult if maths aren't a turn-on. If you already know enough of the web front end (HTML, CSS, JS, the DOM and/or jQuery) that you don't need to learn them from scratch as well, then it's relatively easy to mock up a simple CRUD* application (the sort of thing you might actually be trying to learn to build) on an HTML page or two, then slowly turn Pinocchio into a real boy as you learn. Along the way, you'll find that things that you had previously written may have worked, but probably weren't the best way to go about it, so you refactor† according to your now-better understanding of the problem, and optimize‡ where you can.

For a basic intro to programming, I usually recommend starting with lectures 1A to 6B of Structure and Interpretation of Computer Programs. (Lectures 7A to 10B are more interesting for language development, and they're worth a watch later. DSLs (domain-specific languages) can be fantastic tools, and you can create a language that compiles to PHP to make custom CRUD development go a lot faster if you want to go into the business.) It's not directly transferable to PHP+MySQL, it will make you see PHP as Blub, leave you dissatisfied with your working toolset, and you'll probably find Hal Abelson's lectures a little harder to watch than Gerry Sussman's, but it will give you a good foundation in many of the key points in all programming. You'll understand algorithmic complexity, and the trade-offs of time and space. You'll know Schlemiel the Painter's Algorithm when you see it—even in PHP—and understand how you might go about fixing that. You'll understand iteration and recursion, abstraction, compound data and object-oriented coding.

But yeah, building things helps. Theoretical carpentry is boring too, but making something with your own hands as you learn keeps making it seem worthwhile even though you're learning.
________
* CRUD stands for the simple Create, Read, Update and Delete interaction with a database. Most CRMs, blogs and "social platforms" are really nothing more than a series of CRUD operations.

† Refactoring is the process of rearranging working code to improve its architecture and/or maintainability. It usually includes paying attention to the DRY ("don't repeat yourself") principle, and may involve creating (or, less often, decomposing) classes to keep the code and the data it works with closer together.

‡ Very often, the easiest things to understand are a long way from the most efficient way to go about things. The rule is "make it work, then make it right".
 

dedevyvy

New Member
Messages
3
Reaction score
0
Points
0
I. Learn the basic of programming
1. C/C++ that is the basic coding.
2. Learn about OOMP
3. Learn Data Structure
4. Learn Database system
5. Start to learn the advance programming such as C#, VB, JAVA...
 

callumacrae

not alex mac
Community Support
Messages
5,257
Reaction score
97
Points
48
I. Learn the basic of programming
1. C/C++ that is the basic coding.
2. Learn about OOMP
3. Learn Data Structure
4. Learn Database system
5. Start to learn the advance programming such as C#, VB, JAVA...
I'm not sure that I agree with you here. Surely it is better to learn one language in a lot of detail than learn five languages in not much?
 

gameaddict2085

Member
Prime Account
Messages
111
Reaction score
1
Points
18
Not again.

W3Schools is outdated, inaccurate and incomplete, and that's not just my opinion. Some improvements have been made in recent years, but it's still inferior to other sources. It still teaches bad habits, and there's too much you'll have to unlearn.

I'm just start to learn this, hopefully my coding isn't too crap but I can do what I want in php and html so I suppose it doesn't matter too much :)
 

dragonpimpsta

New Member
Messages
31
Reaction score
0
Points
0
I just try to code certain projects. Google how to do things i'm not sure of and by the end of the project I learn a lot about the language. Then next project I keep adding to that knowledge
 
Top