User avatar
BluDragon
Posts: 83
Joined: Thu Sep 05, 2013 7:32 am
Location: 127.0.0.1

when to use lower-case or upper-case & code practice

Mon Nov 04, 2013 5:35 am

i don't know where to start, so i will dive into it.

when i write informally i don't capitalize the first letter of my sentences. i find that it's easier to read that way. i don't capitalize "i" either. i find that some capitalization isn't necessary. however, if i were to write "Off topic discussion", then i would write it, "Off Topic Discussion" or "off topic discussion". having just one capital looks weird.

when i learned html, i was taught to use all caps. this didn't look very good, so i just use all lower-case letters as tags are case insensitive. soon after, i noticed that people stopped using upper-case for tags.

the traditional way to write a "const" or "#define" is to use upper-case letters. i've been coding long enough that i know what to name constants so that they stand out from local (or block) variables, so i just use lower-case letters.

i don't use something like,

Code: Select all

if(statement) {
   code;
}
i use;

Code: Select all

if(statement)
{
   code;
}
i don't use tabs. i use spaces instead. the text editor that i was using made that very easy. when i make a large bash script, then i will use tabs instead, but that is the only exception.

when someone wants to use spaces to indent a paragraph on a website, they should be able to. " " represents a space. in html, if you place two spaces, you will only see one. if you use " " twice, then you will see two spaces rather than one. the easiest way to update a website with this functionality would be to intercept whatever is responsible for saving this text to a database, then search for spaces and replace them with " ". if you say, well i don't want the code to be littered with " ", then search for two spaces. for every match replace the space after the first one with " ".

javascript is slightly old, but reliable; however, it lacks some functionality. as far as i know you can't add or remove a cookie without making your own script. if every new browser decided to update the cookie method, then older browsers would still need a custom script.... hm.

i have other annoyances with text/code and peculiar syntax styles, but i'm not going to write about all of them right now.
"Whenever a separation is made between liberty and justice, neither, in my opinion, is safe." - Edmund Burke
"Men make counterfeit money; in many more cases, money makes counterfeit men." - Sydney J. Harris

mikerr
Posts: 2805
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: when to use lower-case or upper-case & code practice

Mon Nov 04, 2013 8:29 am

Not capitalizing the personal pronoun 'I' is not a question of writing style, it's just incorrect !

Grammar and spelling mistakes make posts harder to read, looks lazy (at best) and can change the meaning of what you meant to write.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: when to use lower-case or upper-case & code practice

Mon Nov 04, 2013 9:08 am

... As is the refusal to start sentences with capital letters.

The rules for titles, IIRC, are that every word with four or more letters is capitalised, plus "A" and "The".

But of course you don't have to follow the rules. ee cummings never did.

As for code, so long as it is accepted by the compiler and you're not in a team that expect you to follow a certain style, you're free to do what you like.

I personally disagree with your spaces/tabs position, but you are in good company. See the trouncing I got here: http://forums.theregister.co.uk/forum/1 ... ing_style/ (about the 9th post down.)

neilf
Posts: 72
Joined: Sun Nov 11, 2012 8:14 am

Re: when to use lower-case or upper-case & code practice

Mon Nov 04, 2013 9:34 am

rurwin wrote:... As is the refusal to start sentences with capital letters.

The rules for titles, IIRC, are that every word with four or more letters is capitalised, plus "A" and "The".
Only in the US. And even then I doubt it's a 'grammar' rule - just a common convention.

The UK, Europe and a large part of the rest of the world don't use intercapping - it's a pointless news media affectation that makes sentences harder to read and often difficult to understand without a second reading. Intercapping is occasionally used in the UK when a company specifically wants to adopt an 'American' or 'Mid-Atlantic' look (cf. Sky News).

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25043
Joined: Sat Jul 30, 2011 7:41 pm

Re: when to use lower-case or upper-case & code practice

Mon Nov 04, 2013 9:40 am

BluDragon wrote:
when i write informally i don't capitalize the first letter of my sentences. i find that it's easier to read that way.
But not for other people for whom it is worse.
BluDragon wrote:
i don't use something like,

Code: Select all

if(statement) {
   code;
}
i use;

Code: Select all

