The Big Programming Thread - Page 5
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
Epsilon8
Canada173 Posts
| ||
Sunhay
Canada303 Posts
On July 10 2010 03:40 Adeny wrote: I'm having a bit of trouble finding collections of tasks/challenges, like projecteuler, but maybe not as difficult? I've only done about 25 of the PE tasks, and so far they have been pretty challenging. Try doing Top Coder problems. If they are too hard, just do the higher level high school questions. Also, DWITE might provide some challenging questions. | ||
spinesheath
Germany8679 Posts
On July 10 2010 04:40 Epsilon8 wrote: Sorry, but I'm a little confused. I've been programming for a bit and was wondering what is the difference between functional programming and 'regular programming'? Functional Programming is mostly about recursion (calling a function from within itself) and passing functions as arguments (maybe someone with better knowledge of those can be more precise). Imperative Programming uses loops instead of recursion. Object Oriented Programming is usually imperative as far as I know. OOP focuses on Objects and the functions that are related to that object, while imperative non-OOP focuses more on the functions. I think there also is Logic Programming (never used that at all). Maybe there are some more types that I haven't heard about. | ||
Epsilon8
Canada173 Posts
On July 10 2010 05:00 spinesheath wrote: Functional Programming is mostly about recursion (calling a function from within itself) and passing functions as arguments (maybe someone with better knowledge of those can be more precise). Imperative Programming uses loops instead of recursion. Object Oriented Programming is usually imperative as far as I know. OOP focuses on Objects and the functions that are related to that object, while imperative non-OOP focuses more on the functions. I think there also is Logic Programming (never used that at all). Maybe there are some more types that I haven't heard about. Oh alright. I know what that is/have done it. Just didn't know that it was called that. I'm in my second year at college so I would rate myself intermediate/advanced(in some areas) - although I have a lot to learn. A site thats good to check out is : http://www.thinkgeek.com/tshirts-apparel/unisex/itdepartment/ Lots of funny programming related t-shirts and clothes. | ||
ChoboCop
United States954 Posts
| ||
UdderChaos
United Kingdom707 Posts
| ||
shmay
United States1091 Posts
On July 10 2010 04:40 Epsilon8 wrote: Sorry, but I'm a little confused. I've been programming for a bit and was wondering what is the difference between functional programming and 'regular programming'? functional only uses functions, not any pre-defined special languages constructs (if, else, +, -), except those to define functions C: 1 + 1 Lisp: (+ 1 1) In lisp you are calling a function called '+' and sending it two variables ( 1 and 1). C and its family (practically all languages) are called imperative programming, because you are sorta giving the computer a command ("add one to one") in an OO language, like ruby, you can chain two methods and do something like "blah".split.count in lisp, you could do that purely functionally: (count (split "blah")) | ||
spinesheath
Germany8679 Posts
On July 10 2010 06:04 shmay wrote: in an OO language, like ruby, you can chain two methods and do something like "blah".split.count I would rather say, functions can return objects (or usually references/pointers to objects), on which you can call another member function. So ("blah".split) is actually an object that has a function count. | ||
fanta[Rn]
Japan2465 Posts
Manipulate your own matrices, work with shaders, forget about deprecated fixed function completly. Most glX commands are fixed function, especially when they handle matrices, effects, light, etc. Here's a good OpenGL site, although it uses fixed function for drawing: http://www.songho.ca/opengl/index.html For shaders, I thought this one is very good: http://www.lighthouse3d.com/opengl/glsl/ NeHe I'd only use to get ideas of what is needed in your application. | ||
darmousseh
United States3437 Posts
| ||
kar1181
United Kingdom515 Posts
And took it out on the language itself. Personally I quite like Groovy | ||
Qzy
Denmark1121 Posts
On July 09 2010 23:05 sluggaslamoo wrote: Actually I kinda did it so it would force me to get better at algorithmic problem solving, I think I got to 30 before I decided I couldn't take it anymore (long time ago tho) I'm really into programming theory, but not the kind that involves hardcore algorithms. I might try it again some time. I guess it comes with my study of AI. It's really fun to solve the problems, imo. | ||
AcrossFiveJulys
United States3612 Posts
Btw I just fixed like the 20th (and HOPEFULLFUCKINGLY the last) bug in my algorithm and I jizzed in my pants | ||
catamorphist
United States297 Posts
| ||
catamorphist
United States297 Posts
On July 10 2010 06:04 shmay wrote: functional only uses functions, not any pre-defined special languages constructs (if, else, +, -), except those to define functions C: 1 + 1 Lisp: (+ 1 1) In lisp you are calling a function called '+' and sending it two variables ( 1 and 1). C and its family (practically all languages) are called imperative programming, because you are sorta giving the computer a command ("add one to one") in an OO language, like ruby, you can chain two methods and do something like "blah".split.count in lisp, you could do that purely functionally: (count (split "blah")) In the interest of combatting disinformation, I feel compelled to point out that this is absolutely, 100% false and bears no relationship to reality. When people talk about "functional programming" they are implying two things: 1a) Being able to pass functions to higher-order functions. 1b) Being able to define anonymous functions concisely (otherwise 1a is very awkward.) 2) Writing in a style as to isolate functions that have observable side effects from non-side-effecting functions, so that you can reason about code more easily. | ||
eaT_Mi_Lquid
Germany509 Posts
On July 10 2010 07:48 catamorphist wrote: In the interest of combatting disinformation, I feel compelled to point out that this is absolutely, 100% false and bears no relationship to reality. When people talk about "functional programming" they are implying two things: 1a) Being able to pass functions to higher-order functions. 1b) Being able to define anonymous functions concisely (otherwise 1a is very awkward.) 2) Writing in a style as to isolate functions that have observable side effects from non-side-effecting functions, so that you can reason about code more easily. OK, some people seem to be confused/ do not exactly understand the differences between these different programming paradigm. As for "Imperative Programming (C, C++, Java, .Net, JavaScript etc.): It is the most common programming paradigm, and most of the software are written in imperative programming style. In imperative programming, you assign information/values to variables. In the beginning of computing it means that you will assign some value to a memory address, in modern programming you assign values to variables. Because you assign something and instruct the function/program to do something with it actively it is called "Imperative programming". an example for imperative programming in pseudo code is int a = 1; int b = 10; while(a < b){ a = a + 1; if(a == b/2) //do something } As you can see you instruct the program to do something, therefore it's called imperative proramming. Object Oriented Programming: OOP, is a programming paradigm that is used in imperative programming a lot. It mainly results from structured programming (i did not check this), and it differs from OOP mainly in this regard: Instances. Whereas in structured programming you program by assigning simple values or complex value types (combining a set of value types into one structure), you will define those structures and create instances of those structures in OOP. Meaning that you work with instances (objects) instead of data structures which are statically allocated in the memory. If you want it, you can call classes that are defined in any modern OOP language structures, whenever they are declared as "static". In summary, OOP is about working with instances of defined data structures and procedures. OOP has proven itself to be viable to write complex software, and was developed from structured programming solely for this purpose, to cope with increasing complexity of programs. Functional Programming: Functional programming is something complely different from imperative programming. In functional programming, you don't care about assigning values to variables, in the meaning of allocating memory etc. It is a mathematical way to program things. It is based solely on functions, whereas in imperative programming you have assignments and conditional constructs etc. and you use it in a imperative way by calling them sequentially. I don't know too much about functional programming, but this is the main difference between them. Functional programming is not suited for common software, it is more suited for implementing algorithms and calculus etc. BTW: This topic is too broad, but if anyone want to discuss Systems Engineering/Design stuff I'm in, such like SOA, Web development etc. | ||
Freezard
Sweden997 Posts
On July 10 2010 05:54 ChoboCop wrote: I'm a .Net C# dev. I really appreciate tools like generics, linq, and the entity framework. LINQ is probably the main reason why I got to like C# so much, it's fucking brilliant. | ||
haxorz
United States138 Posts
On July 10 2010 08:49 eaT_Mi_Lquid wrote: + Show Spoiler + On July 10 2010 07:48 catamorphist wrote: In the interest of combatting disinformation, I feel compelled to point out that this is absolutely, 100% false and bears no relationship to reality. When people talk about "functional programming" they are implying two things: 1a) Being able to pass functions to higher-order functions. 1b) Being able to define anonymous functions concisely (otherwise 1a is very awkward.) 2) Writing in a style as to isolate functions that have observable side effects from non-side-effecting functions, so that you can reason about code more easily. OK, some people seem to be confused/ do not exactly understand the differences between these different programming paradigm. As for "Imperative Programming (C, C++, Java, .Net, JavaScript etc.): It is the most common programming paradigm, and most of the software are written in imperative programming style. In imperative programming, you assign information/values to variables. In the beginning of computing it means that you will assign some value to a memory address, in modern programming you assign values to variables. Because you assign something and instruct the function/program to do something with it actively it is called "Imperative programming". an example for imperative programming in pseudo code is int a = 1; int b = 10; while(a < b){ a = a + 1; if(a == b/2) //do something } As you can see you instruct the program to do something, therefore it's called imperative proramming. Object Oriented Programming: OOP, is a programming paradigm that is used in imperative programming a lot. It mainly results from structured programming (i did not check this), and it differs from OOP mainly in this regard: Instances. Whereas in structured programming you program by assigning simple values or complex value types (combining a set of value types into one structure), you will define those structures and create instances of those structures in OOP. Meaning that you work with instances (objects) instead of data structures which are statically allocated in the memory. If you want it, you can call classes that are defined in any modern OOP language structures, whenever they are declared as "static". In summary, OOP is about working with instances of defined data structures and procedures. OOP has proven itself to be viable to write complex software, and was developed from structured programming solely for this purpose, to cope with increasing complexity of programs. Functional Programming: Functional programming is something complely different from imperative programming. In functional programming, you don't care about assigning values to variables, in the meaning of allocating memory etc. It is a mathematical way to program things. It is based solely on functions, whereas in imperative programming you have assignments and conditional constructs etc. and you use it in a imperative way by calling them sequentially. I don't know too much about functional programming, but this is the main difference between them. Functional programming is not suited for common software, it is more suited for implementing algorithms and calculus etc. I was going to write up a long response as well, so I'll be concise (and a bit imprecise). Functional programming models computation as the evaluation of mathematical functions. The "unit" of computation is the function. Imperative programming models computation as the execution of commands and the mutation of state. The "unit" of computation is the command. Object-Oriented programming models computation as the interaction between objects. The "unit" of computation is the object. As there seems to be a misconception about functional programming (with regards to purpose, usefulness, etc), I'd be happy to answer anyone's questions. | ||
jgad
Canada899 Posts
I code in Delphi. And ladder logic. 0_o | ||
eaT_Mi_Lquid
Germany509 Posts
On July 10 2010 09:16 jgad wrote: All these fancy, trendy languages.... I code in Delphi. And ladder logic. 0_o Hehe , actually, real software devs don't care about certain prog. languages anymore. If there's a need to implement something in a certain language they just do it. Familiarity with a certain language is not that important, as good programmers can get a grasp from a given programming language really fast. | ||
| ||