04: FINDing your Way Around

This is a temporary forum setup for the purpose of discussing the EMC standards
Locked
Nuttzy99
Registered User
Posts: 927
Joined: Fri Aug 03, 2001 7:09 am
Contact:

Re: 04: FINDing your Way Around

Post by Nuttzy99 »

A_Jelly_Doughnut wrote:Not it is clear except for one thing.
A find for this:

Code: Select all

$sql = "INSERT INTO" WHERE
would be valid? It seems that someone posted this, and called it valid. (I know it isn't unique).
First this is wrong b/c WHERE needs to be on its own line just as it probably does in the phpBB source. Second, unless this is the only INSERT statement in the entire file then this is wrong b/c it is not unique enough. Lastly even if it is the only INSERT then you should really consider making it more unique. Perhaps don't even use the start of the line, but instead use a field being assigned its value. Ideally you want to use something that is not likely to be changed even if the line is repeatedly modified. Something that will always be there.

-Nuttzy :cool:
SpellingCow.com - Free spell check service for your forums or any web form!
My Other Site

Nuttzy99
Registered User
Posts: 927
Joined: Fri Aug 03, 2001 7:09 am
Contact:

Re: 04: FINDing your Way Around

Post by Nuttzy99 »

One thing I need to say is that I have nothing against comments, I encourage them, and I use them in my own code. I'm against inserting duplicate code (although commented) back into the source. This is screwing up the "map". Regular comments that exist in phpBB or that are added by MODs (the kind that explain what the source is doing) are not a problem. They are also part of the map and belong there. The comments GP suggest are no problem.

The practice of creating duplicate code and artificially screwing up the "map" by inserting bogous "landmarks" is the problem. But I'm willing to make a workaround. Simply adding a few standard characters at the start of a // or at the start and end of a /* */ will do the trick. For example /*-EM and EM-*/ I don't think this is a big compromise. I am trying to compromise to allow your unique style.

As for FIND vs. IN-LINE FIND, the idea is that FIND is for something that is very unique, keying on something appearing only once in the file or in a particular order, and IN-LINE FIND is much less specific, only needing to be unique on the line or the first occurence on the line.

BTW, last time I checked the "split" feature wasn't working in 2.2 yet or else I would have split this into a new topic ;)

EDIT: just added a little bolding :P

-Nuttzy :cool:
Last edited by Nuttzy99 on Fri Sep 05, 2003 3:07 am, edited 1 time in total.
SpellingCow.com - Free spell check service for your forums or any web form!
My Other Site

User avatar
-=ET=-
Registered User
Posts: 214
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: 04: FINDing your Way Around

Post by -=ET=- »

Ptirhiik wrote:How could I agree with this :
Comments not managed by EM must not be allowed!
Hopefully, phpBB original files are full of comments...
Sure Ptirhiik but your're playing on words here.
My post was just a very short summary of my opinion to support Nuttzy but I'm sure you perfectly understand what I meant with the sentence.

The comments I was talking about was code line ones. The only one that can cause confusion for EM if a FIND command find them instead of the right code lines.

I'm sure you have understand that but it should have been too long for me to re-explain all Nuttzy has perfectly said on 4 pages and on which I totally agree.

Code line comments are possible but only if EM knows how to manage these lines; not if it may confuse its FIND command :wink:

Ptirhiik
Registered User
Posts: 144
Joined: Sun Apr 06, 2003 12:29 pm

Re: 04: FINDing your Way Around

Post by Ptirhiik »

At this time, I'm perfectly sure the [ MUTE ] command will have to born, as it is a need in order to prevent functional comflict and be able to step back (evolution of version, phpBB or mods), and I'm perfectly sure easymod will have to check if a line is a commented one and ignore it if the find isn't itself a comment. The limit will certainly be the ability to determine a block of line is commented with /* */, as it could issue for many reason, but the use of this is very rare in mods, were // is very common.

Now not only muted lines can issue : a simple comment like :
//-- mod toto
// here we added
// , posts
// after
// , topic, title
will issue with find on ", topic, title" (which can be a perfect unique fragment). I bet you will considered this comment as not allowed by easymod, ET, by my side I will just say bravo to the mod author using it, as it will really ease my life if I add to upgrade phpBB version, or the mod in a full reliable way, track a functional comflict between two mods, or simply being curious.

Also, somewhere you have to consider being able to reconstruct the mod only by analysing the script is preciasly what will be needed to uninstall a mod, at hand or automaticely. There we are talking another time of quality, not ability.

Be sure I am not playing, on words or something else : I just take this very seriously, as it is designed to impact a maximum of people, and an impressive number of boards, and I certainly not consider this as a game ("oh sorry for your board, you loosed, try again").

User avatar
GPHemsley
Registered User
Posts: 1617
Joined: Fri Apr 18, 2003 4:01 am
Location: Long Beach, NY
Contact:

Re: 04: FINDing your Way Around

Post by GPHemsley »

Honestly, Ptirhiik, what's the point of those muted lines? They're redundant for EasyMOD, as EasyMOD makes backups which will be automatically restorable and the uninstallation feature will be here soon. And for a hand-MODded forum, the owner should have made their own backups. IMO, there is no need to include the unedited code right above the edited code. :?

User avatar
-=ET=-
Registered User
Posts: 214
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: 04: FINDing your Way Around

Post by -=ET=- »

Ptirhiik wrote:I bet you will considered this comment as not allowed by easymod, ET, by my side I will just say bravo to the mod author using it
GPHemsley wrote:IMO, there is no need to include the unedited code right above the edited code. :?
IMO Ptirhiik, you can manually or by instructions add ANY comments you want, except original code lines duplicated in comments!
This MUST be standardized and manage by EM in oder to let it know which lines it must skip in its find.
That's all I said, and that's I think, Nuttzy's point of view too.

"unedited code right above the edited code" can be add for any reason such as uninstallation if you want (I have no real opinion yet about that), but EM must manage/create these lines in order to be able to know how to manage them, and no body else.
Eternal newbie

Nuttzy99
Registered User
Posts: 927
Joined: Fri Aug 03, 2001 7:09 am
Contact:

Re: 04: FINDing your Way Around

Post by Nuttzy99 »

Ptirhiik, I disagree about the MUTE command and I think you know my reasons why by now ;)

