4

I've had a very odd learning experience in programming. I was sort of taught C++, but I didn't get a lot out of it. Here's what I did get out of it: headers and variable declaration. And I tried to teach myself PHP, in which I learned a lot of. The problem is, a lot of my knowledge is widespread, random, and designed for specific situations.

So, my questions is: What basics are there to programming in most languages?

waiwai933
  • 14,133
  • 21
  • 62
  • 86
  • Voted to close: "exact duplicate" http://stackoverflow.com/questions/3088/best-ways-to-teach-a-beginner-to-program – Andrew Hare Apr 10 '09 at 05:36
  • I think [this](http://stackoverflow.com/questions/3088/best-ways-to-teach-a-beginner-to-program) thread may be of interest to you. – John T Apr 10 '09 at 04:13

7 Answers7

23

The term "basics" implies a short list, but to be an effective programmer you have to learn a LOT of concepts. Once you do learn them, though, you'll be able to apply many of the same concepts across languages.

I've compiled a (long!) list of concepts that are important in several, if not most, programming languages.

  • Language syntax

    • Keywords
    • Naming conventions
    • Operators
      • Assignment
      • Arithmetic
      • String
      • Other
    • Literals
    • Conditionals
      • If/else
      • Switch/case
      • What is considered true or false (0? Empty String? Null?)
    • Looping constructs
      • for
      • foreach/iteration
      • while
      • do-while
    • Exception handling
    • importing/including code from other files
  • Type system

    • Strong/weak
    • Static/dynamic
  • Memory management

  • Scoping

    • What scopes are available
    • How overlapping scopes are handled
  • Language constructs/program organization

    • Variables
    • Methods
    • Functions
    • Classes
    • Closures
    • Packages/Modules/Namespaces
  • Data types and data structures

    • Primitives
    • Objects
    • Arrays/Lists
    • Maps/Hash/Associative Array
    • Sets
    • Enum
    • Strings
      • String concatenation
      • String comparison and equality
      • Substring
      • Replacement
      • Mutability
      • Syntax for creating literal strings
  • Functions, Methods, Closures

    • Method/function overloading
    • Method/function overriding
    • Parameter passing (pass-by-value/pass-by-reference
    • Returning values (single return/multiple return)
  • Language type (not mutually exclusive)

    • Scripting
    • Procedural
    • Functional
    • Object-oriented
  • Object-oriented principles

    • Inheritance
    • Classical vs Prototypical
    • Single, Multiple, or something else
    • Classes
    • Static variables/global variables
    • access modifiers (private, public, protected)
  • API (or how to do basic stuff)

    • Basic I/O
    • Print to Standard Out
    • Read from Standard in
    • File I/O
      • Read a file
      • Write a file
      • Check file attributes
    • Use of regular expressions
    • Referencing environment variables
    • Executing system commands
    • Threading model
      • Create threads
      • Thread-safety
      • Synchronization primitives
    • Templating
Peter Dolberg
  • 2,027
  • 16
  • 21
5

Another important thing not mentioned here yet is just Object Oriented Programming. The ideas revolving around classes, inheritence, interfaces, etc.

Rob Haupt
  • 2,104
  • 1
  • 15
  • 24
  • And most importantly of all, "getting" polymorphism and more advanced object-oriented topics, without which, object-oriented programming is merely a nice wrapper around the real world, rather than something with potential power. – Rob Apr 10 '09 at 04:54
  • And, perhaps, the existence of other paradigms and perhaps a few of their distinguishing characteristics. Procedural and OO are not the be all end all of programming languages. Functional, logic, and data flow languages are more useful and more common than many programmers think. –  Oct 09 '09 at 04:48
3

A very important basic programming skill is the ability to think at many different levels of abstraction and to know when and which level of abstraction is the most appropriate for a particular programming task.

Hideo
  • 387
  • 3
  • 4
2

Pointers. Because so few people actually understand them.

Recursion and iteration, plus what the difference is, and when you use them.

Get an algorithms book and work through the exercises -- you won't be disappointed.

Don Werve
  • 5,100
  • 2
  • 26
  • 32
2

Testing! (unit testing, integration testing, fixtures, mock objects, ...)

And not a programming skill, but surely a development skill: using revision control, and learning to commit sets of changes that handle one (or a few related) requirement, or bugfix, and will always result in a source tree that compiles without errors. This will teach you to organize your work :-)

And last but not least: English... :-) Again, this is not a programming skill, and I know some may disagree, but I feel that any programming language that uses English keywords, should also be programmed in English. So: use English variable names, and so on. I'd even say that the code comments should be in English, but I am sure even more people would disagree about that... So: learn how others describe their code, and adhere to that.

Arjan
  • 22,808
  • 11
  • 61
  • 71
  • Not least because testing is a learning technique; it's a great way to explore other aspects of the field. Think you know how something works? Write a test. Then if it doesn't work (or if it does) you've learned something. – Carl Manaster Apr 20 '09 at 20:24
1

If I were you, I'd go back and learn the C programming language from the class K&R book.

BobbyShaftoe
  • 28,337
  • 7
  • 52
  • 74
1

Find out what sort of thing you want to program for first - e.g. web, PC applications, Java based applications, mobile devices, reports, system interfaces, business to business interfaces, etc. then go from there.

Techboy
  • 4,286
  • 5
  • 36
  • 45