Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Wikitech

Will the frontend ever use the API, itself?

 

 

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded


jra at baylink

Aug 20, 2008, 12:24 PM

Post #1 of 24 (1354 views)
Permalink
Will the frontend ever use the API, itself?

On Wed, Aug 20, 2008 at 11:58:39AM -0700, Brion Vibber wrote:
> The way it _should_ be working is something like this:
>
> 1) There's a backend ("controller") class for performing edits. This has
> hook points for things like aborting or altering edits (spam checks,
> captcha, etc)
>
> 2) There's a frontend ("view") class for handling the HTML edit form.
> This has hook points for customizing the form output, checking custom
> input, and presenting UI for error conditions ("you hit spam!" or "you
> need to submit this extra form")
>
> 3) There's another frontend ("view") class for handling the API's edit
> interface. This _might_ also have hook points for handling special
> input/output and custom error formatting, though _ideally_ such stuff
> should be able to use existing I/O channels specified in the API (spam
> hit just raises an error conditions; captcha hits have an existing
> channel for saying "show this and respond to it").
>
>
> Currently the EditPage class mixes a fair chunk of backend and UI, as do
> the edit filter hooks for spam blacklisting, CAPTCHAs, etc, so it's a
> bit icky. There's been some refactoring in the course of creating the
> edit API (as there was much refactoring to Special:Userlogin when the
> API's login modules were being created), but it remains incomplete.

So the obvious followup question is: is there a plan to migrate the
front end to *use the API* to talk to the backend (which is the
preferred approach to such things anyway)?

Cheers,
-- jra
--
Jay R. Ashworth Baylink jra [at] baylink
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274

Those who cast the vote decide nothing.
Those who count the vote decide everything.
-- (Josef Stalin)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Simetrical+wikilist at gmail

Aug 20, 2008, 1:01 PM

Post #2 of 24 (1327 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Wed, Aug 20, 2008 at 3:24 PM, Jay R. Ashworth <jra [at] baylink> wrote:
> So the obvious followup question is: is there a plan to migrate the
> front end to *use the API* to talk to the backend (which is the
> preferred approach to such things anyway)?

One practical issue with this at present is that nobody who does much
of anything with core does much of anything with the API. I've barely
looked at it at all.

As a more philosophical thing, there's no reason for the human UI to
call the API. We should have a back-end, and then two interfaces to
that: one designed for external robots, and one designed for
HTML-viewing humans. Both of the interfaces should use the internal
PHP interface to speak to the back-end. The API operates in a format
that's suitable for robots to use, not suitable for internal code to
use.

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


roan.kattouw at home

Aug 20, 2008, 1:20 PM

Post #3 of 24 (1328 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Aryeh Gregor schreef:
> On Wed, Aug 20, 2008 at 3:24 PM, Jay R. Ashworth <jra [at] baylink> wrote:
>
>> So the obvious followup question is: is there a plan to migrate the
>> front end to *use the API* to talk to the backend (which is the
>> preferred approach to such things anyway)?
>>
>
> One practical issue with this at present is that nobody who does much
> of anything with core does much of anything with the API. I've barely
> looked at it at all.
>
True. Actually, there's a pattern of isolation here. While pretty much
all developers are familiar with the 'core' classes (Title, Article,
Revision, etc.), very few are familiar with isolated ones such as the
parser, the API, the image handling code, the Database abstraction layer
(except for select() and similar functions)
> As a more philosophical thing, there's no reason for the human UI to
> call the API. We should have a back-end, and then two interfaces to
> that: one designed for external robots, and one designed for
> HTML-viewing humans. Both of the interfaces should use the internal
> PHP interface to speak to the back-end. The API operates in a format
> that's suitable for robots to use, not suitable for internal code to
> use.
Simetrical is right here: the UI and the API call the same functions,
and display the results in different ways. That's exactly why there's no
sense in migrating the front end to the API (and that's just forgetting
about the HTTP overhead involved).

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


wilson.jim.r at gmail

Aug 21, 2008, 11:52 AM

Post #4 of 24 (1320 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Jay said:
> So the obvious followup question is: is there a plan to migrate the
> front end to *use the API* to talk to the backend (which is the
> preferred approach to such things anyway)?

There are times when utilizing the API programatically could make
extension development much easier. The last time I looked at the API
certain things were hard coded (such as bot limits - yuck) which made
it tough/impossible to use in certain extension scenarios. I believe
these have been corrected though, so it's probably a good resource for
certain classes of extensions.

Someone familiar with the core could always construct a proper
$dbr->select() querys, but it would be easier (read: less code) in
some cases to let the API classes handle it.

-- Jim R. Wilson (jimbojw)

On Wed, Aug 20, 2008 at 3:20 PM, Roan Kattouw <roan.kattouw [at] home> wrote:
> Aryeh Gregor schreef:
>> On Wed, Aug 20, 2008 at 3:24 PM, Jay R. Ashworth <jra [at] baylink> wrote:
>>
>>> So the obvious followup question is: is there a plan to migrate the
>>> front end to *use the API* to talk to the backend (which is the
>>> preferred approach to such things anyway)?
>>>
>>
>> One practical issue with this at present is that nobody who does much
>> of anything with core does much of anything with the API. I've barely
>> looked at it at all.
>>
> True. Actually, there's a pattern of isolation here. While pretty much
> all developers are familiar with the 'core' classes (Title, Article,
> Revision, etc.), very few are familiar with isolated ones such as the
> parser, the API, the image handling code, the Database abstraction layer
> (except for select() and similar functions)
>> As a more philosophical thing, there's no reason for the human UI to
>> call the API. We should have a back-end, and then two interfaces to
>> that: one designed for external robots, and one designed for
>> HTML-viewing humans. Both of the interfaces should use the internal
>> PHP interface to speak to the back-end. The API operates in a format
>> that's suitable for robots to use, not suitable for internal code to
>> use.
> Simetrical is right here: the UI and the API call the same functions,
> and display the results in different ways. That's exactly why there's no
> sense in migrating the front end to the API (and that's just forgetting
> about the HTTP overhead involved).
>
> Roan Kattouw (Catrope)
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l [at] lists
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


innocentkiller at gmail

Aug 21, 2008, 12:09 PM

Post #5 of 24 (1320 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Thu, Aug 21, 2008 at 2:52 PM, Jim R. Wilson <wilson.jim.r [at] gmail> wrote:
> Jay said:
>> So the obvious followup question is: is there a plan to migrate the
>> front end to *use the API* to talk to the backend (which is the
>> preferred approach to such things anyway)?
>
> There are times when utilizing the API programatically could make
> extension development much easier. The last time I looked at the API
> certain things were hard coded (such as bot limits - yuck) which made
> it tough/impossible to use in certain extension scenarios. I believe
> these have been corrected though, so it's probably a good resource for
> certain classes of extensions.
>
> Someone familiar with the core could always construct a proper
> $dbr->select() querys, but it would be easier (read: less code) in
> some cases to let the API classes handle it.
>
> -- Jim R. Wilson (jimbojw)
>
> On Wed, Aug 20, 2008 at 3:20 PM, Roan Kattouw <roan.kattouw [at] home> wrote:
>> Aryeh Gregor schreef:
>>> On Wed, Aug 20, 2008 at 3:24 PM, Jay R. Ashworth <jra [at] baylink> wrote:
>>>
>>>> So the obvious followup question is: is there a plan to migrate the
>>>> front end to *use the API* to talk to the backend (which is the
>>>> preferred approach to such things anyway)?
>>>>
>>>
>>> One practical issue with this at present is that nobody who does much
>>> of anything with core does much of anything with the API. I've barely
>>> looked at it at all.
>>>
>> True. Actually, there's a pattern of isolation here. While pretty much
>> all developers are familiar with the 'core' classes (Title, Article,
>> Revision, etc.), very few are familiar with isolated ones such as the
>> parser, the API, the image handling code, the Database abstraction layer
>> (except for select() and similar functions)
>>> As a more philosophical thing, there's no reason for the human UI to
>>> call the API. We should have a back-end, and then two interfaces to
>>> that: one designed for external robots, and one designed for
>>> HTML-viewing humans. Both of the interfaces should use the internal
>>> PHP interface to speak to the back-end. The API operates in a format
>>> that's suitable for robots to use, not suitable for internal code to
>>> use.
>> Simetrical is right here: the UI and the API call the same functions,
>> and display the results in different ways. That's exactly why there's no
>> sense in migrating the front end to the API (and that's just forgetting
>> about the HTTP overhead involved).
>>
>> Roan Kattouw (Catrope)
>>
>> _______________________________________________
>> Wikitech-l mailing list
>> Wikitech-l [at] lists
>> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>>
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l [at] lists
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>

PrefixSearch does it (around line 130).

-Chad

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


roan.kattouw at home

Aug 21, 2008, 12:11 PM

Post #6 of 24 (1322 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Jim R. Wilson schreef:
> Jay said:
>
>> So the obvious followup question is: is there a plan to migrate the
>> front end to *use the API* to talk to the backend (which is the
>> preferred approach to such things anyway)?
>>
>
> There are times when utilizing the API programatically could make
> extension development much easier. The last time I looked at the API
> certain things were hard coded (such as bot limits - yuck) which made
> it tough/impossible to use in certain extension scenarios. I believe
> these have been corrected though, so it's probably a good resource for
> certain classes of extensions.
>
> Someone familiar with the core could always construct a proper
> $dbr->select() querys, but it would be easier (read: less code) in
> some cases to let the API classes handle it.
Calling the API from within MW (or extensions) can be done using the
FauxRequest class. This also makes the API ignore the maximum limit, so
you can set limit parameters to whatever you like (not to infinity,
however). This feature is documented at [1].

Roan Kattouw (Catrope)

[1] http://www.mediawiki.org/wiki/API:Calling_internally

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Simetrical+wikilist at gmail

Aug 21, 2008, 2:10 PM

Post #7 of 24 (1319 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Thu, Aug 21, 2008 at 2:52 PM, Jim R. Wilson <wilson.jim.r [at] gmail> wrote:
> There are times when utilizing the API programatically could make
> extension development much easier. The last time I looked at the API
> certain things were hard coded (such as bot limits - yuck) which made
> it tough/impossible to use in certain extension scenarios. I believe
> these have been corrected though, so it's probably a good resource for
> certain classes of extensions.
>
> Someone familiar with the core could always construct a proper
> $dbr->select() querys, but it would be easier (read: less code) in
> some cases to let the API classes handle it.

That's functionality that the backend should provide, not the API. At
least IMO. The API is primarily a bot interface, not a PHP interface.
Trying to use it as a PHP interface as well will require a lot of
contortions, since there are fundamental differences between the
desirable traits of each type of interface:

* The level of access that bots and scripts can have. Bots get
carefully limited access, while extensions have unlimited read/write
access. This means that if the API is primarily targeted at bots, it
will have limited write access, and *very* limited support for
administrative functions that extensions may very well want to invoke.
For instance, the userrights module was removed on principle, last I
checked, as something that we didn't need the security risks of given
that bots are unlikely to ever need to change user rights.
* The format of access. Bots use HTTP requests, while extensions use
direct function calls. HTTP requests are text-only, and consist of
one of a very small number of filenames plus an arbitrary associative
array mapping string parameters to string values. Function calls
support a rich variety of data types, and consist of any of a
potentially very large number of individual functions plus a small,
fixed ordered list of parameters. Trying to shoehorn one access
format into another will require contortions like FauxRequest.
* The cost of access. HTTP requests have very high overhead -- set up
network connection, pass request through a long chain of servers and
processes, send result back -- usually on the order of a hundred
milliseconds or more. Function calls have very low overhead, without
even a context switch: likely well under a microsecond. Moreover,
HTTP requests are stateless, while a function-call-based interface can
maintain extremely rich state. These push the format and nature of a
bot API in a very different direction from that of an extension API.
A bot API will tend to encourage a small number of elaborate requests,
because the state must be built on every request. A good extension
API, on the other hand, allows many small function calls, reusing
state (such as already-initialized objects) as often as possible, with
each function doing one thing. Again, these cannot be cleanly
reconciled.

Although I'm not an extension author, and you are, I don't *think* you
want to use the API, now or ever. I think what you want is a clean
separation between backend and frontend. You should then be able to
call the backend functions directly, and they'll provide you with
clean functionality like "perform an edit by this User object to this
section number of this Article object with this text, with(out) usual
permission checks, returning an easily-parsed array of errors and
warnings if any occur".

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


jra at baylink

Aug 21, 2008, 2:59 PM

Post #8 of 24 (1319 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Wed, Aug 20, 2008 at 04:01:14PM -0400, Aryeh Gregor wrote:
> On Wed, Aug 20, 2008 at 3:24 PM, Jay R. Ashworth <jra [at] baylink> wrote:
> > So the obvious followup question is: is there a plan to migrate the
> > front end to *use the API* to talk to the backend (which is the
> > preferred approach to such things anyway)?
>
> As a more philosophical thing, there's no reason for the human UI to
> call the API.

Sure there is. Jon Bentley is wrong?

> We should have a back-end, and then two interfaces to
> that: one designed for external robots, and one designed for
> HTML-viewing humans. Both of the interfaces should use the internal
> PHP interface to speak to the back-end. The API operates in a format
> that's suitable for robots to use, not suitable for internal code to
> use.

I think we're bandying semantics. There should be one interface to the
core, which provides all the functionality necessary, and one of the
clients to that interface should be the tradtional front end.

It's a design pattern that is well tested and proven... and means you
never have to hear "why can't I access that function from the front
end" again.

It also makes for a cleaner separation of powers from the UI to the
core.

Cheers,
-- jra
--
Jay R. Ashworth Baylink jra [at] baylink
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274

Those who cast the vote decide nothing.
Those who count the vote decide everything.
-- (Josef Stalin)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


jra at baylink

Aug 21, 2008, 3:00 PM

Post #9 of 24 (1321 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Wed, Aug 20, 2008 at 10:20:44PM +0200, Roan Kattouw wrote:
> Simetrical is right here: the UI and the API call the same functions,
> and display the results in different ways. That's exactly why there's no
> sense in migrating the front end to the API (and that's just forgetting
> about the HTTP overhead involved).

Um, we mean different things by "API", clearly.

What I think *you* mean by it is "a thin wrapper over the *actual* API".

Am I wrong?

Cheers,
-- jra
--
Jay R. Ashworth Baylink jra [at] baylink
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274

Those who cast the vote decide nothing.
Those who count the vote decide everything.
-- (Josef Stalin)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


roan.kattouw at home

Aug 21, 2008, 3:01 PM

Post #10 of 24 (1316 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Jay R. Ashworth schreef:
> On Wed, Aug 20, 2008 at 10:20:44PM +0200, Roan Kattouw wrote:
>
>> Simetrical is right here: the UI and the API call the same functions,
>> and display the results in different ways. That's exactly why there's no
>> sense in migrating the front end to the API (and that's just forgetting
>> about the HTTP overhead involved).
>>
>
> Um, we mean different things by "API", clearly.
>
> What I think *you* mean by it is "a thin wrapper over the *actual* API".
>
> Am I wrong?
In MediaWiki speak, the API is api.php . You're probably referring to
the backend functions which *are* used by the UI.

Just to clarify again: the API and the UI call *the same functions*, but
present the results differently. That's why there's *nothing to gain
whatsoever* in letting the UI call the API.

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


jra at baylink

Aug 21, 2008, 3:03 PM

Post #11 of 24 (1318 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Thu, Aug 21, 2008 at 05:10:34PM -0400, Aryeh Gregor wrote:
> * The cost of access. HTTP requests have very high overhead -- set up
> network connection, pass request through a long chain of servers and
> processes, send result back -- usually on the order of a hundred
> milliseconds or more.

As soon as I read this, i realize that indeed, you guys are talking
about "an implementation of an interface to the API", not the actual
thing itself.

An API, by definition, is a declared set of call and response
interfaces to a block of core code, with defined parameter domains and
ranges.

It's not the interfaces you use to *get* to that, be it HTML, REST, or
whosoever...

Cheers,
-- jra
--
Jay R. Ashworth Baylink jra [at] baylink
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274

Those who cast the vote decide nothing.
Those who count the vote decide everything.
-- (Josef Stalin)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


jra at baylink

Aug 21, 2008, 3:05 PM

Post #12 of 24 (1320 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Fri, Aug 22, 2008 at 12:01:53AM +0200, Roan Kattouw wrote:
> Jay R. Ashworth schreef:
> > On Wed, Aug 20, 2008 at 10:20:44PM +0200, Roan Kattouw wrote:
> >> Simetrical is right here: the UI and the API call the same functions,
> >> and display the results in different ways. That's exactly why there's no
> >> sense in migrating the front end to the API (and that's just forgetting
> >> about the HTTP overhead involved).
> >
> > Um, we mean different things by "API", clearly.
> >
> > What I think *you* mean by it is "a thin wrapper over the *actual* API".
> >
> > Am I wrong?
>
> In MediaWiki speak, the API is api.php . You're probably referring to
> the backend functions which *are* used by the UI.
>
> Just to clarify again: the API and the UI call *the same functions*, but
> present the results differently. That's why there's *nothing to gain
> whatsoever* in letting the UI call the API.

If api.php exposes every and only the interfaces already used by the
core code, and the current UI can't cheat and do things api.php does
not expose to the core's state, then yes, my desire and concerns are
satisfied.

Cheers,
-- jra
--
Jay R. Ashworth Baylink jra [at] baylink
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274

Those who cast the vote decide nothing.
Those who count the vote decide everything.
-- (Josef Stalin)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Simetrical+wikilist at gmail

Aug 21, 2008, 3:15 PM

Post #13 of 24 (1315 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Thu, Aug 21, 2008 at 6:03 PM, Jay R. Ashworth <jra [at] baylink> wrote:
> As soon as I read this, i realize that indeed, you guys are talking
> about "an implementation of an interface to the API", not the actual
> thing itself.
>
> An API, by definition, is a declared set of call and response
> interfaces to a block of core code, with defined parameter domains and
> ranges.
>
> It's not the interfaces you use to *get* to that, be it HTML, REST, or
> whosoever...

When we say "API" we mean "bot API", i.e., "a web-based API provided
for third parties to read data from (and possibly write data to) the
wiki in a programmatic fashion, either anonymously or via a user
account". This is in context to the human UI, which is meant to
provide the same functions but to humans, not computer programs. This
is how the term is often used in web contexts these days.

We do *not* mean a programming API, i.e., a set of classes, methods,
and functions that MediaWiki itself and its extensions can call.
That's what we often call the "backend". api.php uses the backend, as
do the usual index.php and other human access methods.

The issue is that historically, the only access to the backend was
through the human UI, or via extensions (but those can always hack
things up by running queries directly and so on). Therefore there was
a lot of careless mixing of UI and backend code. The existence of the
bot API is forcing some of this mixing to be fixed, which incidentally
improves things for extensions too. So the API is incidentally
related to separation of interface logic from business logic -- but
the API itself is supposed to only contain interface logic, for remote
bot access.

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


bryan.tongminh at gmail

Aug 21, 2008, 3:22 PM

Post #14 of 24 (1321 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Fri, Aug 22, 2008 at 12:01 AM, Roan Kattouw <roan.kattouw [at] home> wrote:

> Just to clarify again: the API and the UI call *the same functions*, but
> present the results differently. That's why there's *nothing to gain
> whatsoever* in letting the UI call the API.
>
In theory...

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


wilson.jim.r at gmail

Aug 21, 2008, 11:02 PM

Post #15 of 24 (1307 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

> When we say "API" we mean "bot API", i.e., "a web-based API provided
> for third parties to read data from (and possibly write data to) the
> wiki in a programmatic fashion, either anonymously or via a user
> account".

Ok, so under that strict definition, the answer to the original
question of whether the internal core code would ever use it is
obviously "no". If you define "the API" as including the externalized
HTTP mechanism by which the functionality is accessed, then of course
it makes no sense for core code to use it per all the reasons
previously mentioned. Case closed, points granted. :)

On the other hand, if you consider the supporting PHP classes through
which api.php makes its calls as part of "the API" then I still
contend that there are probably cases where it would be easier or
simpler (or both) to just use it than say construct all the database
queries onesself.

Personally, I'm not enough of a purist to argue for or against making
"all" core code utilize some standard set of classes to encapsulate a
data model, except to say that there are good reasons why MW doesn't
employ an ORM, and those reasons are probably applicable to the
argument against a one-size-fits-all API backend.

-- Jim

On Thu, Aug 21, 2008 at 5:22 PM, Bryan Tong Minh
<bryan.tongminh [at] gmail> wrote:
> On Fri, Aug 22, 2008 at 12:01 AM, Roan Kattouw <roan.kattouw [at] home> wrote:
>
>> Just to clarify again: the API and the UI call *the same functions*, but
>> present the results differently. That's why there's *nothing to gain
>> whatsoever* in letting the UI call the API.
>>
> In theory...
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l [at] lists
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


smolensk at eunet

Aug 21, 2008, 11:51 PM

Post #16 of 24 (1310 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Aryeh Gregor wrote:
> On Thu, Aug 21, 2008 at 2:52 PM, Jim R. Wilson <wilson.jim.r [at] gmail> wrote:
>> There are times when utilizing the API programatically could make
>> extension development much easier. The last time I looked at the API
>
> Although I'm not an extension author, and you are, I don't *think* you
> want to use the API, now or ever. I think what you want is a clean

As an extension author, I can say that in one of my extensions I have
used the API to great satisfaction of everyone :)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


roan.kattouw at home

Aug 22, 2008, 1:40 AM

Post #17 of 24 (1305 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Nikola Smolenski schreef:
> Aryeh Gregor wrote:
>
>> On Thu, Aug 21, 2008 at 2:52 PM, Jim R. Wilson <wilson.jim.r [at] gmail> wrote:
>>
>>> There are times when utilizing the API programatically could make
>>> extension development much easier. The last time I looked at the API
>>>
>> Although I'm not an extension author, and you are, I don't *think* you
>> want to use the API, now or ever. I think what you want is a clean
>>
>
> As an extension author, I can say that in one of my extensions I have
> used the API to great satisfaction of everyone :)
Using the API internally is useful in some cases, yes. If you're gonna
run a complex query the API happens to support, you're usually better
off using the API, to prevent code duplication. But while there are
bound to be places in the code where the API is used internally (which
doesn't have the HTTP overhead I mentioned earlier, my mistake) in the
core, in extensions and even in the API itself, there's no reason for
the core to systematically use the API for everything.

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


dan_the_man at telus

Aug 22, 2008, 2:00 AM

Post #18 of 24 (1307 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

;) And then there are a few of us who get intimate with a fair percent
of the complex and isolated interfaces, enough to scare themselves.
T_T Some time ago, I came to realize that I had actually started to
grasp an understanding of how the Parser worked. The preprocessor as
well. Nearly all my new ParserFunctions use SFH_OBJ_ARGS and some even
do scary things with the frames. When someone asks what function to use
in a hook or a tag to do something with the parser, I actually
understand what part of the parser will best do that for them (Without
needing to trudge around the functions and make a bad guess), and even
worse... T_T I'm actually rewriting a portion of the parser myself...
And I'm starting to make use of parseresque code in my own work.

