How do you type your brackets? - Page 1
Forum section: electronics / general

author: fubar.gr
author_rank: Unknown
timestamp: June 19, 2015, 09:13:37 pm
content: I have this weird habit and wonder if I am just a weirdo or it is more common than I thoughtWhen 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?

author: Yansi
author_rank: Super Contributor
timestamp: June 19, 2015, 09:15:30 pm
content: The same way.

author: Stupid Beard
author_rank: Regular Contributor
timestamp: June 19, 2015, 09:43:46 pm
content: 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)

author: c4757p
author_rank: Super Contributor
timestamp: June 19, 2015, 09:50:41 pm
content: Quote from: Stupid Beard on June 19, 2015, 09:43:46 pmNah, 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.

author: kolonelkadat
author_rank: Regular Contributor
timestamp: June 19, 2015, 09:55:41 pm
content: 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.

author: kingofkya
author_rank: Regular Contributor
timestamp: June 19, 2015, 09:57:59 pm
content: Yep your not alone at all.

author: c4757p
author_rank: Super Contributor
timestamp: June 19, 2015, 09:58:26 pm
content: Quote from: mojo-chan on June 19, 2015, 09:55:55 pmVery, very few things bother me more than this, and I'm including war, disease, poverty, starvation, etc etc...

author: miguelvp
author_rank: Super Contributor
timestamp: June 20, 2015, 05:03:44 am
content: Sometimes, when I'm not really thinking about it, I don't use parenthesis and use commas instead.

author: jadew
author_rank: Frequent Contributor
timestamp: June 20, 2015, 05:40:28 am
content: I never type them both when I'm writing text. If it's code or a formula, yeah.

author: RickBrant
author_rank: Unknown
timestamp: June 20, 2015, 06:29:20 pm
content: Not only does it help you avoid missing brackets, it's also more efficient use of the shift key.

author: DJohn
author_rank: Regular Contributor
timestamp: June 20, 2015, 07:15:01 pm
content: 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.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 20, 2015, 08:00:58 pm
content: 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}Tim

author: suicidaleggroll
author_rank: Super Contributor
timestamp: June 20, 2015, 11:28:05 pm
content: 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: RickBrantAnd a signficantlylessefficient 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.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: June 20, 2015, 11:34:55 pm
content: Quote from: c4757p on June 19, 2015, 09:58:26 pmI 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.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 20, 2015, 11:43:20 pm
content: Quote from: suicidaleggroll on June 20, 2015, 11:28:05 pmSpeed that up with some CTRL+left/right. Also CTRL+DEL/BKSP to clear words (sometimes clears until end of line instead..)Tim

author: free_electron
author_rank: Super Contributor
timestamp: June 20, 2015, 11:45:32 pm
content: i use a programming language that needs no stinking brackets or semicolons or other rubbishin the odd case i need a bracket () it is to denote the order of instructions in , for example, a mathematical expression.

author: c4757p
author_rank: Super Contributor
timestamp: June 21, 2015, 12:09:48 am
content: Not a Lisp fan, I take it?

author: free_electron
author_rank: Super Contributor
timestamp: June 21, 2015, 12:13:00 am
content: Quote from: c4757p on June 21, 2015, 12:09:48 amif you can't write code it in basic , you don't understand the problem.

author: c4757p
author_rank: Super Contributor
timestamp: June 21, 2015, 12:14:21 am
content: Quote from: free_electron on June 21, 2015, 12:13:00 amIf you do code it in basic, you are the problem

author: zapta
author_rank: Super Contributor
timestamp: June 21, 2015, 01:06:47 am
content: Quote from: free_electron on June 21, 2015, 12:13:00 amBasic is the Arduino of the programming world.

author: magetoo
author_rank: Frequent Contributor
timestamp: June 22, 2015, 12:39:12 pm
content: )"(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.

author: JackP
author_rank: Regular Contributor
timestamp: June 22, 2015, 07:11:48 pm
content: 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}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.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 22, 2015, 07:41:48 pm
content: 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

author: John Coloccia
author_rank: Super Contributor
timestamp: June 22, 2015, 09:00:47 pm
content: 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.

author: zapta
author_rank: Super Contributor
timestamp: June 23, 2015, 07:59:29 pm
content: Quote from: mojo-chan on June 23, 2015, 08:22:49 amDon't say it in a job interview.

author: TheAmmoniacal
author_rank: Unknown
timestamp: June 23, 2015, 08:04:35 pm
content: I also write them linearly, and hate editors that automatically adds the other bracket..

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 24, 2015, 01:14:12 am
content: Oddly related thought:You know those people who drive around with their blinkers stuck on?They probably aren't good at using brackets.Tim

author: Whales
author_rank: Super Contributor
timestamp: June 24, 2015, 01:45:04 am
content: I tend to put spaces on either sides of my braces on normal sentences ( like this ) which really annoys Microsoft Word and wraps to new lines badly. Nothing may steal this from me.(

author: Mr.B
author_rank: Unknown
timestamp: June 24, 2015, 01:52:30 am
content: For me: Open bracket or brace, close bracket or brace, back arrow, start typing content.As others have already mentioned - I think it is a "Programmer Thing".