Sonic and Sega Retro Message Board: Your Programming Language of Choice? - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 8 Pages +
  • ◄ First
  • 6
  • 7
  • 8
    Locked
    Locked Forum

Your Programming Language of Choice? Share your favorite way to code

#106 User is offline HarrisonJ 

Posted 13 December 2010 - 04:50 AM

  • Posts: 1387
  • Joined: 24-June 10
  • Gender:Male
  • Location:Winnipeg
  • Project:University
  • Wiki edits:16
I learned Visual Basic as my first language, but as of now my favorite is Java.

#107 User is offline nineko 

Posted 13 December 2010 - 10:47 AM

  • I am the Holy Cat
  • Posts: 5341
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
QUOTE (TmEE @ Dec 13 2010, 08:45 AM)
Here's some crappy code, Nineko may like it :
I do wink.png

Have some VB5 code now:
CODE
Private Sub Command2_Click()
Open Label1.Caption + "\" + Text1.Text For Binary As #1
For I% = 0 To 1023
a$ = Chr$(Stage(I%))
Put #1, , a$
Next I%
For I% = 0 To 3
If Option4(I%).Value Then Exit For
Next I%
'direction
a$ = Chr$(I% * 64)
Put #1, , a$
a$ = Chr$(0)
Put #1, , a$
'x
a$ = Chr$(List1.ListIndex)
Put #1, , a$
a$ = Chr$(0)
Put #1, , a$
'y
a$ = Chr$(List2.ListIndex)
Put #1, , a$
a$ = Chr$(0)
Put #1, , a$
'perfect
a$ = Chr$(List3.ListIndex \ 256)
Put #1, , a$
a$ = Chr$(List3.ListIndex And 255)
Put #1, , a$
Close #1
If File1.ListIndex = -1 Then File1.Refresh
End Sub


#108 User is offline MainMemory 

Posted 13 December 2010 - 10:51 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
To me, VB looks kind of like ASM, only more confusing.

#109 User is offline Travelsonic 

Posted 13 December 2010 - 05:13 PM

  • Posts: 661
  • Joined: 01-March 05
The formatting on that VB code looks atrocious. :P

#110 User is offline Hayate 

Posted 14 December 2010 - 02:22 AM

  • Posts: 2376
  • Joined: 01-February 04
  • Gender:Male
  • Location:Torquay, England
  • Wiki edits:70
I know:
68k ASM
C, Java, I won't claim to know C++ cause I use it so rarely I forget how to do shit
QB, VBC, VB.NET (I haven't used those three in ages)
Python
PHP, MySQL (does that one even count?)
XHTML, CSS, JS
GML (Game Maker), AHK (AutoHotkey)

And yes I did actually program something interactive in AHK, it's an anime episode chooser I use in the lounge (Essentially the media center PC except it's not running Media Center, it's running ordinary Windows XP).
I kind of wish there was a C-style version of AHK, because AHK is incredibly useful but the syntax is even more horrendous than Basic.

QUOTE
Argument about tabs vs spaces


Use tabs. Just... use tabs. For the reason already stated in the thread - anyone reading the code will see it with their preference of tab width.
Also, it only takes one keystroke to backspace a tab, while it takes eight (or four if you're not hardcore) keystrokes to backspace an indentation of spaces.

QUOTE
Argument about braces on their own line


CODE
void main(void) {
<tab>...
}


Do that, it looks so much neater.
If you put it on its own line, the shape of the lines moves to the left for the one-character brace which is aligned with the start of the line it should be on... and then moves back over to the right for the body.
If you put it where it should be, the shape of the line moves right for an indent... as it should.

I've also seen people doing this:

CODE
void main(void)
<tab>{
<tab>...
}


which is just plain wrong, the brace is not part of the body.

#111 User is offline Sik 

Posted 14 December 2010 - 02:34 AM

  • Sik is pronounced as "seek", not as "sick".
  • Posts: 6719
  • Joined: 17-March 06
  • Gender:Male
  • Project:being an asshole =P
  • Wiki edits:11
Pretty much all modern IDEs and text editors will kill space-based indentation in a single stroke, so that reason is out of the way.

And like it has been said, usually hard tabs end up mixed with spaces, making the indentation look completely wrong...

#112 User is offline Yuzoboy 

Posted 14 December 2010 - 07:03 AM

  • Posts: 107
  • Joined: 09-December 10
  • Gender:Male
  • Location:UK
QUOTE (Hayate @ Dec 14 2010, 07:22 AM)
CODE
void main(void) {
<tab>...
}


Do that, it looks so much neater.
If you put it on its own line, the shape of the lines moves to the left for the one-character brace which is aligned with the start of the line it should be on... and then moves back over to the right for the body.
If you put it where it should be, the shape of the line moves right for an indent... as it should.


Thats the format im trying to use now. I actually got marked down in a technical interview for using the following format:

CODE
void main(void)
{
<tab>...
}


Apparently senior developers don't like it...
This post has been edited by Yuzoboy: 14 December 2010 - 07:03 AM

#113 User is offline RamiroR 

Posted 14 December 2010 - 09:10 AM

  • Posts: 355
  • Joined: 11-May 08
  • Gender:Male
  • Wiki edits:9
Objective-C , please don't hit me. :P

Nah, actually C++, but I'm learning/interested in learning Objective-C.

#114 User is offline AamirM 

Posted 14 December 2010 - 04:13 PM

  • Posts: 398
  • Joined: 12-March 08
  • Gender:Male
  • Location:Karachi, Pakistan
  • Wiki edits:9
QUOTE (Yuzoboy @ Dec 14 2010, 07:03 AM)
Thats the format im trying to use now. I actually got marked down in a technical interview for using the following format:

CODE
void main(void)
{
<tab>...
}


Apparently senior developers don't like it...

What has indentation has to do with "technical" interview? It's a matter of preference and style (unless you were given some standard/guidelines to adhere to). It's like a bunch of these senior developers (aka fags) would mark you down if you liked Coke instead of Pepsi. I want to punch these sort of interviewers.

#115 User is offline FraGag 

Posted 14 December 2010 - 05:31 PM

  • Posts: 659
  • Joined: 09-January 08
  • Gender:Male
  • Location:Québec, Canada
  • Project:an assembler
  • Wiki edits:6
QUOTE (Hayate @ Dec 14 2010, 02:22 AM)
Use tabs. Just... use tabs. For the reason already stated in the thread - anyone reading the code will see it with their preference of tab width.

That only works for tabs at the beginning of a line. When tabs are used in the middle of a line, that's where it screws up (like in the disassemblies we have, some people use an editor configured for 4-space-wide tabs and they start putting 2 tabs after short mnemonics like jsr, not knowing they should be using 8-space-wide tabs).

The only way to solve code style issues is to use a programming "language" that isn't plain text, but encoded in binary or something (an abstract syntax tree, what). An editor could show the code in whatever style you like, but that information wouldn't be part of the code itself. The downside of this is that a custom editor would be required to edit the code, you can't just use any text editor out there.

#116 User is offline Yuzoboy 

Posted 15 December 2010 - 09:32 AM

  • Posts: 107
  • Joined: 09-December 10
  • Gender:Male
  • Location:UK
QUOTE (AamirM @ Dec 14 2010, 10:13 PM)
What has indentation has to do with "technical" interview? It's a matter of preference and style (unless you were given some standard/guidelines to adhere to). It's like a bunch of these senior developers (aka fags) would mark you down if you liked Coke instead of Pepsi. I want to punch these sort of interviewers.

Absolutely nothing is the answer. But it goes to show how far some people wil go to get the perfect candidate. Its understandable if indentation and bracket use was inconsistent but it was just because their team didnt like the style I was using as it meant they would have to "change the way they read code".

#117 User is offline Overlord 

Posted 15 December 2010 - 06:40 PM

  • Cat-herder
  • Posts: 14494
  • Joined: 12-January 03
  • Gender:Male
  • Location:Berkshire, England
  • Project:VGDB
  • Wiki edits:3,204
QUOTE (MainMemory @ Dec 13 2010, 03:51 PM)
To me, VB looks kind of like ASM, only more confusing.

That's not VB, that's old-style BASIC being forced though VB5. =P VB5/6 native code is more like:

CODE
Private Sub sonic_write_Click()
Open RomPath For Binary As #1
For Counter = sonic.LBound To sonic.UBound
     With sonic(Counter)
         If Len(.Text) < .MaxLength Then .Text = .Text & String(.MaxLength - Len(.Text), 32) '32 is the character code for space
         WriteString 1, .Tag, .Text
     End With
Next Counter
Close #1
MsgBox "Writing complete!", vbInformation, "Sonic Text Editor"
End Sub


=P

#118 User is offline Glaber 

Posted 16 December 2010 - 12:40 AM

  • Has Beaten Sonic Genesis for GBA
  • Posts: 597
  • Joined: 14-January 03
  • Gender:Male
  • Location:Mobius
  • Project:Gmod Ragdolls and Props, Pony maps
  • Wiki edits:10
Click programming.

and Java. (only one I learned in School that I didn't get all frustrated over)

  • 8 Pages +
  • ◄ First
  • 6
  • 7
  • 8
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users