if(statement)
{
   code;
}
i don't use tabs. i use spaces instead. the text editor that i was using made that very easy. when i make a large bash script, then i will use tabs instead, but that is the only exception.
Agreed. The 1TBS method of braces is an unreadable abortion. As is using tabs instead of spaces (The Linux kernel is horrible code to read).
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: when to use lower-case or upper-case & code practice

Mon Nov 04, 2013 9:48 am

BluDragon wrote:the traditional way to write a "const" or "#define" is to use upper-case letters. i've been coding long enough that i know what to name constants so that they stand out from local (or block) variables, so i just use lower-case letters.

i don't use something like,

Code: Select all

if(statement) {
   code;
}
i use;

Code: Select all

if(statement)
{
   code;
}
blocking code like that or as I personally prefer braces '{' '}' indented as well (just preference, makes it so much easier to see quickly where blocks start and end seen too much ubfuscated C and Javascript in particular, that drives me nuts. There is even Obfucated C competitions...
i don't use tabs. i use spaces instead. the text editor that i was using made that very easy. when i make a large bash script, then i will use tabs instead, but that is the only exception.
I personally always use spaces as tabs are NOT always the same on every system/editor/etc and I prefer block alignments to match fixed part of statement starting block (e.g. 2 spaces if, 3 spaces for, etc)
when someone wants to use spaces to indent a paragraph on a website, they should be able to. " " represents a space. in html, if you place two spaces, you will only see one. if you use " " twice, then you will see two spaces rather than one. the easiest way to update a website with this functionality would be to intercept whatever is responsible for saving this text to a database, then search for spaces and replace them with " ". if you say, well i don't want the code to be littered with " ", then search for two spaces. for every match replace the space after the first one with " ".
Personally if I need that styling in HTML since early versions of CSS it has been possible to define hanging indents by 'p:first' styles to have extra or less margin. Simpler let the browser sort it out, but set indent in 'ems' NOT pixels like most idiots do (one of my particular rants about web pages the amount of pixel defined things that cause problems even for font size) Seehttp://www.pcserviceselectronics.co.uk/ ... tyling.php
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: when to use lower-case or upper-case & code practice

Mon Nov 04, 2013 10:33 am

neilf wrote:The UK, Europe and a large part of the rest of the world don't use intercapping - it's a pointless news media affectation that makes sentences harder to read and often difficult to understand without a second reading. Intercapping is occasionally used in the UK when a company specifically wants to adopt an 'American' or 'Mid-Atlantic' look (cf. Sky News).
Really?
Image

mikerr
Posts: 2805
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: when to use lower-case or upper-case & code practice

Mon Nov 04, 2013 11:41 am

BluDragon wrote: I don't use something like,

Code: Select all

if(statement) {
   code;
}
I use;

Code: Select all

if(statement)
{
   code;
}
I'd go further and say indenting the braces is better, especially with nested blocks:

Code: Select all

if(statement)
   {
   code;
   }
Aligning the braces by column makes things easier to check visually.

Python takes that too far though with its total reliance on indents for blocks instead of braces:
e.g.

Code: Select all

if (statement)
    code;

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25043
Joined: Sat Jul 30, 2011 7:41 pm

Re: when to use lower-case or upper-case & code practice

Mon Nov 04, 2013 11:50 am

mikerr wrote:
BluDragon wrote: I don't use something like,

Code: Select all

if(statement) {
   code;
}
I use;

Code: Select all

if(statement)
{
   code;
}
I'd go further and say indenting the braces is better, especially with nested blocks:

Code: Select all

if(statement)
   {
   code;
   }
Aligning the braces by column makes things easier to check visually.

NNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!

(IMHO, YMMV, RIP, ASIC, BANANA etc)
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

hldswrth
Posts: 108
Joined: Mon Sep 10, 2012 4:14 pm

Re: when to use lower-case or upper-case & code practice

Thu Nov 14, 2013 12:15 pm

I tend to use camel case as that's predominantly used in Java development, however it results in some poor choices, in particular where a name includes an abbreviation. Would you use "initUSBHub" or "initUsbHub"?. The latter looks unnatural but the former also does not look great. In snake case would that be "init_USB_hub" or "init_usb_hub"?

On braces, I tend to go with the structure of the language itself. Braces are syntactically part of the block, not the if statement, so to my mind should be aligned with the block. For the same reason I don't put a space between the if and its starting bracket - the bracket is syntactically part of the if statement not the condition being evaluated.

Code: Select all

if( condition )
  {
  do something;
  }
else
  {
  something else;
  }

achrn
Posts: 382
Joined: Wed Feb 13, 2013 1:22 pm

Re: when to use lower-case or upper-case & code practice

Thu Nov 14, 2013 12:36 pm

mikerr wrote: Python takes that too far though with its total reliance on indents for blocks instead of braces:
e.g.

Code: Select all

if (statement)
    code;

Code: Select all

if (statement):
    code
I perpetually dither over python. It still bothers me that there's no semi-colons on the line ends, but I've reached the point where I admit I don't know why it bothers me. I like code with an explicit statement end indicator - it's just 'right'. I generally think that things that rely on particular whitespace to have precise meaning are liable to be prone to annoying difficult to find errors (configuration files that require a <tab> rather than a few spaces, for example).

So I don't like how python does it, and I still often get caught out by not indenting my code as strictly as python demands, and it's obviously wrong and an abomination and against all teh laws of nature, but I must admit I picked up python faster than almost any other language, and my coding is functional faster than in almost anything else (but I still love Perl above all else).

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: when to use lower-case or upper-case & code practice

Thu Nov 14, 2013 2:51 pm

hldswrth wrote:I tend to use camel case as that's predominantly used in Java development, however it results in some poor choices, in particular where a name includes an abbreviation. Would you use "initUSBHub" or "initUsbHub"?. The latter looks unnatural but the former also does not look great. In snake case would that be "init_USB_hub" or "init_usb_hub"?

On braces, I tend to go with the structure of the language itself. Braces are syntactically part of the block, not the if statement, so to my mind should be aligned with the block. For the same reason I don't put a space between the if and its starting bracket - the bracket is syntactically part of the if statement not the condition being evaluated.

Code: Select all

if( condition )
  {
  do something;
  }
else
  {
  something else;
  }
You seem to be forgetting that a block is defined as a statement, so you would put the block at the level of the higher statements if following the language, and its contents indented:

Code: Select all

#define ULONG unsigned long
void ExampleFunction(x,y)
ULONG x,y;
{
  ULONG lx,ly;
  for (ly = 0; ly <= y; ++ly)
  {
    for (lx = 0; lx <= x; ++lx)
    {
      /* Do something with ly and lx */
   }
  }
  return;
}
As to the use of K&R style function definitions this is just a persanal preference, because it makes it much easier to read (especialy with functions taking more than 3 args). Also I have always prefered the /**/ comments because they stand out better than the // style.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

jardino
Posts: 130
Joined: Wed Aug 08, 2012 9:03 am
Location: Aberdeenshire, Scotland

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 10:24 am

When I see a message without proper capitalisation at sentence beginnings, at the personal pronoun and where convention dictates (BBC, GMT and so on) then I assume that the poster is illiterate or lazy. If laziness is the cause, then why should I expend any effort on reading the post? On this occasion, I forced myself to read, twice, the OP's paragraph beginning "when someone" and still find it incomprehensible.

Should I deduce or discover that the poster's first language is not English, then of course I make extra effort since I myself am not polyglot.

And dont get me st'arted on the a'pos'trophe!

Alan.
IT Background: Honeywell H2000 ... CA Naked Mini ... Sinclair QL ... WinTel ... Linux ... Raspberry Pi.

User avatar
BluDragon
Posts: 83
Joined: Thu Sep 05, 2013 7:32 am
Location: 127.0.0.1

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 1:26 pm

jardino wrote:When I see a message without proper capitalisation at sentence beginnings, at the personal pronoun and where convention dictates (BBC, GMT and so on) then I assume that the poster is illiterate or lazy. If laziness is the cause, then why should I expend any effort on reading the post? On this occasion, I forced myself to read, twice, the OP's paragraph beginning "when someone" and still find it incomprehensible.

Should I deduce or discover that the poster's first language is not English, then of course I make extra effort since I myself am not polyglot.

And dont get me st'arted on the a'pos'trophe!

Alan.
if i'm typing something formally, then i will use capitalization appropriately. if you assume i'm lazy, then you're mistaken. as i stated; i like the way it looks. (i know you weren't saying that you think i'm lazy) i think those that think i'm lazy for typing the way i do are lazy themselves. typing the way i do forces one to read my sentences rather than skipping through parts as you could do if i capitalized my sentences. that's not all; it also forces you to look for a period thus giving you at least +1 sight experience for every 10 paragraphs you read. :lol:

it wouldn't be hard to make a program that capitalized everything for me. i would make a program like this, because i like the style of the way i type. i would use the program to make a copy of the file i was writing, so other people aren't bothered by my "strange" style.

Typing with capitals just looks weird to me. Every paragraph that is capitalized correctly could be thought of as being colored. Each sentence that is capitalized could be represented by the color blue. The first color is a bright blue that's easy to read. The next sentence is darker and the next is darker than the one before. Before it becomes difficult to read, the brightest color blue that's easy to read is set to the next sentence, then the pattern repeats. The sentences I write are all one color. Each shade of color is unnecessary, because the sentences in the paragraph all relate to each other, so I think every paragraph should be one color instead of multiple shades of the color that it could represent. (I wrote this last paragraph for you, so it wouldn't be difficult for you to read)

I think apostrophes are necessary; however, capitalization may make it easier to skip through sentences, but isn't actually required. I do like capitalizing abbreviations and most pronouns. Like, RPi for Raspberry Pi. The word "it's" and "its" don't mean the same thing, so I use apostrophes.

Overall, I think if the subject and content is worthy, then it should be read with or without proper capitalization. I think I type the way I normally do, because I've read so much code that doesn't use a capital letter for variables and function names that I just adopted that style when I type or write. I have typed this way for at least a year. I usually don't notice when someone uses proper capitalization unless I think about it.
"Whenever a separation is made between liberty and justice, neither, in my opinion, is safe." - Edmund Burke
"Men make counterfeit money; in many more cases, money makes counterfeit men." - Sydney J. Harris

User avatar
BluDragon
Posts: 83
Joined: Thu Sep 05, 2013 7:32 am
Location: 127.0.0.1

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 1:44 pm

rurwin wrote:But of course you don't have to follow the rules. ee cummings never did.
he sounds like my kind of hero.
rurwin wrote:I personally disagree with your spaces/tabs position, but you are in good company. See the trouncing I got here: http://forums.theregister.co.uk/forum/1 ... ing_style/ (about the 9th post down.)
I think you're right. It's generally better to use tabs if you're going to work with a group or you plan to release the source code and want to make it easier for people. I use "gedit", so I can change what the width of the tabs are.
jamesh wrote:(The Linux kernel is horrible code to read).
i am not looking forward to reading the code for it if that's the case. -_-
mikerr wrote:I'd go further and say indenting the braces is better, especially with nested blocks:

Code: Select all

if(statement)
   {
   code;
   }
hldswrth wrote:

Code: Select all

if( condition )
  {
  do something;
  }
else
  {
  something else;
  }
Image
hldswrth wrote:I tend to use camel case as that's predominantly used in Java development...
sometimes i will use mixedCase for functions if it looks better than mixed_case.
DavidS wrote:Also I have always prefered the /**/ comments because they stand out better than the // style.
if you have syntax highlighting, then "//" style of commenting isn't difficult to read.
"Whenever a separation is made between liberty and justice, neither, in my opinion, is safe." - Edmund Burke
"Men make counterfeit money; in many more cases, money makes counterfeit men." - Sydney J. Harris

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25043
Joined: Sat Jul 30, 2011 7:41 pm

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 2:30 pm

BluDragon wrote:if i'm typing something formally, then i will use capitalization appropriately. if you assume i'm lazy, then you're mistaken. as i stated; i like the way it looks. (i know you weren't saying that you think i'm lazy) i think those that think i'm lazy for typing the way i do are lazy themselves. typing the way i do forces one to read my sentences rather than skipping through parts as you could do if i capitalized my sentences. that's not all; it also forces you to look for a period thus giving you at least +1 sight experience for every 10 paragraphs you read. :lol:
This paragraph I had to read twice. The i's simply disappear and make it very difficult to read, I don't spot sentence breaks so easily either. And of course the constant insertion of squiggly red underlines by the grammer/spelling checking is annoying. I don't think you are lazy, I think you are wrong. See below.
BluDragon wrote: it wouldn't be hard to make a program that capitalized everything for me. i would make a program like this, because i like the style of the way i type. i would use the program to make a copy of the file i was writing, so other people aren't bothered by my "strange" style.
Please do so. Incorrect capitalisation makes me not read the post. Note, that your aim in writing this stuff down is NOT for you to read, but for other people. Since 'other people' prefer capitisation (since that is the correct method to use), you should use that when posting public messages. In your own time, and for your own consumption, do what you like,
BluDragon wrote: Typing with capitals just looks weird to me. Every paragraph that is capitalized correctly could be thought of as being colored. Each sentence that is capitalized could be represented by the color blue. The first color is a bright blue that's easy to read. The next sentence is darker and the next is darker than the one before. Before it becomes difficult to read, the brightest color blue that's easy to read is set to the next sentence, then the pattern repeats. The sentences I write are all one color. Each shade of color is unnecessary, because the sentences in the paragraph all relate to each other, so I think every paragraph should be one color instead of multiple shades of the color that it could represent. (I wrote this last paragraph for you, so it wouldn't be difficult for you to read)
That paragraph read easily. Correct grammar and correct capitisation. Please use this scheme in future.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

achrn
Posts: 382
Joined: Wed Feb 13, 2013 1:22 pm

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 2:55 pm

BluDragon wrote: typing the way i do forces one to read my sentences rather than skipping through parts as you could do if i capitalized my sentences.
No. It forces anyone reading your output to invest more effort than they need to if they want to find out what you are trying to communicate. It doesn't stop me skipping through your magnificent pearls of wisdom, it stops me making any attempt to read them.

You might think you are some deity's gift to the planet and everyone will naturally feel blessed to be forced to work harder than necessary to read your words of wisdom. I stop reading even before the end of the first paragraph. If it's your goal to avoid having anyone read as far as the end of the first paragraph, congratulations. Otherwise...

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 3:15 pm

if you have syntax highlighting, then "//" style of commenting isn't difficult to read.
Still easier to read the /**/ than the // even with Syntax highlighting.
Window.gif
Window.gif (3.45 KiB) Viewed 4937 times
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25043
Joined: Sat Jul 30, 2011 7:41 pm

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 3:16 pm

Same readability (IMPO) if you put a space after the // like you did after the /*
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 4:47 pm

I guess it realy does not matter as I can not use them any way in assembly :)

It is all ; for me. A couple of shots from a file that I happen to have open at the moment (do to what I am working on):
content0.gif
content0.gif (9.52 KiB) Viewed 4886 times
content1.gif
content1.gif (5.51 KiB) Viewed 4880 times
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Burngate
Posts: 6196
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 6:14 pm

There appears to be two separate threads in this topic - one concerned with writing code, which as much as anything is related to what the language requires, and the other to do with comunication between allegedly intelligent homo-sapients.

I'm going to leave the first to others of greater knowledge and experience, but the second is of some importance to me, at least.

Assuming a poster comes here to request or supply information because it might help someone (all be it only himself) rather than just fill the forum with random noise, the purpose behind the writing is to transmit information.
Writer has Information in mind, and wants to communicate the Information to Reader.
Without direct brain-to-brain telepathy, some sort of channel is required, ansd that means channel-coding.

If the writer refuses to use the standard channel-coding - punctuation, capitalisation, spelling, grammar - then he implicitly demands that the reader either transcodes the information to standard channel-code, or adopt the writer's non-standard channel-code.
Either requires the reader to do extra work. If transcoding loses information, the communication fails. If he refuses, the communication fails.
Whatever, the writer has wasted his time and energy. The reader loses nothing.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 8:00 pm

This debate is rather frivolous, I don't think people really care whether you use upper or lower case lettering what's more important is good coding and comments where it's needed.

99.9% of the time I use lower case letters mainly because I couldn't be bothered to press and hold the shift key, IT ALSO LOOKS NICER THAN TYPING IN UPPER CASE. :D

Richard S.

User avatar
DougieLawson
Posts: 37129
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: when to use lower-case or upper-case & code practice

Fri Nov 15, 2013 8:30 pm

redhawk wrote:This debate is rather frivolous, I don't think people really care whether you use upper or lower case lettering what's more important is good coding and comments where it's needed.

99.9% of the time I use lower case letters mainly because I couldn't be bothered to press and hold the shift key, IT ALSO LOOKS NICER THAN TYPING IN UPPER CASE. :D

Richard S.
More important is to be consistent in the code you write. Six months from now you may want to fix a bug in your code. Six months from now you're going to look at YOUR code and think "What <insert expletive here> moron wrote that crap".

Write general purpose code. If you're developing a routine to use the RPi GPIO pins or SPI or I2C write something that you can reuse for your next project. Write something that will still make sense in six months time. Controlling a fish tank isn't that different from controlling the garden pond. I can't stress the benefits of code reuse.

I've got libraries of code (COBOL, PL/I, S/370 assembler) that is anything from a couple of days old to thirty years old. It doesn't half make it easier when you can pick up something that's written and debugged and hack it. Rather than writing from scratch. I've even got some skeleton programs that have the basic scaffolding, they just need the meat to make a useful program (because writing prolog and epilog code is tedious).

With a library of code the comments become important (... ho hum ... :oops: ) to write meaningful comments, if the code changes change then change the comments. Don't comment the bloody obvious code (SR R5,R5 clear register five - it's inane and pointless I can tell that clears R5). If I see that remember I'm armed with a Louisville Slugger and I WILL find you.

Write the comments on the obscure things, on that strange code you've written to solve a special problem (because when the parameters change you'll need to change that code). Think of who might read, use, reuse your code write comments for the maintainer.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
BluDragon
Posts: 83
Joined: Thu Sep 05, 2013 7:32 am
Location: 127.0.0.1

Re: when to use lower-case or upper-case & code practice

Sat Nov 16, 2013 10:04 am

achrn wrote:If it's your goal to avoid having anyone read as far as the end of the first paragraph, congratulations.
Burngate wrote:Whatever, the writer has wasted his time and energy. The reader loses nothing.
I don't want to sound sarcastic, but it might. It is my intention to weed out those that aren't determined to read what I have to write. (except right now)
DougieLawson wrote:Don't comment the bloody obvious code (SR R5,R5 clear register five - it's inane and pointless I can tell that clears R5). If I see that remember I'm armed with a Louisville Slugger and I WILL find you.
:lol: i agree. commenting should refer to methods that aren't obvious.
DavidS wrote:It is all ; for me.
then why do you use "/**/" instead of "//"?
jamesh wrote:Same readability (IMPO) if you put a space after the // like you did after the /*
i agree. using "//<word>" is more difficult to read than "// <word>".
jamesh wrote:That paragraph read easily. Correct grammar and correct capitisation. Please use this scheme in future.
yeah, okay. I will try to remember to type correctly on the forums.
"Whenever a separation is made between liberty and justice, neither, in my opinion, is safe." - Edmund Burke
"Men make counterfeit money; in many more cases, money makes counterfeit men." - Sydney J. Harris

User avatar
Burngate
Posts: 6196
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: when to use lower-case or upper-case & code practice

Sat Nov 16, 2013 10:49 am

BluDragon wrote:
Burngate wrote:Whatever, the writer has wasted his time and energy. The reader loses nothing.
I don't want to sound sarcastic, but it might. It is my intention to weed out those that aren't determined to read what I have to write. (except right now)
It doesn't sound sarcastic, just arrogant.

You're an ordinary guy; I'm an ordinary guy. So are most people.
What you write is important to you; less so to me. Also to most people.
If I write something that doesn't help, you can ignore it. But if you make it difficult for me to read what you write, so I don't bother to respond, you'll never know if I could have helped.

So why limit the help you get to that from people who hang on your every word, as if you're the Oracle at Delphi?

The same goes for comments in your code.
The guy who reads them is you, six months down the road. He's forgotten everything you know, so help him out: give him a chance to learn from you.
If you make it difficult for him, he''ll think you're an arrogant twat, and ignore you.

Return to “Off topic discussion”