Prestachopo Posted May 5, 2011 Share Posted May 5, 2011 Why? Really why?The entire code it's fantastic, OOP it's great in Prestashop, very nice and clean work, you want alter a Customer to add a new Field? it's really simply, edit class Customer.php, add Field in code (getFields()), validation, definition, and finally in MySQL to alter the customer table, now the class ObjectModel can manipulate for you but... Why not use the coding standars? why!?I hate TABS, it's dirty, and make your code dancing between left and right, use 2 spaces instead TABS please!All conditional statements have no start/end key, how you can compare this two code snippets!? $cookie = new Cookie('ps'); if (!$cookie->isLogged() AND !Tools::getValue('secure_key')) Tools::redirect('authentication.php?back=pdf-invoice.php'); if (!(int)(Configuration::get('PS_INVOICE'))) die(Tools::displayError('Invoices are disabled in this shop.')); if (isset($_GET['id_order']) AND Validate::isUnsignedId($_GET['id_order'])) $order = new Order((int)($_GET['id_order'])); if (!isset($order) OR !Validate::isLoadedObject($order)) die(Tools::displayError('Invoice not found')); elseif ((isset($cookie->id_customer) AND $order->id_customer != $cookie->id_customer) OR (Tools::isSubmit('secure_key') AND $order->secure_key != Tools::getValue('secure_key'))) die(Tools::displayError('Invoice not found')); elseif (!OrderState::invoiceAvailable($order->getCurrentState()) AND !$order->invoice_number) die(Tools::displayError('No invoice available')); else PDF::invoice($order); $cookie = new Cookie('ps'); if (!$cookie->isLogged() AND !Tools::getValue('secure_key')) { Tools::redirect('authentication.php?back=pdf-invoice.php'); } if (!(int)(Configuration::get('PS_INVOICE'))) { die(Tools::displayError('Invoices are disabled in this shop.')); } if (isset($_GET['id_order']) AND Validate::isUnsignedId($_GET['id_order'])) { $order = new Order((int)($_GET['id_order'])); } if (!isset($order) OR !Validate::isLoadedObject($order)) { die(Tools::displayError('Invoice not found')); } elseif ((isset($cookie->id_customer) AND $order->id_customer != $cookie->id_customer) OR (Tools::isSubmit('secure_key') AND $order->secure_key != Tools::getValue('secure_key'))) { die(Tools::displayError('Invoice not found')); } elseif (!OrderState::invoiceAvailable($order->getCurrentState()) AND !$order->invoice_number) { die(Tools::displayError('No invoice available')); } else { PDF::invoice($order); } With which of the two examples you would you choose? please be honest.Save a few lines of code is for fools. The PHP engine is capable of processing thousands of lines per second, you really think that saving a few keys can improve performance? So if you do not improve performance, why not put them to have a more clear and understandable code?Some editors (many!) use the start { and end } keys to hightlight and remark and make the life more easy...If you edit many files in Prestashop maybe find lines long more than 160 chars!! OMG!Please, make Prestashop project best for the comunity, use coding standars to make the developers comunity more efficient and easy, don't break the rules, please see Coding Standars Please developers, consider the option of applying coding standars to make Prestashop really rich.Please, think in many developers that make Prestashop project a beautiful place.Best regards. Link to comment Share on other sites More sharing options...
Thomas Didierjean Posted May 5, 2011 Share Posted May 5, 2011 Some of the coding standards used by PrestaShop have been here for a long time, and some of them should probably have been different, but as a result the code base is (mostly) consistent. We recently added more strict coding standards, and we are changing parts of the existing code. But sometimes it's just not worth it to change thousands of lines to make it prettier.As for the 160+ long lines, we are definitly working on removing them. Link to comment Share on other sites More sharing options...
Prestachopo Posted May 5, 2011 Author Share Posted May 5, 2011 It's so dificult change a path from the beginning but you can turn left or right in any moment, the problem will be if you still walking in same direction and never change.Many thanks, I understand that many lines, thousands, it's so dificult to change and a lot of work that can be wasted to implement new functions better than check same functions in diferent syntax.Really many thanks, the comunity can help the developer team if you think that only one user apply coding standards to one file like Drupal Coding Standards, think you if many users do that too, the problem dissapear quickly .Best regards. Link to comment Share on other sites More sharing options...
SoftwarePearls Posted May 25, 2011 Share Posted May 25, 2011 While the OP is ranting a bit, I totally agree with this core point: you guys need to improve your code quality. It will improve your product in the long run! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now