ID:102250
 
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
I've grown quite fond of using Visual C++ from Microsoft and I highly doubt this feature is copyrighted, but I would like to see the ability to collapse/show various parts of code snippets by using the { and } as "points of collapse/show".

An example -- using Visual C++ as an example -- :



http://www.byond.com/members/MaximusAlex2003/files/ Example.PNG
A lot of popular IDEs have this, as well as line numbering, etc. The best answer you'll get is 'wait for DMIDE.'
Yeah, I'm afraid of that reply. I've been waiting for DMIDE a little while. I still pay attention to their Google site thing and their BYOND page.
I could swear I've seen this suggested already, but maybe it was just in the forums. This is kind of on par with IntelliSense in that it's not trivial to add.
Does anyone actually think that DMIDE is coming out? Right after Duke Nukem Forever.
Falacy wrote:
Does anyone actually think that DMIDE is coming out? Right after Duke Nukem Forever.

The project is open-source, can be checked out, etc. It's already out, just not completely feature filled.
Falacy wrote:
Does anyone actually think that DMIDE is coming out? Right after Duke Nukem Forever.

It would be awesome if you said that not knowing DKF comes out in a year or so.
Toadfish wrote:
It would be awesome if you said that not knowing DKF comes out in a year or so.

So they've been saying for what? 10+ years? Good luck with that.
If we can't get them to add line numbers, how can you expect them to add code folding? =p
Falacy wrote:
Toadfish wrote:
It would be awesome if you said that not knowing DKF comes out in a year or so.

So they've been saying for what? 10+ years? Good luck with that.

But when it does come out in 2011-12, I'll be expecting collapsed snippets thanks to you.
Yota wrote:
If we can't get them to add line numbers, how can you expect them to add code folding? =p

What ever happened to that request... was the pre-tracker?
Bumping this, I would really like it it would make everything so more organized.
I actually have never really liked the feature, and it goes without use in IDEs I use. I'll explain why, as I think the rationale (if shared) is important for BYOND's case specifically.

Essentially, code folding is about code proximity, and code length, in my opinion. You have a scenario like so:

proc/A()

proc/B()

proc/C()


Semantically, A and C are quite related. Perhaps they call each other, or in some way perform complimentary functions. As such, you tend to want to move between A and C quite smoothly.

Now without code folding, you 'problem' lies in the placement of B, and more importantly, the length of B. If B is long, given it's position, you struggle to keep related A and C on one screen. The solution, as seen by the IDE, is to permit B to be collapsed to just it's signature, thus putting A and C in close proximity.

Now, the reason I have no use for this, is that by good practice, B is never long enough in my codebase. In fact, none of my procedures are really long enough such that I cannot at least see a procedure above and below it at the same time. This is intentional. Not so much for that readability, that's actually more of a positive side-effect I'm rather happy about.

No, it's done to aid debugging, readability of the procedure itself, and to ensure a good level of code re-use and consideration about the design of my procedure. It's that old (classic, tried and tested, industry approved blah blah) best practice of "Your function must fit into one screen's space". The point being to make sure you are not writing functions where there's too much flow and variables to consider when reading, debugging and visually inspecting for errors.

Code folding, is, as I see it, a workaround for a problem that by good practice should never exist in the first place. Related code goes together, and procedures remain short to improve their re-use, readability and maintenance. Between an honest effort to keep both tenets, you not only have much better code (hurray!), you have more organised code, and no real cause to fold. To add code folding is, in my opinion, to patch-fix a problem BYOND developers actually need to be paying attention to, for the sake of their own project's maintenance, and the IDE should not be encouraging in new developers.

That's pretty much my view on it.
Think about turfs and objects then folding those could be fantastic..

You could have 1000's of turfs one file folding could help the scrolling process.

turf
1001 //Fold this
turf1
turf2
1000 // now I can see these without scrolling past 100's & 1000s sprinkles.
Typically I don't have this scenario, mostly just because navigation in multi-thousand line files is, with or without code folding, something of a pain, I feel, and probably constitutes another less than ideal practice, because that file is always going to be iffy to navigate, and you'd not want to get into that scenario in the first place.

It is a fair point though, the tree hierarchy in BYOND does lend itself or show apparent merit to a few more scenarios for code folding that other languages do not, as shown. Multiple file use is basically looking to use the tree structure of directories / files in a way you'd use code folding in that scenario, so the concept works there, yeah.
I use code folding (Mainly in Notepad++) to hide whatever is irrelevant to me. It's not that it's hiding things as much as it is harder for me to find things.
Using Stephen's example, if I have this:
proc/A()
// This proc, while touching up C(), is still visible
// however, it is at the top of the screen while C() is at the bottom.

proc/B()
// This proc is just unrelated filler taking up eye-space.

proc/C()
// This is the proc I am editing.


I would much rather be able to fold B() down to just:
proc/B()

It makes it easier to look right above the procedure I am editing than to look all the way to the top of the screen.

Trivial, yes, but so is line numbers.
I don't really consider it trivial actually, and I do appreciate the benefit it must provide you. I do just question whether the feature adds a convenience at the cost of hidding a problem (no pun intended).
Obviously this feature won't cause an issue to users that like it the way it is now.

It can be handy for the ones that do use it, the feature is in almost every popular IDE or editor to date.
In response to Stephen001
I do understand your point, Stephen, but I think we may want to take this a step at a time. Most "developers" are barely, if at all, trying to actually learn how to program. There are a few who seem to be giving an honest effort - and kudos to them. I'm sure, if they are serious, they will come across an epiphany (Or an article, or something) that will tell them that they need better organization - and collapsing code is not the answer.

Hell, you could write the article.
See, the problem I have is that my screen only has a vertical range of 600 pixels. It is, unfortunately, what I have been stuck programming with for about two years. Code folding helps, a lot, when you're already limited by your task bar which can be hidden, status bar, menus, and compiler debuggymabob area.
Page: 1 2