Author Topic: What programming language would you reccomend?  (Read 22570 times)

0 Members and 1 Guest are viewing this topic.

Offline GuyPerfect

  • Posts: 363
    • View Profile
Re: What programming language would you reccomend?
« Reply #15 on: June 11, 2009, 04:57:12 PM »
There's a reason I quoted the C/C++ Faq.  I suggest you take some time to read it.

I started looking around, but didn't get very far knowing it was a freelancer's work and glorified IRC log. Forming arguments on a subjective work while ignoring official documents won't help people be informed on the matter. I recommend consulting the C standard instead.

My general premise is that C has a number of gotchas that can work against a beginner, especially in the context of making sure their code works correctly cross-platform.  That said, you can turn this around and say it'd be a good exercise for someone to learn to use the language properly.

The main issue I have with this is that you're asserting potential difficulties as being the fault of the C language itself, while my 15 years of experience, researching and academics suggest otherwise. It's true, however, that the programmer may need to be aware of inconsistencies between their target platforms and their compilers. Having said that, I don't think it's appropriate to put C's name on those inconsistencies and draw a fanged face on it with a crayon.

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: What programming language would you reccomend?
« Reply #16 on: June 11, 2009, 08:26:02 PM »
There's a reason I quoted the C/C++ Faq.  I suggest you take some time to read it.

I started looking around, but didn't get very far knowing it was a freelancer's work and glorified IRC log. Forming arguments on a subjective work while ignoring official documents won't help people be informed on the matter. I recommend consulting the C standard instead.

I suppose you don't care for Wikipedia either.  It is amazing though that you'd dismiss something as "subjective work" without so much as a look on it.  If you read one of the answers you may notice that they usually quote the relevant sections in the various standards and more official documents to back their explanations.

Anyway, it doesn't change the fact that you're wrong in the questions I quoted from the website related to expression evaluation.  Look at Annex C in the standard you referenced for a list of sequence points defined by the standard, and look at what the standard says in example 7 in section 5.1.2.3, which comes quite close to one of the expressions from the C FAQ whose value is unspecified by the standard.

The main issue I have with this is that you're asserting potential difficulties as being the fault of the C language itself, while my 15 years of experience, researching and academics suggest otherwise. It's true, however, that the programmer may need to be aware of inconsistencies between their target platforms and their compilers. Having said that, I don't think it's appropriate to put C's name on those inconsistencies and draw a fanged face on it with a crayon.

 :D You know, you're sounding almost like I've offended your religion or something.  No one's "blaming" the language for its "difficulties".  The language cannot read the programmer's mind; it's always the responsibility of the programmer to make sure that the code they've written reflects the functionality they intend.  I'm only stating my belief that it takes a little more for a beginner to properly use C to write and debug programs that work on multiple platforms, as compare with other languages out there that have been designed from ground up to more explicitly support platform independence.  These little issues I mentioned about C are but merely one of the points I raised in my original post explaining why I disprefer C/C++ in answering DullStar's question.  I never imagine you would drag this one point out into an off-topic discussion.

There's actually one other thing which I haven't even begin to touch on, which you're surely aware of.  C and C++ gives the programmer complete control over memory management.  And of course, in practice in the industry, this is where you have your source of things like memory leaks that eventually slows down the computer, and buffer overruns that lead to security vulnerabilities.  Again, certainly not the language's "fault" by any means, nor am I "drawing a fanged face" over explicit memory management.  But consider that we have professional programmers, not a beginner, working in an industry where such issues cost valuable time and money, and still customers run into these issues.  Now consider a language that doesn't directly expose pointers and have garbage collection.  I believe it would be justified for a beginner to choose the latter language, if it is good enough for the programs he wishes to write (eg. performant enough for the game being written).

[And lest you decide to start another off-topic discussion around this, yes, I know that garbage collection doesn't solve memory leaks completely, and your program still fails (albeit at least not so silently) if it access an array or similar data structure out-of-bounds.]

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: What programming language would you reccomend?
« Reply #17 on: June 11, 2009, 09:46:01 PM »
Yeah.
STAY ON TOPIC.

If this strays too far, summer will be over before I even know what programming language I'm going to use!

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: What programming language would you reccomend?
« Reply #18 on: June 12, 2009, 07:01:19 AM »
My recommendation is C#, in Mono and using MonoDevelop. Why?

It's available for Linux, Mac OS X, and Windows (and Windows can of course run the software against the .NET Framework). You run Linux, so there we go. To do the game parts, you could use SdlDotNet (also for all three of the aforementioned platforms). This is a check against your list.
From my experience coding my current clone, I don't need to make too much changes from one to the other so that is another check against your list. I have it in Windows and Mono at the moment with no trouble.

C# is also very easy to learn, I have found. There's a wealth of knowledge on C# in many popular learning series (for Dummies, teach yourself in x minutes, etc). It is an object-oriented language, which makes things so much much simpler in large projects. It also has garbage collection, which means you don't need to deal with some of the nitty gritty details like memory management.

Many people will say that perhaps there are more powerful languages, or blah blah blah. Well, I think C# is plenty powerful and further more hits that button which is quite important: easy to learn. Remember, you'll get alot of suggestions Dullstar, pick whatever YOU think matches YOUR needs. Don't let people tell you that you need "x feature" and "y feature". Get what you want, mate!

Trying it right now!  Personally, I feel a good way to choose a good language would be to try it!  Suggestions are quite helpful, and the vast majority recommend C#.  And as for x feature/y feature, I don't think I'll run into problems like that.  I mean, really, the MMF website has a tutorial for writing an OS in MMF2 (like that'll work considering it builds Windows programs :P), C# can probably do important game functions.

EDIT:  Windows version won't run, so I'm going to have to get the Ubuntu partition up and running again.

Offline The Doctor

  • Posts: 301
  • Jason the Human
    • View Profile
    • zapzupnz.com
Re: What programming language would you reccomend?
« Reply #19 on: June 12, 2009, 11:27:29 AM »
If you wish to use Windows, you can also use Visual C# 2008 Express Edition (google for it, it's free).

 I find it useful to edit the interface of my program using that, and then test my program in MonoDevelop (MD can open VC#2k8 solution files) to see how it runs on OS X and Linux. (That, and MonoDevelop doesn't have a Windows Forms editor, only a GTK# editor which is no good to me...)

Also, check this out: Click here for a quick C# tutorial.
This Lemmings forum is simply *fabulous*!

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: What programming language would you reccomend?
« Reply #20 on: June 12, 2009, 10:16:57 PM »
Working on getting Ubuntu back up.  I'll get back to this then.

Should of updated earlier, because I've finished getting Ubuntu back up a while ago.

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: What programming language would you reccomend?
« Reply #21 on: July 16, 2009, 10:58:53 PM »
Update:  I have chosen a programming language and have gotten farther than I ever did in C#.

Python's pretty easy.  I got past the hello world tutorial for once, and I've heard it's quite powerful.  I'm still figuring out how to make programs that work in Linux and Mac OS X (it is possible), but there are many tutorials out there for that, so I might find one that works eventually.

This is the Hello World program in Python:
Code: [Select]
print "Hello World"Compare that to any form of C and you'll see what I mean.

Offline The Doctor

  • Posts: 301
  • Jason the Human
    • View Profile
    • zapzupnz.com
Re: What programming language would you reccomend?
« Reply #22 on: July 20, 2009, 01:50:23 PM »
Console.WriteLine("Hello World") in C#

and

NSLog(@"Hello world")

2 points to whoever works out what languages those are.
This Lemmings forum is simply *fabulous*!

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: What programming language would you reccomend?
« Reply #23 on: July 20, 2009, 07:37:47 PM »
Console.WriteLine("Hello World") in C#

I don't know Python but if Dullstar's talking about a complete program, in C# you definitely need more than just that one line.

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: What programming language would you reccomend?
« Reply #24 on: July 20, 2009, 11:42:13 PM »
It's a really simple programming language to learn.  Besides, all the non-coding problems were the exact same ones a ran into before, namely figuring out how to get it to run.

No matter how a programming language needs to be done to test, I cannot figure out how to do it.

Compilers work for some people with C#, but a bunch of random babble errors come up in the compilers.  At least in Python I'm starting to find some possible solutions for getting it to run.

Offline The Doctor

  • Posts: 301
  • Jason the Human
    • View Profile
    • zapzupnz.com
Re: What programming language would you reccomend?
« Reply #25 on: July 21, 2009, 12:04:14 AM »
Hehe yup. I say use whatever language you want, as long as it suits your needs. My needs are that I can use it at university, and they only support C# and Java. :/

ccexplore was right. Here's a full C# implementation of Hello World.

using System;
namespace HelloWorld
{ class MainClass
{ public static void Main (string[] args)
{
Console.WriteLine("Hello World");
}
}
}

... My favourite programming language at present is Lolcats.
This Lemmings forum is simply *fabulous*!

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: What programming language would you reccomend?
« Reply #26 on: July 21, 2009, 12:07:17 AM »
Oh yeah.  LOLCODE.  There's actually a Wikipedia article on that.  I don't know how usable it is though.

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: What programming language would you reccomend?
« Reply #27 on: July 27, 2009, 06:18:30 AM »
I learned how to make this with a tutorial.  The actual program I wrote for the tutorial is in a different .py file though.  Don't forget to extract it, though!  Download is at bottom of post.
This is my fully functional calculator applying what I learned from the tutorial, but coded without a tutorial.  I had a little help getting it fully functional and at the time being have not yet made Windows and Mac OS X ports, though it should be easy to do.  Please note that I don't know if the program will automatically be able to execute.  If it can't, you should be able to find the answer on Google.

For Ubuntu and its variants, you can do it by putting:

Code: [Select]
chmod +x /this/is/the/path/to/calc.py
into the terminal.
Replace /this/is/the/path/to/ with the directory the file is in.

calc.py.zip

Offline The Doctor

  • Posts: 301
  • Jason the Human
    • View Profile
    • zapzupnz.com
Re: What programming language would you reccomend?
« Reply #28 on: July 27, 2009, 06:20:01 AM »
Easy on OS X. Just double clicked, it ran. :-) Ran into an error when I attempted to enter invalid data into the input system. Next step, error checking. :P

Here's my adaptation of your calculator in C#. Boy howdy, does it look different, lol.
Attached is also the binary executable. You can simply double click this to run in Windows.
On Linux or Mac OS X, make sure you have Mono installed. Then open a command line, navigate to
the folder containing the EXE file, and run this command.
mono ConsoleCalc.exe

DOWNLOAD HERE!!

Code: [Select]
/*
 * Name: ConsoleCalc
 * By: Jason Ryfle (zapzupnz)
 * Date: 27 07 2009
 *
 * Description: a simple calculator-like utility for the command line
 * written in C# using the .NET libraries and Mono.
 *
 * License and credits in credits() method.
 * Alternatively, run the software and hit the 4 key and press return.
 *
 * */

using System;

namespace ConsoleCalc
{
   class MainClass
   {
      public static void Main (string[] args)
      {
         sbyte todoSignedByte = 0;
                  
         Console.Clear();
         Console.WriteLine("Welcome to ConsoleCalc\nChoose a function from the list below by entering the number.\n\n");
         Console.WriteLine("1. Calculation\n2. Area\n3. Powers\n4. Credits\n\n");
         try
         {
            todoSignedByte = sbyte.Parse(Console.ReadLine());
         }
         catch
         {
            todoSignedByte = sbyte.Parse(Console.ReadLine());
         }
         
         if (todoSignedByte == 0)
         {
            Console.WriteLine("Terminating...");
            return;
         }
         else if (todoSignedByte == 1)
         {
            calculator();
         }
         else if (todoSignedByte == 2)
         {
            area();
         }
         else if (todoSignedByte == 3)
         {
            powers();
         }
         else if (todoSignedByte == 4)
         {
            credits();
         }
         else if (todoSignedByte > 4)
         {
            Console.WriteLine("Terminating...");
            return;
         }
      }
      
      public static double Evaluate(string expression) 
       { 
           System.Data.DataTable table = new System.Data.DataTable(); 
           table.Columns.Add("expression", string.Empty.GetType(), expression); 
           System.Data.DataRow row = table.NewRow(); 
           table.Rows.Add(row); 
           return double.Parse((string)row["expression"]); 
       }
      
      static void calculator()
      {
         Console.Clear();
         Console.WriteLine("Write your calculation:");
         try
         {
         string problemString = Console.ReadLine();
         Console.WriteLine("Answer is: " + Evaluate(problemString));
         }
         catch
         {
            Console.WriteLine("Invalid formula. Press any key to try again.");
            Console.ReadKey();
            calculator();
         }
      }
      
      static void area()
      {
         Console.Clear();
         Console.WriteLine("Choose a shape from the list by number." +
                           "\n" +
                           "\n1. Rectangle" +
                           "\n2. Circle" +
                           "\n3. Triangle" +
                           "\n4. Trapezoid" +
                           "\n5. Square or Rhombus" +
                           "\n6. Parallelogram" +
                           "\n\n");
         sbyte shapeSignedByte = sbyte.Parse(Console.ReadLine());
         if (shapeSignedByte == 0)
         {
            Console.WriteLine("Terminating...");
            return;
         }
         else if (shapeSignedByte == 1)
         {
            rect();
         }
         else if (shapeSignedByte == 2)
         {
            circle();
         }
         else if (shapeSignedByte == 3)
         {
            triangle();
         }
         else if (shapeSignedByte == 4)
         {
            trapezoid();
         }
         else if (shapeSignedByte == 5)
         {
            rect();
         }
         else if (shapeSignedByte == 5)
         {
            rect();
         }
      }
      
      static void rect()
      {
         Console.WriteLine("\nHow long is this shape?"); double length = double.Parse(Console.ReadLine());
         Console.WriteLine("How wide is this shape?"); double width = double.Parse(Console.ReadLine());
         Console.WriteLine("Answer is: " + (length * width));
      }
      
      static void circle()
      {
         Console.WriteLine("\nWhat is the diameter of this circle?"); double diameter = double.Parse(Console.ReadLine());
         double radius = diameter / 2;
         Console.WriteLine("Radius is: " + radius.ToString());
         Console.WriteLine("Answer is: " + (radius * radius * Math.PI));

      }
      
      static void triangle()
      {
         Console.WriteLine("\nWhat is the length of the base?"); double length = double.Parse(Console.ReadLine());
         Console.WriteLine("How tall is the triangle?"); double height = double.Parse(Console.ReadLine());
         Console.WriteLine("Answer is: " + (length * height / 2));
      }
      
      static void trapezoid()
      {
         Console.WriteLine("\nWhat is the length of the one of the bases?"); double base1 = double.Parse(Console.ReadLine());
         Console.WriteLine("What is the length of the other base?"); double base2 = double.Parse(Console.ReadLine());
         Console.WriteLine("How tall is the trapezoid?"); double height = double.Parse(Console.ReadLine());
         Console.WriteLine("Answer is: " + (height*(base1+base2)/2));
      }
      
      static void powers()
      {
         Console.Clear();
         Console.WriteLine("What number shall we multiply?"); double toMult = double.Parse(Console.ReadLine());
         Console.WriteLine("To what power shall we do this?"); double powerToMult = double.Parse(Console.ReadLine());
         Console.WriteLine("Answer is: " + (Math.Pow(toMult, powerToMult)));
      }
      
      static void credits()
      {
         Console.Clear();
         Console.WriteLine("A loose adaptation of Dullstar's calculator, " +
                           "\nconverted to C# using the .NET libraries" +
                           "\nDeveloped in MonoDevelop for Mac OS X" +
                           "\nCompiled with Mono" +
                           "\nYou are free to share and modify this source code");
      }
   }
}
This Lemmings forum is simply *fabulous*!

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: What programming language would you reccomend?
« Reply #29 on: July 29, 2009, 10:06:39 AM »
I might try learning how that works.  I find that Python appears to be losing its advantage after the calculator.

Looks like it handles multiple lines better than Python (well, to my knowledge, anyways...)