Editor source comments

Working on new editor enhancements?
Amiga5k
Enthusiast
Enthusiast
Posts: 329
Joined: Fri Apr 25, 2003 8:57 pm

Editor source comments

Post by Amiga5k »

I'm really grateful that the source for the IDE is available for us to look at and modify.

Unfortunately, I find it a bit tricky to follow as it is not well-commented and uses a considerable amount of advanced technique (WinAPI calls, etc).

The fact that there are ony a few non 'official' IDE's out there tells me that it may indeed be a bit technical for a lot of people to understand.

Anyone willing to go through that baby and put some comments in there, somewhat detailing what's going on? It would be a great help and a HUGE learning tool for a lot of us, I think.

The modular structure of it, although probably the best way to go from a professional programmers point of view, makes it even more difficult to see what's what. (I may copy\paste all of the includes into the main file so I can follow the flow a bit easier).

Thanks,
Russell
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: Editor source comments

Post by GPI »

Amiga5k wrote:(I may copy\paste all of the includes into the main file so I can follow the flow a bit easier).
Very bad idea. The file is then too big and then you have problems (for example very long loading time).

The IDE-Sourcecode is complex and i don't think, that many comments will help. And to modify the source you don't must exact know, what each line does, but you should know, what the procedure do.

When you have problems with the API-Commands, you should install a MSDN of a C++ CD or the Windows Platform SDK.
Amiga5k
Enthusiast
Enthusiast
Posts: 329
Joined: Fri Apr 25, 2003 8:57 pm

Post by Amiga5k »

GPI, it seems like everything is a bad idea to you...

If the code compiles without errors as it is (and it does) then why would putting it all in one file make it more error-prone? (Yes, I break up my own code into includes, but it makes sense to me because I wrote it.)

As far as load times are concerned, it would still be loading the same amount of data to compile! Less actually, because the "Include" keywords would not need to be there. The difference in load times would be in the millisecond range!

Anyway, following the flow of the code would be a LOT easier in one big file, because all of the Procedure names, etc would then appear in the sidebar and I wouldn't even have to know which module they are in (which is how it is now).

You don't think comments would help? Are you kidding me? :roll: Can you think of a good reason why commenting is a good thing? If you can't, then I don't know what to say... Maybe you'd be more comfortable coding in direct machine code? Not assembler, but actual machine code...on a punch card. (ok, that was too much perhaps...but sheesh!)

And I'm not having problems with API commands... Did you actually read my post? I'm saying that for people who don't generally use the API, the source code that DOES use it may be tricky to follow.
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

That's true than the IDE code isn't the best code to learn from, for several reasons: it's a cooperative work, Fr34k, Danilo, David McMinn and myself have worked on it, which means there is several programming style mixed together (even if I tried to force the others to follow the first one :twisted: ). Then, it's a raw mix of API and PB functions as we needed to implement some uncommon features. So you need to be familia with Win32 programming before jumping on it. Another drawback is its size: yes it's big, and yes it's much better to split it by several parts (you can notice than all the part are splitted correctly, mainly per window and per functions). We could of course comment it, but I don't think it will help a lot. We tried to choose the procedure/variable names to be easily understandable, and the best way to learn it is to run it and see what is happening. GPI immediately took over the original with success, so it's possible :wink:. We opened the IDE sources for one reason: having a big public source, as a 'proof of concept' for all PureBasic programmers.
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Amiga5k wrote:GPI, it seems like everything is a bad idea to you...
Try it:
Open the IDE Source-Mainfile in jaPBe and start the Cutter-Plugin...
Amiga5k
Enthusiast
Enthusiast
Posts: 329
Joined: Fri Apr 25, 2003 8:57 pm

Post by Amiga5k »

Fred wrote:That's true than the IDE code isn't the best code to learn from, for several reasons: it's a cooperative work, Fr34k, Danilo, David McMinn and myself have worked on it, which means there is several programming style mixed together (even if I tried to force the others to follow the first one :twisted: ). Then, it's a raw mix of API and PB functions as we needed to implement some uncommon features. So you need to be familia with Win32 programming before jumping on it. Another drawback is its size: yes it's big, and yes it's much better to split it by several parts (you can notice than all the part are splitted correctly, mainly per window and per functions). We could of course comment it, but I don't think it will help a lot. We tried to choose the procedure/variable names to be easily understandable, and the best way to learn it is to run it and see what is happening. GPI immediately took over the original with success, so it's possible :wink:. We opened the IDE sources for one reason: having a big public source, as a 'proof of concept' for all PureBasic programmers.
Thanks for the answer, Fred. I admit that learning from a complex program is maybe not the best way to learn code, but it is made considerably more difficult by lack of comments. I would especially think that working in a collaborative manner would almost certainly dictate that the code be at least somewhat commented. I mean, documenting\commenting is a fundamental concept of programming...especially in a group effort!

I don't need to tell you these things, of course, because you are, by all accounts, a professional programmer. :D

Commenting is great because:
It doesn't increase the compiled file size a single byte (source code, yes).
It makes well commented programs serve also as a tutorial of sorts.
It makes it easier for the original programmer to remember what's what if the code is updated at a much later date.

But the newbie should know that commenting is one of the most important things to remember when programming, wouldn't you agree :?: :D

Russell
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***
Amiga5k
Enthusiast
Enthusiast
Posts: 329
Joined: Fri Apr 25, 2003 8:57 pm

Post by Amiga5k »

GPI wrote:
Amiga5k wrote:GPI, it seems like everything is a bad idea to you...
Try it:
Open the IDE Source-Mainfile in jaPBe and start the Cutter-Plugin...
Haven't tried it yet, but I may ;)

On a related note: How come I've never heard of jaPBe? This is exactly what I've been looking for! Although I just started using it today, it seems like this should be the official IDE. Very nice! Extremely customizable...

Well, done, everyone. I didn't notice if it has foldable procedures, but that's about the only addition I can think of (other than combining the features of Visual Designer into it, as mentioned in another thread).

Good work, guys!
Russell
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Amiga5k wrote:
GPI wrote:
Amiga5k wrote:GPI, it seems like everything is a bad idea to you...
Try it:
Open the IDE Source-Mainfile in jaPBe and start the Cutter-Plugin...
Haven't tried it yet, but I may ;)

On a related note: How come I've never heard of jaPBe?
Look more in the annoucment-thread...

>I didn't notice if it has foldable procedures, but that's about the only
>addition I can think of (other than combining the features of Visual
>Designer into it, as mentioned in another thread).

Now i don't know, what you mean. jaPBe can fold procedures, enumerations, structures, and so on. And you can set own fold-marks with
";{"
and
";}"

btw: Combinations are possibil: ";{- Bookmark and foldstart."
Amiga5k
Enthusiast
Enthusiast
Posts: 329
Joined: Fri Apr 25, 2003 8:57 pm

Post by Amiga5k »

Yep. About one minute after I sent that reply I discovered the folding feature.

So this is based on Scintilla? Looks as feature rich as CodeMax to me. :)

Russell
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Amiga5k wrote:So this is based on Scintilla?
Yes, but i don't understand full the lexer/folding-feature, so i use the routines in a way, which wasn't designd for.
Post Reply