Pages: 1 [2]   Go Down
Author Topic: Be able to set a region in a defined piece of code  (Read 3572 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 304
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
A) who doesnt have java already
Me. I hate it and refused to put it on my machines until the Arduino IDE gave me no choice. smiley

I like the IDE and even though I've been a Visual Studio user for countless versions, I don't wouldn't want to see the Arduino software head in that direction...

...but I also agree with the OP that being able to collapse defined areas of code (as opposed to being able to collapse all blocks) would be nice for me. It suits the way I work.
Logged

Nowhere
Offline Offline
God Member
*****
Karma: 3
Posts: 852
|-\ |\|\
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so users that cant be expected to handle a + box next to their code is now a keyboard shortcut expert, its broken behaviour with what anyone expects out of text entry

It's a pretty standard and well known shortcut, I think.

But my problem with the regions idea is the + boxes.  I would not want little things cluttering up the code window.  Sort of like how ms word has bunches of little tool things that pop up in the the text (autocorrect, paste options), it just bothers me.
 :-X



(
Logged

Soundcloud page: http://soundcloud.com/beefinator-2
Youtube channel: http://www.youtube.com/user/beefinator14
Old soundcloud page (ran out o

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It's a pretty standard and well known shortcut, I think.

The idea whenever an [glow]option[/glow][/b] gets presented its deemed to clutter and over complicate the idea of a text editor to the user

so one cant be in the camp of "the user is too stupid" and then turn around offering keyboard shortcuts, modding hidden text files, and be exposed to broken behavior

either the user is too durn stupid or not, I bet not and a settings menu with some checkboxes is not going to break your flow nor kill the IDE as we know it leaving the arduino community in ruin

and honestly if little wiggley lines bug you so much, well it must be nice thats all you have to be bothered by
« Last Edit: August 03, 2010, 08:39:42 am by Osgeld » Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Being an Arduino noob, my opinion and 50 cents together won't even buy a soda but I'm going to express it anyway!

I tend to agree with the OP.  Some sort of tool is needed to better navigate medium to large sketches.  The evolution of Arduino compatible processors will handle larger and larger programs (now up to 128k with the Mega, soon to be 256k), a sketch can become quite long.  I have resorted to placing multiple commands on a single line in order to shorten the overall length of the sketch.  Most code structure nazis cringe at the thought of this, I'm sure, but it has become a necessary evil to me.

Thanks for listening,
Billy
Logged

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 304
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The evolution of Arduino compatible processors will handle larger and larger programs
That's a very good point actually.

8
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49372
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Most code structure nazis cringe at the thought of this, I'm sure
For good reason. It's much harder to add/delete lines of code when the one-command-per-line rule is violated.

It is possible to create additional files in a sketch directory, and move tested/utility/related functions out of the main sketch, to reduce the size of the sketch. This is the approach that libraries take.
Logged

0
Offline Offline
God Member
*****
Karma: 2
Posts: 596
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have resorted to placing multiple commands on a single line in order to shorten the overall length of the sketch.  Most code structure nazis cringe at the thought of this, I'm sure, but it has become a necessary evil to me.

I usually pay attention not only to code structure, but even to the number of blanks between a closing paren and an opening brace.
I even align comments.
Trashing code structure just to "shorten the length of the sketch" is a very, I mean VERY bad idea. You're trading a fundamental code maintenance requirement for the nuisance of scrolling through a long text file. The "necessary evil" you're talking about is learning how to split a sketch into multiple files or, better yet, learn how to write libraries (this site has a very good tutorial).

:-)
Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino way is "for the rest of us"...
Compared to any (semi-)professional programming editor the Arduino IDE is a good joke.

However its simplicity suits the newcomer.

I think a lot can be done by using the tab-feature of the IDE. To my astonishment hardly anyone ever wondered what that small arrow at the right hand side of the IDE window could be :-)

Using such "modules"  can structure your code quite efficiently without the need for libraries....
« Last Edit: August 16, 2010, 04:27:39 am by mpeuser » Logged

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 304
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Separate files/classes/libraries etc. etc. doesn't always make for more readable code.

I don't think the IDE is a "joke", but can't see any harm in implementing a simple user-defined collapsable region as used in things like Visual Studio.

#region Input Code
   - code goes here
#endregion

Then if you don't like it, you don't have to use it.
« Last Edit: August 16, 2010, 04:42:37 am by Eight » Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But I am not against your proposal!

Good design, however, is a matter oh hierarchical decomposition (or "abstracton"). Though two levels are by far not enough for larger projects, they will help a lot. Of course the tab feature  can be used for any number of levels, but you will not "see" the level, so the main use will be to separate the main module and one level of submodules, which should carry 80% of the code burden....

Puttiing everything in one file - folded or unfolded - is as awkward as putting every class into a separate file :-)
« Last Edit: August 16, 2010, 05:44:00 am by mpeuser » Logged

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 304
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But I am not against your proposal!
Oh I know, and I wasn't trying to counter you specifically as you made perfectly valid points and suggestions.

In some cases, too many levels of code separation is counter-productive and a simple collapsable region would be an additional facility for those of us who like to use them. Ideally, only when it is still sensible to do so. smiley
Logged

Pages: 1 [2]   Go Up
Jump to: