Modularity - Users and UserProfile controllers

Shad Laws <shad-xpYdmXCiSuZWk0Htik3J/[email protected]> Sat, 11 May 2013 19:31:12 +0200
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CA+z51A6DUCz=tXj=ridE3A3vh-FiH-7=6buJov07RQB_kSdNyQ@mail.gmail.com>
--===============8338472458371254008==
Content-Type: multipart/alternative; boundary=047d7b343c6692925e04dc74a75d

--047d7b343c6692925e04dc74a75d
Content-Type: text/plain; charset=UTF-8

Hey everyone,

I just finished converting the user/group-related controllers and forms
over to Formo, and found that the view used in
Controller_UserProfile::action_show() (gallery module) has URLs to things
in Controller_Users (user module)... which seems like a breach of
modularity.

Right now, we have:
[user module]
class Controller_Users extends User_Controller_Users {}
class User_Controller_Users {
  public function action_edit();
  public function action_change_email();
  public function action_change_password();
}
[gallery module]
class Controller_UserProfile extends Gallery_Controller_UserProfile {}
class Gallery_Controller_UserProfile {
  public function action_show();
  public function action_contact();
}

My thought:
- in the gallery module, change Controller_UserProfile to make it an
abstract class in IdentityProvider.
- add three abstract action functions that reflect the three links it wants.
- in the user module, make Controller_UserProfile extend the abstract class
in Gallery.

Then, we'd have something like:
[user module]
class Controller_Users extends User_Controller_Users {}
class User_Controller_Users extends IdentityProvider_Controller_Users {
  public function action_edit();
  public function action_change_email();
  public function action_change_password();
}
[gallery module]
abstract class IdentityProvider_Controller_Users extends
Gallery_IdentityProvider_Controller_Users {}
abstract class Gallery_IdentityProvider_Controller_Users {
  public function action_show();
  public function action_contact();
  abstract public function action_edit();
  abstract public function action_change_email();
  abstract public function action_change_password();
}

Thoughts?

Take care,
Shad

--047d7b343c6692925e04dc74a75d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hey everyone,<div><br></div><div style>I just finished con=
verting the user/group-related controllers and forms over to Formo, and fou=
nd that the view used in Controller_UserProfile::action_show() (gallery mod=
ule) has URLs to things in Controller_Users (user module)... which seems li=
ke a breach of modularity.</div>

<div style><br></div><div style>Right now, we have:</div><div><font face=3D=
"courier new, monospace">[user module]<br></font></div><div><font face=3D"c=
ourier new, monospace">class Controller_Users extends User_Controller_Users=
 {}</font></div>

<div><font face=3D"courier new, monospace">class User_Controller_Users {<br=
></font></div><div><div><font face=3D"courier new, monospace">=C2=A0 public=
 function action_edit();</font></div><div><font face=3D"courier new, monosp=
ace">=C2=A0 public function action_change_email();</font></div>

<div><font face=3D"courier new, monospace">=C2=A0 public function action_ch=
ange_password();</font></div><div><font face=3D"courier new, monospace">}</=
font></div></div><div style><font face=3D"courier new, monospace">[gallery =
module]</font></div>

<div><font face=3D"courier new, monospace">class Controller_UserProfile ext=
ends=C2=A0Gallery_Controller_UserProfile=C2=A0{}</font></div><div style><fo=
nt face=3D"courier new, monospace">class Gallery_Controller_UserProfile {<b=
r></font></div>

<div style><font face=3D"courier new, monospace">=C2=A0 public function act=
ion_show();</font></div><div style><font face=3D"courier new, monospace">=
=C2=A0 public function action_contact();</font></div><div style><font face=
=3D"courier new, monospace">}</font></div>

<div style><br></div><div style>My thought:<br></div><div style>- in the ga=
llery module, change Controller_UserProfile to make it an abstract class in=
 IdentityProvider.</div><div style>- add three abstract action functions th=
at reflect the three links it wants.</div>

<div style>- in the user module, make Controller_UserProfile extend the abs=
tract class in Gallery.</div><div style><br></div><div style>Then, we&#39;d=
 have something like:</div><div style><div><div><font face=3D"courier new, =
monospace">[user module]<br>

</font></div><div><font face=3D"courier new, monospace">class Controller_Us=
ers extends User_Controller_Users {}</font></div><div><font face=3D"courier=
 new, monospace">class User_Controller_Users extends IdentityProvider_Contr=
oller_Users {</font></div>

<div><div><font face=3D"courier new, monospace">=C2=A0 public function acti=
on_edit();</font></div><div><font face=3D"courier new, monospace">=C2=A0 pu=
blic function action_change_email();</font></div><div><font face=3D"courier=
 new, monospace">=C2=A0 public function action_change_password();</font></d=
iv>

<div><font face=3D"courier new, monospace">}</font></div></div></div><div><=
font face=3D"courier new, monospace">[gallery module]</font></div><div><fon=
t face=3D"courier new, monospace">abstract class IdentityProvider_Controlle=
r_Users extends Gallery_IdentityProvider_Controller_Users {}</font></div>

<div><font face=3D"courier new, monospace">abstract class Gallery_IdentityP=
rovider_Controller_Users=C2=A0{<br></font></div><div><font face=3D"courier =
new, monospace">=C2=A0 public function action_show();</font></div><div><fon=
t face=3D"courier new, monospace">=C2=A0 public function action_contact();<=
/font></div>

<div><font face=3D"courier new, monospace">=C2=A0 abstract public function =
action_edit();</font></div><div><font face=3D"courier new, monospace">=C2=
=A0=C2=A0abstract=C2=A0public function action_change_email();</font></div><=
div><font face=3D"courier new, monospace">=C2=A0=C2=A0abstract=C2=A0public =
function action_change_password();</font></div>

<div><font face=3D"courier new, monospace">}</font></div><div><br></div><di=
v style>Thoughts?</div><div style><br></div><div style>Take care,<br></div>=
<div style>Shad</div></div></div>

--047d7b343c6692925e04dc74a75d--


--===============8338472458371254008==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
--===============8338472458371254008==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]
--===============8338472458371254008==--