FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Programming basics





jabapyth
What Makes up the basics of Programming? Things that every decent language should have?

    Math: +-/*
    Loops: at a minimum, the While loop, but 'for' is handy, too.
    Conditionals: if, elif, else
    Functions: a structure to modulizing
    String Handling: explode, join, concatonation, find(substr,str)
    Error Handling: try, except.
    Error/Event Generation: raise(error/event)


Some other things that are Really useful:

    OOP: classes, sub/superclasses
    A reliable GUI interface
    Math 'tothepowerof': usually ^ or **


Any ideas?
martindecorte
This question is tricky, because you didn't tell exactly what kind of programming language you are talking about. For example, logical programming (like Prolog) is totally different from what we know, and for example it doesn't have loops, nor conditionals. But such programming languages are widely used, namely for AI purposes.

So, I suggest you refine your definition of "decent language". But actually I think this question is really useless because everyone will just tell what he always uses in his favourite language...
AftershockVibe
Assembly language has none of those things apart from the maths instructions and possibly loops if you count conditional jumps as a loop.

If you're programming for a simple and small microprocessor controller you might not want the overhead that the languages that implement everything on your list.

Right tool for the task and all that.
Stubru Freak
jabapyth wrote:
What Makes up the basics of Programming? Things that every decent language should have?

    Math: +-/*^
    Loops: at a minimum, the While loop, but 'for' is handy, too.
    Conditionals: if, elif, else
    Functions: a structure to modulizing
    String Handling: explode, join, concatonation, find(substr,str)
    Error Handling: try, except.
    Error/Event Generation: raise(error/event)


Some other things that are Really useful:

    OOP: classes, sub/superclasses
    A reliable GUI interface


Any ideas?


Of course there are languages which are really different, but this comment is for the kind of language he means (an easy-to-use, conventional language).

Things I don't agree with:
^: Is this a typing error or do you really mean "to the power of"?
If you do, this is not true at all, as you need to use this rarely. If you do need to use it, it's easy to write a function yourself:

PHP for example:
Code:
function pow($i, $exp){
if($exp == 0){
if($i == 0){
return false;
} else {
return 1;
}
} elseif($i >= 0){
$return = $exp;
for($j = 2; $j <= $exp; $j++){
$return *= $exp;
}
return $return;
} else {
$return = 1/$exp;
for($j = -2; $j >= $exp; $j--){
$return /= $exp;
}
return $return;
}
}


This isn't the most optimized code, and it may contain some errors, but this is the basic.

String Handling: explode, join, concatonation, find(substr,str)

String handling is not required at all, for example, in Java, a string isn't even a basic datatype.
You could make a string class yourself quite easily. (Not going to give an example here)
jabapyth
Sorry, no, it wasnt a typing error. Iv edited it to be in the 'things that are nice to have'
Related topics
How To : Improve Your PHP Programming
Complete Tutorial LINKS for every language
Creating an RPG bot in IRC (yes I wrote this)
Flash MX Basics
Java Programming Introductory
Laws of Computer Programming
Begins Of GAME PROGRAMMING
Programming
i want to learn programing
Object-oriented programming Vs procedural
C++ Program Basics
New endeavour: C programming language
New to programming, which language do I choose?
what is a good programming language for beginers?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.