Skip to content

Naming conventions #17

Open
frankmullenger opened this Issue Jul 2, 2012 · 2 comments

2 participants

@frankmullenger

We should discuss naming conventions a little bit and aim to have them tidied up for mid term. At the moment we have things like:

Payment_Gateway living in Gateway.php
then
PayPal_Gateway extends Payment_Gateway
and
PayPalDirect_Gateway extends PayPal_Gateway
PayPalExpress_Gateway "

DummyGatewayHosted_Gateway extends Payment_Gateway
DummyMerchantHosted_Gateway extends Payment_Gateway

I think it would be best to try and stick to the convention of filename being the prefix for the class names in that file e.g:

PaymentGateway.php has classes PaymentGateway_*
PayPal.php has classes PayPal_*
etc.

I'm also happy to reconsider naming Payment_Controller to PaymentProcessor and for consistency maybe we should have
Payment.php -> Payment
PaymentGateway.php -> PaymentGateway
PaymentProcessor.php -> PaymentProcessor

And perhaps adding another class to encapsulate the model/controller/gateway instantiation instead of using a static factory method like:
PaymentFactory.php -> PaymentFactory

Which could take care of retrieving supported payment methods and creating the payment controller with model and gateway injected.

@wilr
SilverStripe Labs member
wilr commented Jul 7, 2012

If you're thinking about making payment support 3.0 only I'd also suggest looking into PHP namespaces. We haven't made much use of them in core yet but 3.1 will use them.

@frankmullenger

Cheers Will, good to know. We'll start looking into namespaces soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.