Author Topic: How do you type your brackets?  (Read 9478 times)

0 Members and 1 Guest are viewing this topic.

Offline fubar.grTopic starter

  • Supporter
  • ****
  • Posts: 369
  • Country: gr
    • Fubar.gr
How do you type your brackets?
« on: June 19, 2015, 09:13:37 pm »
I have this weird habit and wonder if I am just a weirdo or it is more common than I thought

When I want to put something in brackets (or parentheses or quote marks) instead of typing opening bracket, text, closing bracket, in that order, I will type both opening and closing brackets at once, like that [], then I will go back inside and type the text.

My wife saw me once doing that and found it extremely weird.

I think I picked that habit back when I was learning to program and it stuck.

So how do you guys type your brackets?

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3921
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: How do you type your brackets?
« Reply #1 on: June 19, 2015, 09:15:30 pm »
The same way.
 

Offline Stupid Beard

  • Regular Contributor
  • *
  • Posts: 221
  • Country: gb
Re: How do you type your brackets?
« Reply #2 on: June 19, 2015, 09:43:46 pm »
There's another way to type brackets?

I think you'll find that anyone who's had more than a passing acquaintance with code will do the same. It's just one of those zero effort defensive things that helps to prevent mistakes and save you time.

People who only write in "spoken languages will forget closing quotes (and sometimes brackets, which will drive a programmer absolutely mad when they read it.

(Sorry)
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: How do you type your brackets?
« Reply #3 on: June 19, 2015, 09:50:41 pm »
I think you'll find that anyone who's had more than a passing acquaintance with code will do the same. It's just one of those zero effort defensive things that helps to prevent mistakes and save you time.

Nah, I've written piles and piles of code and still type linearly. I've mostly preferred editors that can highlight pairs of brackets - that might have something to do with it.
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline kolonelkadat

  • Regular Contributor
  • *
  • Posts: 202
  • Country: us
  • Obviously, windows are central to Windows.
    • Force Project X
Re: How do you type your brackets?
« Reply #4 on: June 19, 2015, 09:55:41 pm »
it depends on whether or not I have to type anything to the right of the closing character. If I have to type on the right, then it takes WAY too much effort to hit the left arrow and then go back and hit the right arrow when im done.

so basically, I only type opening and closing curly braces together and even then its mostly only because most IDEs automatically do it for me.
 

Offline kingofkya

  • Regular Contributor
  • *
  • Posts: 143
  • Country: us
Re: How do you type your brackets?
« Reply #5 on: June 19, 2015, 09:57:59 pm »
Yep your not alone at all.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: How do you type your brackets?
« Reply #6 on: June 19, 2015, 09:58:26 pm »
Many IDEs type the closing bracket for you anyway.

Very, very few things bother me more than this, and I'm including war, disease, poverty, starvation, etc etc...
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: How do you type your brackets?
« Reply #7 on: June 20, 2015, 05:03:44 am »
Sometimes, when I'm not really thinking about it, I don't use parenthesis and use commas instead.
 

Offline jadew

  • Frequent Contributor
  • **
  • Posts: 472
  • Country: ro
Re: How do you type your brackets?
« Reply #8 on: June 20, 2015, 05:40:28 am »
I never type them both when I'm writing text. If it's code or a formula, yeah.
 

Offline RickBrant

  • Supporter
  • ****
  • Posts: 105
  • Country: us
Re: How do you type your brackets?
« Reply #9 on: June 20, 2015, 06:29:20 pm »
Not only does it help you avoid missing brackets, it's also more efficient use of the shift key.
"banging meter needles into stop pins since 1965"
 

Offline DJohn

  • Regular Contributor
  • *
  • Posts: 103
  • Country: gb
Re: How do you type your brackets?
« Reply #10 on: June 20, 2015, 07:15:01 pm »
I type them linearly (except for the times when I realise I need another opening one earlier on, and have to go back to put it in).

If your expression is complex enough that you need help writing it, it's likely to be too complicated for someone else to (easily) understand later.

The only time I want my editor typing things for me is autoindenting.  I don't understand how we survived before that was invented.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: How do you type your brackets?
« Reply #11 on: June 20, 2015, 08:00:58 pm »
I tend to write linearly, unless I have an awful lot of braces to sort out, and can't keep track of them by eye...

Also, braces like {
this
}

;D

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline suicidaleggroll

  • Super Contributor
  • ***
  • Posts: 1453
  • Country: us
Re: How do you type your brackets?
« Reply #12 on: June 20, 2015, 11:28:05 pm »
If the parenthesis/brackets span multiple lines, like function declarations, if/for blocks, etc., I'll write both and then go back inside to fill it in.  If it's just parenthesis like (this) I do it linearly.

Quote from: RickBrant
Not only does it help you avoid missing brackets, it's also more efficient use of the shift key.
And a signficantly less efficient use of the arrow keys.  Since the shift and bracket keys don't require moving your hand, I tend to stay away from the arrow keys as much as possible.
 

Offline suicidaleggroll

  • Super Contributor
  • ***
  • Posts: 1453
  • Country: us
Re: How do you type your brackets?
« Reply #13 on: June 20, 2015, 11:34:55 pm »
Many IDEs type the closing bracket for you anyway.

Very, very few things bother me more than this, and I'm including war, disease, poverty, starvation, etc etc...

