[Solved] programming languages

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
cndr
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 65
Joined: Sat Apr 24, 2010 7:03 am
Programming Language of Choice: etc.

[Solved] programming languages

Post by cndr »

I'm thinking about learning a second language right now I only know c++, and would like to know which language compliments it, I've heard that python, and lua are good to use, but what about xml? I don't know much about any of those languages, so I'm not really sure what is right for me, any ideas?
Last edited by cndr on Mon Apr 26, 2010 2:36 pm, edited 1 time in total.
Long Live The Queen!
User avatar
thejahooli
Chaos Rift Junior
Chaos Rift Junior
Posts: 265
Joined: Fri Feb 20, 2009 7:45 pm
Location: London, England

Re: programming languages

Post by thejahooli »

It depends on what you want to use it for. Lua can be used as an embedded scripting language in C++ to run external scripts in your program. XML isn't really a programming language, it's just a way of displaying data in a file which you read into your program to use.
I'll make your software hardware.
ajtgarber
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 97
Joined: Wed Jun 10, 2009 8:56 am

Re: programming languages

Post by ajtgarber »

As thejahooli said, it depends on what your using it for. You could learn C# and XNA to make games for the Xbox, Objective-C for Iphone development, Java for... just an all around language, or even Assembly if your brave enough.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: programming languages

Post by avansc »

C compliments C++ pretty well.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: programming languages

Post by dandymcgee »

avansc wrote:C compliments C++ pretty well.
You sure do love C don't you? :) I wholeheartedly agree, learning C would be a great investment of your time.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: programming languages

Post by Ginto8 »

dandymcgee wrote:
avansc wrote:C compliments C++ pretty well.
You sure do love C don't you? :) I wholeheartedly agree, learning C would be a great investment of your time.
Most certainly. I started as a C++ programmer who foolishly abused and overused OOP. I started using C, and then D (don't try it, it's still a LONG way from being complete - it doesn't even have all the features it says it has! :( ), and I learned a lot of the pros (and cons) of OOP, and (for the most part) why abused OOP can murder code. I think you should try out C definitely, and then a more OOP language, maybe Java, so you learn why C++ is a very good language that successfully combines procedural and OOP, without forcing complete use of one or the other :) . You'll also learn how you can resist the urge to abuse either :mrgreen: .
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
thejahooli
Chaos Rift Junior
Chaos Rift Junior
Posts: 265
Joined: Fri Feb 20, 2009 7:45 pm
Location: London, England

Re: programming languages

Post by thejahooli »

I agree with learning C. It teaches you not to abuse some features of C++, such as using STL strings when a C-style string could be a better choice.
I'll make your software hardware.
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: programming languages

Post by GroundUpEngine »

avansc wrote:C compliments C++ pretty well.
Agreed 100%
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: programming languages

Post by MrDeathNote »

Ginto8 wrote:
dandymcgee wrote:
avansc wrote:C compliments C++ pretty well.
You sure do love C don't you? :) I wholeheartedly agree, learning C would be a great investment of your time.
Most certainly. I started as a C++ programmer who foolishly abused and overused OOP. I started using C, and then D (don't try it, it's still a LONG way from being complete - it doesn't even have all the features it says it has! :( ), and I learned a lot of the pros (and cons) of OOP, and (for the most part) why abused OOP can murder code. I think you should try out C definitely, and then a more OOP language, maybe Java, so you learn why C++ is a very good language that successfully combines procedural and OOP, without forcing complete use of one or the other :) . You'll also learn how you can resist the urge to abuse either :mrgreen: .
Agreed, C is great, but there are other great languages out there c# is really useful and is very widely used. I learned C and then C++, if you are a competent C++ programmer you should be able to pick up C quickly as you should be familiar with a lot of the functions since C++ includes C as a subset. You've probably used quite a few C functions and don't even know it.
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
jacob.krustchinsky
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Tue Feb 23, 2010 10:18 pm

Re: programming languages

Post by jacob.krustchinsky »

Might I be the one to recommend a more OO language such as Java or C#. Learning either of those languages will give you a far better understanding of OOP, which you can apply in C++
User avatar
cndr
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 65
Joined: Sat Apr 24, 2010 7:03 am
Programming Language of Choice: etc.

Re: programming languages

Post by cndr »

Thanks for the help everyone, I think I'm going to learn c, and do some lua on the side.
Long Live The Queen!
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: programming languages

Post by dandymcgee »

jacob.krustchinsky wrote:Might I be the one to recommend a more OO language such as Java or C#. Learning either of those languages will give you a far better understanding of OOP, which you can apply in C++
Just out of curiosity have you ever used C#? I've been using it for my CS project since September, and although it's highly OO I disagree that it helps to teach you OOP concepts any better than C++. Many of the other students in my class have no idea why a function called "Write()" pops up when they type "Console." in visual studio, but rather just take for granted that it does.

Obviously everyone is learns differently, but I've found C++ to be a far better tool than C# for learning what OO means and how it works.

Keep in mind I'm arguing that C# isn't better than C++ at teaching OOP, not that it isn't a good learning resource. C# is a great language, is widely used, and has many useful applications.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: programming languages

Post by MadPumpkin »

For scripting? Python, LUA, JavaScript are all my favorites. But as an all around language I'd say C, Java, C++ and since you know the later, I'd say one of the first two would be great.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
EccentricDuck
Chaos Rift Junior
Chaos Rift Junior
Posts: 305
Joined: Sun Feb 21, 2010 11:18 pm
Current Project: Isometric "2.5D" Airship Game
Favorite Gaming Platforms: PS2, SNES, GBA, PC
Programming Language of Choice: C#, Python, JScript
Location: Edmonton, Alberta

Re: programming languages

Post by EccentricDuck »

Anyone with an opinion on Lisp? I've heard people go "oh, it's outdated, no one uses it, etc etc." and a select few say things like "it's made me a far better programmer" or "it's the reason I can rapidly create effective tools and software while others take several times as long with XX language". I've never really seen a good description of WHY either of those parties have those opinions though; but I would like to know since the latter group certainly have appealing positions.
User avatar
wtetzner
Chaos Rift Regular
Chaos Rift Regular
Posts: 159
Joined: Wed Feb 18, 2009 6:43 pm
Current Project: waterbear, GBA game + editor
Favorite Gaming Platforms: Game Boy Advance
Programming Language of Choice: OCaml
Location: TX
Contact:

Re: programming languages

Post by wtetzner »

EccentricDuck wrote:Anyone with an opinion on Lisp? I've heard people go "oh, it's outdated, no one uses it, etc etc." and a select few say things like "it's made me a far better programmer" or "it's the reason I can rapidly create effective tools and software while others take several times as long with XX language". I've never really seen a good description of WHY either of those parties have those opinions though; but I would like to know since the latter group certainly have appealing positions.
Yes, I actually use Lisp at work every day. Well, I actually use Clojure, which is a Lisp dialect that runs on the JVM.
The reason people say it's made them a better programmer is that Lisp has abstractions that other languages don't, so you learn to think differently when solving programming problems.
I think the reason people say Lisp is the reason they can create software faster than in other languages is also that the abstractions are good.

The main abstraction mechanism Lisp has that other languages don't have is macros, which let's you create new language constructs by hooking into the compiler, and having your code run at compile time. See, the reason for all of the parentheses in Lisp is that Lisp code is defined in terms of Lisp lists. A List with a symbol and three number in Lisp looks like (+ 1 2 3). When this is read by the reader, it gets turned into a list data structure in memory, and is then passed to the compiler. So the compiler compiles data structures, not text. And not just any data structures, but the core Lisp data structures. In most Lisps this is just lists, but Clojure also has literal vectors and hash maps.

So...what was I getting at? Oh right, macros. Macros are called at compile time, and the arguments to a macro are passed in as code (in the form of data structures). The macro then returns data structures, which represent code, and the compiler compiles the returned code.

Here's an example. The built-in way to create a function in Clojure is

Code: Select all

(fn [x] (* 2 x))
This function takes one argument, and returns the input times two. But notice this function doesn't have a name. So to give it a name, you would do

Code: Select all

(def times-two (fn [x] (* 2 x)))
But this is kind of annoying. Wouldn't it be nice if there was a cleaner way to define a named function? Well, why not write one?

Code: Select all

(defmacro defn
  [name args & body]
  `(def name (fn args ~@body)))
I know you don't know exactly what's happening in the above code, but the point is that now we can use the macro 'defn':

Code: Select all

(defn times-two [x] (* 2 x))
In this example, I used a pattern syntax in the macro definition, but it could have been written like this too:

Code: Select all

(defmacro times-two
  [name args & body]
  (cons 'def (cons name (concat ['fn args] body))))
Anyway, the point is that you can return any code from a macro, which can be manipulated/generated by the full Lisp language.

Lisp also has other powerful abstractions, like closures, but other languages have closures as well.

I don't know if you wanted that much of an explanation of Lisp macros :), and I probably did a bad job explaining them anyway.
If you want a better explanation, I would recommend this: http://www.defmacro.org/ramblings/lisp.html

Anyway, the point is that I think it's worth learning Lisp. People tend to complain about all the parens, but I like the syntax. I like it because it's simple and consistent.
Also, there really aren't many more parens in Lisp than in other languages, it's just that Lisp doesn't have any of the other syntax in it.

Code: Select all

C++ function call:
someFunc(foo, bar, baz);

Lisp function call:
(some-func foo bar baz)

C++ if:
if(someFunc(foo, bar, baz))
{
  return otherFunc(foo);
}
else
{
  return anotherFunc(bar);
}

Lisp if:
(if (some-func foo bar baz)
  (other-func foo)
  (another-func bar)))
Same number of parens. :)
Last edited by wtetzner on Sun Apr 01, 2012 10:39 am, edited 1 time in total.
The novice realizes that the difference between code and data is trivial. The expert realizes that all code is data. And the true master realizes that all data is code.
Post Reply