Pages: [1]   Go Down
Author Topic: IDE Suggestion... any takers? - Collasapable Code Segments  (Read 1740 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I believe that the IDE can be improved / modded to support collasapable Code such as in visual studio.

Does any one else agree?
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 434
Posts: 23596
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't even know what that means. Got a link to a reference  about it?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Guildford, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 217
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a link

http://msdn.microsoft.com/en-us/library/b6xkz944%28v=vs.80%29.aspx

but it doesn't help you understand what it does.

In .NET you can sprinkle #region / #endregion throughout your classes. You may ask why would I want to do this. The answer is it helps with removing clutter. When you open a class without regions you just have a bunch of functions. With regions you can group functions together into logical groups and best of all, collapse whole regions down to a single line. In .NET you can nest regions within regions so you can categorise further.

As an example I would wrap all functions connected with construction (constructors, setup code etc) in one region. Getters / setters in another. Remaining public methods and private methods each go in their own region. So if I was working on some internal feature of the class I'd collapse all regions except the one holding all my private functions.

You probably have to be more of a programmer than a hobbyist to really want this. TBH I'd suggest the OP try using Visual Studio and the excellent VisualMicro plugin (http://www.visualmicro.com) which allows you to use Visual Studio (and therefore code folding) and is compatible with the Arduino IDE so you can swap back at will, or share your work with others.

Iain
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 36
Posts: 5519
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a link

http://msdn.microsoft.com/en-us/library/b6xkz944%28v=vs.80%29.aspx

but it doesn't help you understand what it does.

In .NET you can sprinkle #region / #endregion throughout your classes. You may ask why would I want to do this. The answer is it helps with removing clutter. When you open a class without regions you just have a bunch of functions. With regions you can group functions together into logical groups and best of all, collapse whole regions down to a single line. In .NET you can nest regions within regions so you can categorise further.

As an example I would wrap all functions connected with construction (constructors, setup code etc) in one region. Getters / setters in another. Remaining public methods and private methods each go in their own region. So if I was working on some internal feature of the class I'd collapse all regions except the one holding all my private functions.

You probably have to be more of a programmer than a hobbyist to really want this. TBH I'd suggest the OP try using Visual Studio and the excellent VisualMicro plugin (http://www.visualmicro.com) which allows you to use Visual Studio (and therefore code folding) and is compatible with the Arduino IDE so you can swap back at will, or share your work with others.

Iain

The "standard" way I've seen this done in the C/C++ world (as well as languages with a similar style, like PHP) - is that your "regions" as you call them, are defined at the level of the functional block (that is, the collapse/expand is placed wherever a function block starting with the left-hand brace "{" occurs). This allows you to expand/collapse everything at will (functions, if-then-else constructs, switch-case, do-loop, structures, class definitions, etc). No need for a specialized "marker" element for most things, but one could be added if absolutely needed and it wouldn't detract.

I agree that such a thing would be nice in the IDE - but this goes the route of so many other changes proposed to the IDE: It makes it more complex, more geared to users who have already encountered such "more professional" options in other IDEs. This means the IDE that is standard for the Arduino becomes just a bit more less accessible for the user audience the Arduino is mainly aimed at: Non-professional programmers, non-programmers, artists, and students/educators.

I say that if you want these extra features for more professional development, you take a look into using an external editor (gedit, kate - sorry, *nix here), a better IDE (geany, codeblocks, etc) or any number of the plugins or such for the Eclipse IDE.
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Belgium
Offline Offline
Edison Member
*
Karma: 58
Posts: 1720
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
I agree with crosh that although this is a great feature it will make the IDE more difficult for newbies. (Where is my code?????  smiley-eek-blue )
Unless the IDE starts to have multiple "perspectives" (preferably with an option in the preference to select the perspective and set as default to the "newbie perspective") I would not do this.

Best regards
Jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 65
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

cr0sh - well said. 90% of Arduino users are new to programming, and while folding routines are useful, they are really required for complex programs which the majority of Arduino users won't be writing for a while. We use the Imagecraft compiler which is based on codeblocks and it has some great features such as:
Right click to find declaration
Right click to find implementation
Format a whole file to move the {} to the right place

Another great feature to add would be to have a built-in simulator http://www.arduino.com.au/Simulator-for-Arduino.html

Probably the best way to resolve which features to add would be to take a survey or poll every 6 months and add the top 5 most requested features.
Logged


North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 52
Posts: 1770
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah a poll would be great,
I think a better scenario is to handle tabs better ( open and close tabs from a sketch folder view ) allowing smaller source files, but maintaining manageability. I have combined a few of my library files just to reduce the number of tabs ( it is in sketch folder while I develop it ). I don't really have a need for any other IDE apart for this reason. Still using the Arduino IDE though.
Logged


Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 331
Posts: 16459
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My arduino sketch codes already frequently collapse, I don't think It needs any extra help in that area.  smiley-wink
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I agree that such a thing would be nice in the IDE - but this goes the route of so many other changes proposed to the IDE: It makes it more complex, more geared to users who have already encountered such "more professional" options in other IDEs. This means the IDE that is standard for the Arduino becomes just a bit more less accessible for the user audience the Arduino is mainly aimed at: Non-professional programmers, non-programmers, artists, and students/educators.

I don't see how collapsing code blocks could make the software less accessible for beginning programmers.

Someone mentioned an option in the settings of the IDE that would enable/disable it. That sounds like a perfect idea to me, disabled by default and then we can enable it if we so choose.
Logged

Offline Offline
Edison Member
*
Karma: 17
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why not keep the IDE extremely lean (it already takes too long to download, and space is a big problem for computers at a school), but add a CLI that comes with it and does exactly the same things hitting the compile button does (not one of those sorta-kinda-works makefiles) so that after editing in whatever you want, you just setup a button that runs that program.

Really, it's much simpler to make than to explain. This way, you can use any program at all to edit your files, and if it includes a user-configurable compile script (which most sane ones should, but I really have no idea), you just put in "arduino -c file1 file2 file3.
Logged

Belgium
Offline Offline
Edison Member
*
Karma: 58
Posts: 1720
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Really, it's much simpler to make than to explain. This way, you can use any program at all to edit your files, and if it includes a user-configurable compile script (which most sane ones should, but I really have no idea), you just put in "arduino -c file1 file2 file3.
I don't think it is that simple. Why? because you want the IDE to integrate with the compile and upload button. Think about saving before compiling.
The Arduino IDE really does a great job at making it look easy. But actually it is not that easy.
I have build the eclipse plugin and I am using it nearly on a daily basis. Still I sometimes I get confused and things do not work out as I intended. My bad; this is a cost due to added features.

I believe far more in a simple powerful Arduino IDE and when you need more you step up to another IDE.
Options I know about are:
Arduino Eclipse plugin
Code block
A makefile based solution
Visual studio
Win AVR

All of them have their pro's and con's. And these change over time. I think people coming from a IT background have it easier (because they know at least one of these environments) on this; where people with a electronics background may suffer more.

To compare it with my hardware track. I bought a duemilnove (the Uno didn't exist yet) as it was the only board I knew. Then you learn about other boards each with their pro's and con's. Being a software guy it is really hard to tell which one is best for me. I guess people with electronics background have it easier here.
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I see how you could want this.
I've seen a lot of people put "#region" in C# files to organize code better. I've even seen people do this in NetBeans on Java projects. A downside is using it on another IDE that fails to support that (Example: Using the NetBeans comments to collapse your code wont collapse it on Eclipse).
Personally, I wouldn't want this added, but others may.

If they were to add it, I see two ways they could implement it.
  • Preprocessor directives, such as "#region" / "#endregion" or "#collapse" / "#endcollapse".
  • Comments, such as "//@region" / "//@endregion" or "//@collapse" / "//@endcollapse".
Of course, the symbols in the comments and the names could be anything, I was just using those four as an example.

Other than making it easier for others to know what a group is for, I see no purpose for these.

Just my two cents.
Logged

Pages: [1]   Go Up
Jump to: