Bit stuck with Coding Academy Project One

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Postby Hudzilla » Thu Feb 04, 2010 10:43 pm

Hey!

Bazza: please do take any programming competitions into their own thread :)

Marrea: I do a lot of C-like languages, like PHP, C#, C++, etc. These all have very similar syntax: lots of { and }, lots of ; and lots of ( and ).

A few months ago, I wrote a little library for Python called Gloss (www.tuxradar.com/gloss), which has quite a different syntax to C, so when I returned to C# I was making these kinds of errors all the time - missing braces, missing semi-colons, etc.

For me, because I have this C stuff on quite a deep level in my brain, it's pretty easy for me to get back into "C mode" after an hour or two. But for you it will take a little longer because it's your first time: you will stare at errors like this and have no idea what's causing it... but when you spot the fix, you'll remember it along with the symptoms, and be much faster to fix it next time.

There are lots of problems you'll come across, but the one I hate the most is the missing brace: you think you've closed a foreach loop, but actually you've just closed the Main() method, which means everything afterwards causes epic-level errors for MonoDevelop.

Fortunately, careful indenting of your code means it's fairly easy to find these problems. Also, newer versions of MonoDevelop dot little red scribbles around to show you when your code is wrong - it's not perfect, but it can often point you in the right direction.


Paul
User avatar
Hudzilla
Site admin
 
Posts: 265
Joined: Mon Apr 04, 2005 11:52 am
Location: LXF Towers

Postby 1slipperyfish » Fri Feb 05, 2010 12:18 pm

i don't know whether you're a command line jockey or an ide person, but if you use eclipse or similar ide it will point out missing braces etc, admittedly it does make for lazy coding but it's just a suggestion, i always try to learn a new language using the command line as it teaches you to look for mistakes rather than having them auto-checked :D finding errors is just part of the learning process :D
paul
i am a follower of the culture

Image
User avatar
1slipperyfish
Forum Jester
 
Posts: 2431
Joined: Mon May 09, 2005 2:52 pm
Location: wigan

Postby Ram » Fri Feb 05, 2010 1:01 pm

1slipperyfish (troll) wrote: finding errors is just part of the learning process :D
paul


But how do we fix you..... :roll:

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1676
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough

Postby Marrea » Fri Feb 05, 2010 7:52 pm

Hudzilla wrote:But for you it will take a little longer because it's your first time: you will stare at errors like this and have no idea what's causing it... but when you spot the fix, you'll remember it along with the symptoms, and be much faster to fix it next time.

Couldn't agree more. A bit like Linux generally, really. I've learned so much by not simply reinstalling every time something goes wrong but doing my best to research the problem and get it solved without taking the easy way out.

Fortunately, careful indenting of your code means it's fairly easy to find these problems. Also, newer versions of MonoDevelop dot little red scribbles around to show you when your code is wrong - it's not perfect, but it can often point you in the right direction.

Yes, I've seen quite a few of those red scribbles this last week!
User avatar
Marrea
LXF regular
 
Posts: 1873
Joined: Fri Apr 08, 2005 9:32 pm
Location: Chilterns, West Hertfordshire

Postby Marrea » Fri Feb 05, 2010 7:57 pm

1slipperyfish (troll) wrote:i don't know whether you're a command line jockey or an ide person

I'm too new to all this to have a preference yet. But so far I'm happy either way. However, in the magazine Paul seems keen for us to use the command line so I shall probably be concentrating on that.
User avatar
Marrea
LXF regular
 
Posts: 1873
Joined: Fri Apr 08, 2005 9:32 pm
Location: Chilterns, West Hertfordshire

Postby Hudzilla » Fri Feb 05, 2010 11:03 pm

Code and build from the GUI; run from the command-line. This makes running commands with parameters so much easier!
User avatar
Hudzilla
Site admin
 
Posts: 265
Joined: Mon Apr 04, 2005 11:52 am
Location: LXF Towers

Postby Marrea » Sat Feb 06, 2010 12:33 pm

Hudzilla wrote:Code and build from the GUI; run from the command-line. This makes running commands with parameters so much easier!

Thanks for the clarification. :wink:
User avatar
Marrea
LXF regular
 
Posts: 1873
Joined: Fri Apr 08, 2005 9:32 pm
Location: Chilterns, West Hertfordshire

Previous

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron