Be able to set a region in a defined piece of code

I personally am not sure where the line is on noobie stuff, "we" hand them a kinda pricey board that could burst into flames, show them how to mess with mains current, then turn around and say a +/- expansion box in the IDE is too confusing for them

After all you may have scored a point :slight_smile:

Well I just don't like code folding. Let alone that regions thing which is supposed to be code folding on steroids. And let's keep ms crap out of arduino!

Ah, I feel better now... /me takes a deep breath

;D

next time I will just be blunt instead of assuming the reader would figure that out

I understood your point and was not ignoring your post.

But the discussion is not only about whether a feature is useful in small or large projects. There is also value in keeping the complexity of the IDE user interface low. It is one of the great successes of Arduino that extreme novices can use the tool with very little confusion.

Every feature that gets added, regardless of how useful or simple, adds to the cognitive load in learning a new tool. Compare the novice's reaction when confronting for the first time, say, Photoshop vs iPhoto.

I don't know for sure where a code expand/collapse feature would land on the various usability/complexity cognitive axes, but I do know that it is healthy to have a good discussion about it before adding a feature.

Not doing that leads to the way of Microsoft Word and who knows what else...

"Lasciate ogne speranza, voi ch'intrate"
"Abandon all hope, ye who enter here"

  • Dante Alighieri

I am not leaning towards this idea either.
Sure, it would be useful, but I've found in some of my projects the cluttered cluster of functions that are not currently collapsible may have been beneficial; they drove me to organize things in classes and libraries, which IMO organize things even better.

I also like the simplicity of the IDE, leaning me further from the regions idea. I sort of like having only 2 areas of text (code section and message box thing for errors and stuff), 3 scroll bars, a row of tabs, and 6 or 7 buttons in the window.
I agree that arduino MUST NOT become like Microsoft word...shudder
:smiley:

being one of the more clunky broken "IDE's" I use its almost right up there with wordpad, least wordpad saves on exit...

anyway I will agree that isnt the most important thing, but for version 1 overall there doesnt seem to be that many great ideas making it in, and a lot of bugs in the IDE automatically get shoved off onto processing and deemed "unfixable" so what is acceptable? (keeping in mind people have used a computer before arduino and things like options are abundant)

I disagree that the IDE is broken and clunky. I find its clarity and simplicity to be one of its strengths.

Edit the code, upload it to the board, it runs. That is very easily explained and easily grasped by novices.

hold shift bump delete watch half a page vanish, doesn't save on exit(lost entire nights worth of effort over that one), sometimes doesn't save when manually saved, has issues with library locations, its HUGE (seriously 230mb for a text editor? over half of that is java), and you cant even change the font size

yup, not clunky at all :wink:

but that is what one gets trying to shoehorn something into a framework that is not designed for it, its like trying to write a IDE out of love2d or pygame or processing (oh wait)

hold shift bump delete watch half a page vanish, ctrl-z? doesn't save on exit(lost entire nights worth of effort over that one) when I exit, it asks if I want to save, maybe I don't know what you mean by "exit" , sometimes doesn't save when manually saved, I've never had problems with that has issues with library locations, Again, never been an issue for me its HUGE (seriously 230mb for a text editor? uhh, it's a bit more than just a text editor, you have a whole programming language included over half of that is java), and you cant even change the font size yes you can, look in the preference file

I also disagree that it is clunky.

ctrl-z?

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

when I exit, it asks if I want to save, maybe I don't know what you mean by "exit"

my bad they fixed that in 18, it did nothing for the longest time

I've never had problems with that

I cant make it repeat reliably, but if you save a sketch outside of the default location it will pop up quite quickly

Again, never been an issue for me

try putting a lib in your sketchbook folder

uhh, it's a bit more than just a text editor, you have a whole programming language included

that's kind of the problem, the linux download is 7mb! yes you have to add dependencies like java and avrgcc, but

A) who doesnt have java already
B) the entire package of avrgcc is like 30mb

yes you can, look in the preference file

and again a simple minded user's head would explode if extra options were added, but if they really need to, they can hunt down and edit preferences.txt
::slight_smile:

whatever, I don't want to argue about it till the end of time

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. :slight_smile:

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.

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

(

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

The idea whenever an option 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

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

The evolution of Arduino compatible processors will handle larger and larger programs

That's a very good point actually.

8

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.

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).

:slight_smile:

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 :slight_smile:

Using such "modules" can structure your code quite efficiently without the need for libraries....

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.

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 :slight_smile:

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. :slight_smile: