Latest Uploads
Extraterre ... .0.1 (zip)

dantheman363

Monty Teas ... Screenie 1

steve_ancell

Santa Clau ... ed his bag

waroffice

manic_platdude.png

spinal

Tetris Clone

steve_ancell

Super blues bros.

spinal

Forum Home

Discuss :How to code Properly

UserMessage
Posted : Friday, 15 June 2007, 15:09 | Permalink | Mark Here
Jayenkai


WW Entries : 103
I've been meaning to post this for a couple of days, but haven't gotten round to it.
Tonight, though, I'm bored out of my brain, and really can't be bothered coding, so figured I might as well take the time to post it.

What caused me to post this topic is what happened here.

DiablosDevil You should NOT capitalize a non-constant.

Jayenkai I prefer to symbolise which is which using a more specific manner, like placing "C_" before the variable name.

Hotshot it is very old code!



What happened there, is this.
1) Someone posted something.
2) The first ever comment that user has received on this forum was "No, you should code like this"
3) The second comment was yet another method to code.
4) The original poster makes up an excuse as to why it looks a bit tacky.

At first I thought nothing of it, but then throughout the day it started nagging away at me. I have somewhat of a terribly guilty conscience..

I've coded for years, but only got online when I was 19. I found the internet a daunting place, but I managed to survive. I made little Sielts and built up a Pulp site.
When I finally found Blitz, and dumped DarkBasic which kept resizing my desktop and moving all my icons, I joined up at BB.com.
I got told off for my style of coding.. So I gave up and headed to BC instead.


When I was building up this site, I popped on over to a php site and asked a question regarding the BBCode's "Code" boxes (which you'll probably remember took AGES to get right!)
The code I showed wasn't real code, it was pseudo code, suggesting the method I was using/hoping for, and asking how I could achieve it.
The only reply..
"If this is your code, I am sure it doesn't work!"



I'm worried that we might be getting like that, so I'd like to bring the whole issue to everyone's attention, and have everyone discuss it openly.

-----
Posted : Friday, 15 June 2007, 15:31 | Permalink | Mark Here
spinal


Reminds me of when I was trying to get the DS Rumble Pak to work....

I posted the following...

I'm using it as
-->
always false


Then I got the reply...


This is not going to get you anywhere...

you need some function in the 'if' and 'else' so if there is one inserted...

-->


-----

3DS - 1762-2660-3218
Posted : Friday, 15 June 2007, 15:55 | Permalink | Mark Here
HoboBen


WW Entries : 9
Sorry (lost!), what are we discussing? How to code or how not to argue about how to code?

-----
github
Posted : Friday, 15 June 2007, 17:12 | Permalink | Mark Here
caffeinekid


WW Entries : 4
Jay, that's not how you tell people how to not tell people how to do something.

My philosophy is thus:-

If code works and does what you want then it's right, if it doesn't do what you want it to then it's wrong - anything else is just fluff.

-----
www.tcksoft.co.uk
www.retroremakes.com
Posted : Friday, 15 June 2007, 17:25 | Permalink | Mark Here
Jayenkai


WW Entries : 103
I PM'd Diablo the other day to ask if it was OK to post this, worried that he might think I'm getting a dig in..
It's not a dig at Diablo, and I hope he understands that, it's just that... Sometimes we have to take a step back and realise that we were all there once.

And like you said, if code works, then that's good enough, right!

-----
Posted : Friday, 15 June 2007, 17:41 | Permalink | Mark Here
caffeinekid


WW Entries : 4
Now indenting... That's another thing entirely.

-----
www.tcksoft.co.uk
www.retroremakes.com
Posted : Friday, 15 June 2007, 19:10 | Permalink | Mark Here
magicman


WW Entries : 35
Im with caffeinekid, If the code works who cares how crummy it looks!

-----
My Site
Posted : Saturday, 16 June 2007, 01:28 | Permalink | Mark Here
power mousey


I don't sweat it.
I code and learn and relearn how to code
and with some good indentation and basic rules.
I learn as I go...so I and maybe others can read or use it.
You never know...2 weeks from now you may not
know what you did or have trouble retracing your
steps. And this is important,. Like, in a programming job of some kind. Comments, docummentation and boiler plates too.
Posted : Saturday, 16 June 2007, 06:44 | Permalink | Mark Here
JL235


WW Entries : 7
I'm not trying to have a go at anyone's code. In the same way people may suggest improvements in the performance, functionality or structure of a persons code, I'm just suggesting improvements in people's style of coding. Improvements which in the long run can help.

I don't mean anything bad or negative about people's code, but if I see room for improvement I'll suggest it. I agree though that just putting down people's code is wrong.

There is nothing wrong with pseudo code, and I think we should discuss more solutions to coding problems more in writing rather then code. But you should also never be sloppy when writing actual code, even if it's only small and is never going to be used.

-----
PlayMyCode.com - build and play in your browser, Blog, Twitter.
Posted : Saturday, 16 June 2007, 07:35 | Permalink | Mark Here
caffeinekid


WW Entries : 4
BTW I was serious about the indenting. I don't know how I coped on the Spectrum with line-numbers and no formatting anymore.

If code isn't indented to show the structure then I literally cannot read it. I have trouble reading my own code at the best of times so I have to make it as easy on the eyes as possible, usually anyway.

-----
www.tcksoft.co.uk
www.retroremakes.com
Posted : Saturday, 16 June 2007, 08:18 | Permalink | Mark Here
power mousey



awwwwww caffeinekid, I agree with you.
That is true.

and DiablosDevil, its cool too.
Yet, I would like some people...whether friends
and others...to get on my case for coding.
In other words, I like feedback and criticism
whether negative, positive, constructive, and
otherwise.
tell me and show me how to make the code and also the program better or even how you would do it.
Believe me, I can take it.
I just don't sweat it.


cheers
power mousey
Posted : Saturday, 16 June 2007, 18:52 | Permalink | Mark Here
Scherererer


I think that its important to have some standards for style, and that we should do our best to make our code look, if nothing else, clean and readable. I'm not saying we should all have code where constants are all caps and functions start with such and such a case; I just mean that we should have variable and function names that make sense, and indentation and spacing that is practical and readable.

I'm not going to call anyone on coding style, and I don't think that's what Diablo was aiming for, but I think we should all try to have good style. I used to just kinda code as long as it worked, but as I grew as a coder I improved my style and cleanliness and I really did notice a difference. Not only does it reduce the difficulty of reading for others, but it does for yourself too. I remember opening up some of my earlier games and going "wtf was i thinking, i don't know what's going on here".

Good luck and good coding to all!

-----
YouTube Twitter
Computer Science Series: Logic (pt1) (part 2) (part 3) 2's Complement Mathematics: Basic Differential Calculus
Posted : Sunday, 17 June 2007, 06:30 | Permalink | Mark Here
Teasy


*LoL*!
For me it was the other way around.
I used to find style more important than getting it working.
Now I'm trying to get it working no matter what style
For example using a quick and dirty style on small projects and a little more elaborate style on larger projects, but only if it's absolutely necessary.
It sure as heck increases my productivity!
Latest Posts
Dev Costs
Jayenkai Mon 14:20
Screen Burn of the Mind
steve_ancell Mon 11:38
RoadRash!
Mog Mon 10:56
Progress / Location Bars
Afr0 Mon 10:28
Noel's Graduation
rockford Mon 07:37
Development via GUI
waroffice Mon 02:48
Audio Rant
steve_ancell Sat 19:16
Wrong Partition!!!!?
spinal Sat 11:24
eBay Lies
spinal Fri 23:44
Shoutbox Topic - 968
dna Fri 19:42
More

Latest Items
News : Newsletter #176
Jayenkai Sat 04:49
News : Newsletter #175
Dabz Tue 09:38
Blog : Snow: More Material Junk
Cower Sat 23:17
Dev-Diary : Mutant Monty: Amstrad CPC to Windows conversion
rockford Fri 13:14
Techy : AppleTV
Jayenkai Thu 09:40
Blog : Graphviz
steve_ancell Sat 14:17
Pets : Top-Down Shadow Hack
Jayenkai Tue 05:52
Snippet : JNKrunch v1.0
Jayenkai Sat 07:20
News : Newsletter #173
waroffice Fri 04:47
Blog : Material Loading
Cower Fri 02:08
Pets : I Done Won A Thing
shroom_monk Sun 11:31
Pets : Repurposing A Lexer
Cower Mon 22:06
Bah : Feeling a Little Angry
spinal Mon 11:26
News : Newsletter #170
Dabz Sat 00:34
Showcase : sbfgen
Cower Sat 16:57
More

Who's Online
Jayenkai
Mon, at 14:22
dna
Mon, at 14:20
steve_ancell
Mon, at 14:11
CodersRule
Mon, at 13:58
shroom_monk
Mon, at 13:43
Mog
Mon, at 13:25
spinal
Mon, at 12:54
rockford
Mon, at 12:28
HoboBen
Mon, at 12:13
Dabz
Mon, at 10:31
Link to this page
Site : Jayenkai 2006-Infinity |
MudChat's origins, BBCode's former life, Image Scaler.