Now then, let's address the is_auth example you had come up with. I am probably missing something you were trying to explain so if you were to address this issue yet one last time I will be sure to give it a thoughtful reply.

Thanks,
-Nuttzy :cool:
SpellingCow.com - Free spell check service for your forums or any web form!
My Other Site

Ptirhiik
Registered User
Posts: 144
Joined: Sun Apr 06, 2003 12:29 pm

Re: 04: FINDing your Way Around

Post by Ptirhiik »

> GP : we have already discuss of the uninstall process at phpBB.com, and I think I have proved than no way was 100% reliable (even 75% I will say) with an automatic process. From there, you have to give the user the ability to achieve it by hand, and this doesn't concern only the last mod applied (that's for backups).

> Nuttzy : really, I can only requote what I wrote : you have actually in the jumpbox func (functions.php) some lines commented, managing the auth for the jumpbox and allowing to add private forums in it.

A mod more advanced than the phpBB func comes on it, add the auth search, but the line can't take place where the commented ones are (why not ? It is the author choice and the mod requirement). As there is no need to touch the original code, it remains unchanged, and then the final state is a commented line, and a new line non commented similar, later in the code. Then another mod comes, and have to modify this added part. It will issue to the first commented line if you doesn't consider the line is commented (error a hand-user won't do). Not a big deal you gonna say, just add the previous line to the find. Result : you have artificialy raised up the required stuff for find rather than decreasing it, and you are not sure at end you won't get to the line expected (as this can be repeated). More : this is a silent issue : even if the same line take place further in the file, in another function, you will never be able to reach it, and easymod won't complain. It will just say all is okay, although a human doing it won't certainly do the same mistake. The worst is it would be certainly very difficult to track and fix, even for an advanced user.

IMO :

Code: Select all

#---[ FIND ]----
// $is_auth =
is unique, and

Code: Select all

#---[ FIND ]-----
$is_auth =
is also unique, and doesn't adress the same line at all.

You can link this to the consider a find shouldn't achieve on an explicit commented line, as long as the find statement itself doesn't include the comment tag ( // ). You will be so able to handle quite all states of code.

The [MUTE] is only there to avoid a replace-by-nothing deleting the original code (loosing the ability to step back), and falls in the case of explicite commented line rather than using /* */ which would be much more difficult to track (it will require to analyse the way the code will run) : it is not the same discussion, although it is linked.


And at the end, you guys are explaining me I can't set the comments I want to appear in the scripts (whatever they are), and that of course can't be accepted from my programmer's point of view. Comments through a developpement is the first indicator of the quality of this developpement : I won't trust a script without any comments, and my first move is to add the missing comments in order to find the logical bugs that are everytime presents in those kind of scripts, and believe me, I have always found some in those cases, even on my own scripts.

User avatar
GPHemsley
Registered User
Posts: 1617
Joined: Fri Apr 18, 2003 4:01 am
Location: Long Beach, NY
Contact:

Re: 04: FINDing your Way Around

Post by GPHemsley »

Nobody's saying not to add comments to your script. By all means add as many comments as you want to describe what each step does. But the large commented code that you provide has no use to anyone browsing the code looking to fix an error or modify something to suit their needs. The only reason for it is to provide the existing code for uninstallation.

There are two reasons why this is not needed:
1) There are already multiple methods to automatically go back to a previous state.
2) If someone wants to uninstall by hand, all they have to do is run your MOD backwards.

User avatar
-=ET=-
Registered User
Posts: 214
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: 04: FINDing your Way Around

Post by -=ET=- »

GPHemsley wrote:But the large commented code that you provide has no use to anyone browsing the code looking to fix an error or modify something to suit their needs. The only reason for it is to provide the existing code for uninstallation.
I wouldn't say that. Anyone may find an utility (not me but some can), but EM needs to standadize and manage itself this comments.
It can't be add in the MOD instructions as it will cause troubles to EN FIND commands. That's all for me.
Eternal newbie

Locked