As for the other, anyone remember my rewrite of the Database class's
titleName method. And my suggestion for a doQuery arg (though that was
changed into a backend function that works with strings).

Actually, I'm building my own Database library. Heh, now that's the
scary portion. I even implemented Brion's idea for a RawSql class (
Trust me ;) it works quite nicely, it even inspired the RawMarkup class
inside of my markup abstraction library (similar to the Xml class))

~Daniel Friesen(Dantman, Nadir-Seen-Fire) of:
-The Nadir-Point Group (http://nadir-point.com)
--It's Wiki-Tools subgroup (http://wiki-tools.com)
--The ElectronicMe project (http://electronic-me.org)
--Games-G.P.S. (http://ggps.org)
-And Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG)
--Animepedia (http://anime.wikia.com)
--Narutopedia (http://naruto.wikia.com)

Roan Kattouw wrote:
> Aryeh Gregor schreef:
>
>> On Wed, Aug 20, 2008 at 3:24 PM, Jay R. Ashworth <jra [at] baylink> wrote:
>>
>>
>>> So the obvious followup question is: is there a plan to migrate the
>>> front end to *use the API* to talk to the backend (which is the
>>> preferred approach to such things anyway)?
>>>
>>>
>> One practical issue with this at present is that nobody who does much
>> of anything with core does much of anything with the API. I've barely
>> looked at it at all.
>>
>>
> True. Actually, there's a pattern of isolation here. While pretty much
> all developers are familiar with the 'core' classes (Title, Article,
> Revision, etc.), very few are familiar with isolated ones such as the
> parser, the API, the image handling code, the Database abstraction layer
> (except for select() and similar functions)
>
>> As a more philosophical thing, there's no reason for the human UI to
>> call the API. We should have a back-end, and then two interfaces to
>> that: one designed for external robots, and one designed for
>> HTML-viewing humans. Both of the interfaces should use the internal
>> PHP interface to speak to the back-end. The API operates in a format
>> that's suitable for robots to use, not suitable for internal code to
>> use.
>>
> Simetrical is right here: the UI and the API call the same functions,
> and display the results in different ways. That's exactly why there's no
> sense in migrating the front end to the API (and that's just forgetting
> about the HTTP overhead involved).
>
> Roan Kattouw (Catrope)
>
_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


roan.kattouw at home

Aug 22, 2008, 2:03 AM

Post #19 of 24 (1309 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Daniel Friesen schreef:
> ;) And then there are a few of us who get intimate with a fair percent
> of the complex and isolated interfaces, enough to scare themselves.
> T_T Some time ago, I came to realize that I had actually started to
> grasp an understanding of how the Parser worked. The preprocessor as
> well. Nearly all my new ParserFunctions use SFH_OBJ_ARGS and some even
> do scary things with the frames. When someone asks what function to use
> in a hook or a tag to do something with the parser, I actually
> understand what part of the parser will best do that for them (Without
> needing to trudge around the functions and make a bad guess), and even
> worse... T_T I'm actually rewriting a portion of the parser myself...
> And I'm starting to make use of parseresque code in my own work.
>
> As for the other, anyone remember my rewrite of the Database class's
> titleName method. And my suggestion for a doQuery arg (though that was
> changed into a backend function that works with strings).
>
> Actually, I'm building my own Database library. Heh, now that's the
> scary portion. I even implemented Brion's idea for a RawSql class (
> Trust me ;) it works quite nicely, it even inspired the RawMarkup class
> inside of my markup abstraction library (similar to the Xml class))
>
You're welcome to help out us API devs, if that's your next step ;)

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


dan_the_man at telus

Aug 22, 2008, 3:02 AM

Post #20 of 24 (1302 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Heh, perhaps... ^_^ Though I'm more likely to do some DB+API evil and
attempt to eliminate all the hardcoded SQL inside of the API.

Though, to say the truth I don't know how well I'd fit in the API. I
honestly have a strong dislike of supporting real old things. While I do
try to keep backwards compatibility in the rest of MediaWiki, there are
many cases where where we break things for the extensions that interact
with the software.
When it comes to my extensions that's a whole strong case. I only
support alpha and the latest stable (well, 1.13 came out, so I might
support 1.12 for a few more months). Actually I have a few real complex
extensions which only support recent versions of 1.14a, but of course
those are special cases using real extreme parts of the parser which
I've actually had to add to the parser myself.
But really, one of my old morales was "Upgrades are for features and
fixes... If you want features, then upgrade. There is no reason to
support a new feature in an old version of the software. If someone
wants the feature, then they can upgrade. It is the same software, it
merely has a different version number and more features."

^_^ Actually, on an unrelated note... I wish I'd stop seeing these
/extensions/.../install.php files. Does anyone not remember that we have
a hook inside of update.php which allows extensions to add new SQL
updates into the update system? ;)

~Daniel Friesen(Dantman, Nadir-Seen-Fire) of:
-The Nadir-Point Group (http://nadir-point.com)
--It's Wiki-Tools subgroup (http://wiki-tools.com)
--The ElectronicMe project (http://electronic-me.org)
--Games-G.P.S. (http://ggps.org)
-And Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG)
--Animepedia (http://anime.wikia.com)
--Narutopedia (http://naruto.wikia.com)

Roan Kattouw wrote:
> Daniel Friesen schreef:
>
>> ;) And then there are a few of us who get intimate with a fair percent
>> of the complex and isolated interfaces, enough to scare themselves.
>> T_T Some time ago, I came to realize that I had actually started to
>> grasp an understanding of how the Parser worked. The preprocessor as
>> well. Nearly all my new ParserFunctions use SFH_OBJ_ARGS and some even
>> do scary things with the frames. When someone asks what function to use
>> in a hook or a tag to do something with the parser, I actually
>> understand what part of the parser will best do that for them (Without
>> needing to trudge around the functions and make a bad guess), and even
>> worse... T_T I'm actually rewriting a portion of the parser myself...
>> And I'm starting to make use of parseresque code in my own work.
>>
>> As for the other, anyone remember my rewrite of the Database class's
>> titleName method. And my suggestion for a doQuery arg (though that was
>> changed into a backend function that works with strings).
>>
>> Actually, I'm building my own Database library. Heh, now that's the
>> scary portion. I even implemented Brion's idea for a RawSql class (
>> Trust me ;) it works quite nicely, it even inspired the RawMarkup class
>> inside of my markup abstraction library (similar to the Xml class))
>>
>>
> You're welcome to help out us API devs, if that's your next step ;)
>
> Roan Kattouw (Catrope)
>
_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


roan.kattouw at home

Aug 22, 2008, 3:06 AM

Post #21 of 24 (1307 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Daniel Friesen schreef:
> Heh, perhaps... ^_^ Though I'm more likely to do some DB+API evil and
> attempt to eliminate all the hardcoded SQL inside of the API.
>
Save your time, it's been eliminated already AFAIK.
> Though, to say the truth I don't know how well I'd fit in the API. I
> honestly have a strong dislike of supporting real old things. While I do
> try to keep backwards compatibility in the rest of MediaWiki, there are
> many cases where where we break things for the extensions that interact
> with the software.
>
Hearing that, the idea of having you as API lead developer does sound
scary (no offense).

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Simetrical+wikilist at gmail

Aug 22, 2008, 7:20 AM

Post #22 of 24 (1302 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

On Fri, Aug 22, 2008 at 2:02 AM, Jim R. Wilson <wilson.jim.r [at] gmail> wrote:
> On the other hand, if you consider the supporting PHP classes through
> which api.php makes its calls as part of "the API" then I still
> contend that there are probably cases where it would be easier or
> simpler (or both) to just use it than say construct all the database
> queries onesself.

Those are what I'm calling the "backend", which is supposed to be
called separately by both the human UI and the bot API. As well as
any extensions.

On Fri, Aug 22, 2008 at 2:51 AM, Nikola Smolenski <smolensk [at] eunet> wrote:
> As an extension author, I can say that in one of my extensions I have
> used the API to great satisfaction of everyone :)

Which one?

On Fri, Aug 22, 2008 at 4:40 AM, Roan Kattouw <roan.kattouw [at] home> wrote:
> Using the API internally is useful in some cases, yes. If you're gonna
> run a complex query the API happens to support, you're usually better
> off using the API, to prevent code duplication.

So why does the API have any logic to do anything except translate the
HTTP query into backend functions and display the results? If you
have a lot of internal logic anywhere, that other callers would like
to use, I suspect that would be best moved into the actual classes
somehow. It's the same as with the human UI: you shouldn't (ideally)
be mixing business logic with logic for a specific output type.

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


smolensk at eunet

Aug 22, 2008, 7:29 AM

Post #23 of 24 (1303 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Aryeh Gregor wrote:
> On Fri, Aug 22, 2008 at 2:51 AM, Nikola Smolenski <smolensk [at] eunet> wrote:
>> As an extension author, I can say that in one of my extensions I have
>> used the API to great satisfaction of everyone :)
>
> Which one?

http://www.mediawiki.org/wiki/Extension:Interlanguage

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


roan.kattouw at home

Aug 24, 2008, 11:25 AM

Post #24 of 24 (1267 views)
Permalink
Re: Will the frontend ever use the API, itself? [In reply to]

Aryeh Gregor schreef:
> On Fri, Aug 22, 2008 at 4:40 AM, Roan Kattouw <roan.kattouw [at] home> wrote:
>
>
>> Using the API internally is useful in some cases, yes. If you're gonna
>> run a complex query the API happens to support, you're usually better
>> off using the API, to prevent code duplication.
>>
>
> So why does the API have any logic to do anything except translate the
> HTTP query into backend functions and display the results? If you
> have a lot of internal logic anywhere, that other callers would like
> to use, I suspect that would be best moved into the actual classes
> somehow. It's the same as with the human UI: you shouldn't (ideally)
> be mixing business logic with logic for a specific output type.
That's probably laziness caused by the fact that the API implementation
predates the code that uses FauxRequest.

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.