I hate that too.  Give me auto-indenting and syntax highlighting and then stay the hell out of my way.  Probably the reason I use vim/emacs and detest most IDEs.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: How do you type your brackets?
« Reply #14 on: June 20, 2015, 11:43:20 pm »
If the parenthesis/brackets span multiple lines, like function declarations, if/for blocks, etc., I'll write both and then go back inside to fill it in.  If it's just parenthesis like (this) I do it linearly.

Quote from: RickBrant
Not only does it help you avoid missing brackets, it's also more efficient use of the shift key.
And a signficantly less efficient use of the arrow keys.  Since the shift and bracket keys don't require moving your hand, I tend to stay away from the arrow keys as much as possible.

Speed that up with some CTRL+left/right.  Also CTRL+DEL/BKSP to clear words (sometimes clears until end of line instead..) :)

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8550
  • Country: us
    • SiliconValleyGarage
Re: How do you type your brackets?
« Reply #15 on: June 20, 2015, 11:45:32 pm »
i use a programming language that needs no stinking brackets or semicolons or other rubbish  ^-^
in the odd case i need a bracket () it is to denote the order of instructions in , for example, a mathematical expression.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: How do you type your brackets?
« Reply #16 on: June 21, 2015, 12:09:48 am »
Not a Lisp fan, I take it?
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8550
  • Country: us
    • SiliconValleyGarage
Re: How do you type your brackets?
« Reply #17 on: June 21, 2015, 12:13:00 am »
Not a Lisp fan, I take it?
if you can't write code it in basic , you don't understand the problem.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: How do you type your brackets?
« Reply #18 on: June 21, 2015, 12:14:21 am »
Not a Lisp fan, I take it?
if you can't write code it in basic , you don't understand the problem.

If you do code it in basic, you are the problem >:D >:D
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6296
  • Country: 00
Re: How do you type your brackets?
« Reply #19 on: June 21, 2015, 01:06:47 am »
if you can't write code it in basic , you don't understand the problem.

Basic is the Arduino of the programming world.
 

Offline magetoo

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: se
Re: How do you type your brackets?
« Reply #20 on: June 22, 2015, 12:39:12 pm »
)
"

(phew)


I type parentheses, quotation marks and braces just left-to-right when it's clear what is supposed to go in between (think "Hello, world"), but as pairs if there is any thinking involved.  Curly braces always seem to come in pairs.


And I have a lingering discomfort with quotation marks since my days programming the C64 in BASIC.  If you didn't close them properly, the arrow keys would just produce control codes in your string instead of moving the cursor.

For that reason, you tended to always write in complete strings, and defensively close your quotes.  Still throws me off occasionally.
 

Offline JackP

  • Regular Contributor
  • *
  • Posts: 185
  • Country: gb
Re: How do you type your brackets?
« Reply #21 on: June 22, 2015, 07:11:48 pm »
On the topic, how many new lines do you put under a code block? For a control structure like 'if' of 'while', I do:

while (1){
    GOTO gotoHaters :blah:
}

I add the opening brace, double tap enter, close the braces, press up arrow key and indent. I see way to many people putting multiple lines in between; WHY??? You're going to press enter after the semicolon anyway, so adding more lines than one is pointless.  :scared:
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: How do you type your brackets?
« Reply #22 on: June 22, 2015, 07:41:48 pm »
I add newlines if it looks clear that way.

An example might be, setting initialization and variable declaration as one block, followed by flow control statements and whatnot.

Everything ran together looks bad.  Nothing catches the eye and groups statements.  Perhaps the most disappointing thing, to me, about many assemblers, is they don't discard extra whitespace, so you can't indent passages of code and have to do it with surrounding comments, which just doesn't have the visual appeal of indentation.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline John Coloccia

  • Super Contributor
  • ***
  • Posts: 1217
  • Country: us
Re: How do you type your brackets?
« Reply #23 on: June 22, 2015, 09:00:47 pm »
I type my brackets the normal way, but I do really like using a good code editor.  On Windows, the best I've found so far is the Visual Studio editor.  You can get it with the free 2013 download.  I tend to use that for everything...code, HTML...whatever, even if I'm not using the compiler.  I've been doing that for about 10 years years, even for editing code on Unix systems (used to use some software that let me mount an FTP site as a drive...worked killer).

I tend to turn off the vast majority of context highlighting, and really simplify things.  The things I like to leave on, though, are different colors for strings and comments, and I LOVE inserting the matching brace automatically.  I still tend to type it, but it's nice to automatically have it there just in case.

But I am absolutely, positively anal about lining up opening and closing brackets....beyond anal.  I would let a lot of formatting boo boos slip by if we were under time pressure, but that one would absolutely fail code review no matter what.  We also limited to 80 characters for a number of reasons, including print outs and so the formatting looked right no matter which tool someone wanted to use (a lot of old tools and terminals still seem to assume 80 characters).  I hated that requirement, but I had to do it to keep some of the engineers from revolting.  Honestly, as long as everyone does it the same way, it's all good, but lining up the curly braces was non-negotiable.

« Last Edit: June 22, 2015, 09:08:18 pm by John Coloccia »
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6296
  • Country: 00
Re: How do you type your brackets?
« Reply #24 on: June 23, 2015, 07:59:29 pm »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf