We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

The importance of being a professional programmer | Forum

Topic location: Forum home » Support » Oxwall Store
dave Leader
dave May 16 '16
I wanted to write something on this subject because i have had the opportunity over the last few months to see other developers coding style and yes we all have our own style.  A professional can spot his own work anywhere and others that use their products can do the same. It's just like a fingerprint. 


From the way they document internally to the way they write their if statements to the way they name their variables, its all a recognizable style. 


But back to the point here, in the process of helping others either customize certain plugins in minor ways (only if the developer refuses to)  or just guiding them in the right direction. 


I have seen everything from excellence in all areas to totally embarrassing and atrocious coding that has made me want to puke to think they actually had the nerve to ask for money for that trash. 


Now i am not talking about the end result in what the user sees. Although im sure for many that i have seen it certainly does effect that side of things. 


I am talking about internal quality and pride in your craft, to keep it clean, well formatted, easy to follow, documented, and just an overall showing your pride for what you do.  Some do but OMG there are those that are some of the trashiest code "hacks" i have ever seen in my life.   


Here are several examples of what im talking about..   


DISCLAIMER: I will use my own coding in different formats here so as to not  as they say "name and shame" on this post or draw attention to those that do this sort of thing.  But lord knows i should because maybe it might wake them up to how unprofessional they are. 


Some write code as if they have never been introduced to a return key on their keyboard. 


 parent::__construct();$this->service = LANGCLEANER_BOL_Service::getInstance();  if (OW::getRequest()->isAjax())   {  return;  } $language = OW::getLanguage(); $config = OW::getConfig(); $this->service = LANGCLEANER_BOL_Service::getInstance();  $menu = new BASE_CMP_ContentMenu(); $menuItem = new BASE_MenuItem();$menuItem->setLabel(OW::getLanguage()->text('langcleaner', 'admin_langlist_tab_missingkeys_text'));$menuItem->setUrl(OW::getRouter()->urlForRoute('langcleaner.admin'));$menuItem->setKey('general');$menuItem->setIconClass('ow_ic_gear_wheel');$menuItem->setOrder(0);$menu->addElement($menuItem);


now just imagine a whole page of that... can you follow it, i cant follow a whole page of that....


Others are what we call "code hoarders". They never delete a single piece of code ever because they feel they may need it one day and so they just comment out old code left and right. They will most likely never use it but if that day ever comes they know where to find it.  And that looks something like this... 



/* parent::__construct();$this->service = LANGCLEANER_BOL_Service::getInstance(); */


// if (OW::getRequest()->isAjax())   {  return;  } $language = OW::getLanguage(); $config = //OW::getConfig(); $this->service = LANGCLEANER_BOL_Service::getInstance();  $menu = new //BASE_CMP_ContentMenu(); $menuItem = new BASE_MenuItem();$menuItem->setLabel(OW::getLanguage()->text('langcleaner', 'admin_langlist_tab_missingkeys_text'));$menuItem->setUrl(OW::getRouter()->urlForRoute('langcleaner.admin'));

//$menuItem->setKey('general');$menuItem->setIconClass('ow_ic_gear_wheel');$menuItem->setOrder(0);

//$menu->addElement($menuItem); */

// parent::__construct();$this->service = LANGCLEANER_BOL_Service::getInstance(); 


// if (OW::getRequest()->isAjax())   {  return;  } $language = OW::getLanguage(); $config = OW::getConfig(); 


//$this->service = LANGCLEANER_BOL_Service::getInstance();  


//$menu = new //BASE_CMP_ContentMenu(); $menuItem = new BASE_MenuItem();$menuItem->setLabel(OW::getLanguage()->text('langcleaner', //'admin_langlist_tab_missingkeys_text'));$menuItem->setUrl(OW::getRouter()->urlForRoute('langcleaner.admin'));$menuItem->setKey//('general');$menuItem->setIconClass('ow_ic_gear_wheel');$menuItem->setOrder(0);$menu->addElement($menuItem)

 parent::__construct();$this->service = LANGCLEANER_BOL_Service::getInstance();  if (OW::getRequest()->isAjax())   {  return;  } $language = OW::getLanguage(); $config = OW::getConfig(); $this->service = LANGCLEANER_BOL_Service::getInstance();  $menu = new BASE_CMP_ContentMenu(); $menuItem = new BASE_MenuItem();$menuItem->setLabel(OW::getLanguage()->text('langcleaner', 'admin_langlist_tab_missingkeys_text'));$menuItem->setUrl(OW::getRouter()->urlForRoute('langcleaner.admin'));$menuItem->setKey//('general');$menuItem->setIconClass('ow_ic_gear_wheel');$menuItem->setOrder(0);$menu->addElement($menuItem)

/* parent::__construct();$this->service = LANGCLEANER_BOL_Service::getInstance();  */

//if (OW::getRequest()->isAjax())   {  return;  } $language = OW::getLanguage();


//$config = OW::getConfig(); $this->service = LANGCLEANER_BOL_Service::getInstance(); 


// $menu = new BASE_CMP_ContentMenu(); $menuItem = new BASE_MenuItem();$menuItem->setLabel(OW::getLanguage()->text('langcleaner', 'admin_langlist_tab_missingkeys_text'));


//$menuItem->setUrl(OW::getRouter()->urlForRoute('langcleaner.admin'));$menuItem->setKey('general');$menuItem->setIconClass('ow_ic_gear_wheel');$menuItem->setOrder(0);$menu->addElement($menuItem); 


/* parent::__construct();$this->service = LANGCLEANER_BOL_Service::getInstance();  if (OW::getRequest()->isAjax())   {  return;  } $language = OW::getLanguage(); $config = OW::getConfig(); $this->service = LANGCLEANER_BOL_Service::getInstance();  $menu = new BASE_CMP_ContentMenu(); $menuItem = new BASE_MenuItem();$menuItem->setLabel(OW::getLanguage()->text('langcleaner', 'admin_langlist_tab_missingkeys_text'));$menuItem->setUrl(OW::getRouter()->urlForRoute('langcleaner.admin'));$menuItem->setKey('general');$menuItem->setIconClass('ow_ic_gear_wheel');$menuItem->setOrder(0);$menu->addElement($menuItem); */
/* parent::__construct();$this->service = LANGCLEANER_BOL_Service::getInstance();  */

//if (OW::getRequest()->isAjax())   {  return;  } $language = OW::getLanguage();


//$config = OW::getConfig(); $this->service = LANGCLEANER_BOL_Service::getInstance();


// $menu = new BASE_CMP_ContentMenu(); $menuItem = new BASE_MenuItem();$menuItem->setLabel(OW::getLanguage()->text('langcleaner', 'admin_langlist_tab_missingkeys_text'));


//$menuItem->setUrl(OW::getRouter()->urlForRoute('langcleaner.admin'));$menuItem->setKey('general');


//$menuItem->setIconClass('ow_ic_gear_wheel');$menuItem->setOrder(0);$menu->addElement($menuItem); */


everything with a // or /* */ is a comment and will not be executed so why keep all that stuff in the file.


And then you have the proper way, the professional way that code should look in any file.  Neat, organized, documented, professional. 


Now because this text editor for oxwall does not like long code and i dont feel like going thru this and inserting returns everywhere to keep it nice as it is in the file.  I will show you a screen shot of the file. 



That is what every php file should look like.. easy to follow, organized and professional. 


Some of you say what difference does it make, 1 still = 1 and the user side comes out right so who cares.  Well other than being easier to troubleshoot and follow for anyone that follows you.  Bottom line is YOU SHOULD CARE!!! Its called having pride in your work, and your craft.  


Anyone can build a widget, but look at a widget that is done with pride and you can tell the difference right off.   If you don't have pride in your craft then you should not be coding, not for money, not for fun, not for free, and not for any reason.  You make us all look bad when you put out junk like i see some of you do.  Some of what i have seen is an embarrassment to all professional programmers. 


And one of the reasons that i am writing this post is because the next time that someone buys one of your plugins, they will know right off - this programmer has pride and is a professional or this person is a 'hack'.  


A hack is someone that hacks at code much like a hatchet hacks at wood to make something work.  They are not even classified as a coder, they are just someone that hits the tree enough to make it fall if you get my drift.  And that is the difference, a professional would make sure the tree was cut cleanly so that it would not get diseased and pass that on to other trees where as the hack would just shatter and splinter the bottom of the tree and say well duh its down.. Anyway you get my point i hope. 


I also see some of you do some very non compliant things in your coding. Some of you code like you think its a free for all and we can just put whatever code we want in any file we want to, whoo hoooo!!!


This is far from the truth.  There are special places especially made for special things.  The service file is for the initial function call which should be passed to the dao if a query is required.  Now there is some flexibility here folks. 


I admit fully that i probably put too much in the service file that might be better off in the dao.  But this is acceptable to a point because the service file is still secured. So the way i do it is if there is a Oxwall method then i use the dao file, if not then i do my own query in the service file.  But i admit that technically all of us should be putting all queries in the dao file, that is what they are there for. Unless you are calling another dao outside of your plugin then its more acceptable to put it in the service file. 


But i have seen some of you put queries in controller files, component files, and other files not even in the bol directory.  And i am like WTH is that about.  Are you so lazy that you cant even take the time to create a simple function name and move the query to the service file and call the function. That is what i call a lazy hack!  


All of this matters because when people spend money for something they expect it to look nice. That goes for cars, motorcycles, clothes, food, and programming.  They expect professionalism and pride for their money and some of you are making the rest of us look horrible by putting out such garbage, yes i said garbage... because it is... 


Its not enough that it works folks, it has to look like you care, it has to look like you have pride in what you do.  Its ok to keep a line of code as the original code in a file, its ok to even keep a small section.  But anything more than that, remove it and save it to your desktop someplace, and not in the php file or other file. 


Its time to clean things up, its time to be professional, its time to stop saying well Oxwall don't care so why should i, its time to stop saying well it works so who cares.  Its time to be a pro, act like a pro, put out pro material, and have pride in  what you do and care how others see that.


For all of you that do these things every day, THANK YOU !!!!!   sincerely for showing your best and for caring not only that things work but that they look professional as well. 


For those of you that dont, its time to step up or step off...  People don't want to invest in hacks, they want professionals.  I am offering my hand to each and everyone one of you if you need help, or ways to improve, or need to know more about structure and where things go. I am here to help. But i wont do it for you, it is your reward or your failure on your hands.  


Happy coding :) 

Dave 


PS... one follow up note here.  This is for php and even html and css even... But some languages like javascript will come in files that are without spaces and that is fine, it is the way some are done. 


maybe these will help: 


http://www.phptherightway.com/


https://wiki.oxwall.com/dev:crash-course


It really should go like this folks.. 


php file function -> service function -> dao function



The Forum post is edited by dave May 16 '16
ryhdr
ryhdr May 12 '23

Certainly! If you're looking to cut melamine, it's important to use a track saw that is designed for the job. The best track saw for cutting melamine will have a high-quality blade with a fine-toothed edge that is designed to cut through the material cleanly and without chipping. Additionally, the saw should have a powerful motor and a smooth, accurate track system to ensure that you get precise cuts every time. Some of the top brands for track saws that are designed for cutting melamine include Festool, Makita, and DeWalt.






offpage12
offpage12 Aug 12 '23
Shabu Sai Tampines is one of 8 outlets of the popular all-you-can-eat hot pot chain in Singapore. It is located at #02-04, Tampines 1 Shopping Centre, which is a 10-minute walk from Tampines MRT Station. The outlet is open from 11:30am to 10pm daily.

Carscache
Carscache Jan 25

Steer clear of pitfalls with our guide on Toyota RAV4 years to avoid. Uncover potential drawbacks and make an informed decision for a smoother driving experience. Choose wisely for a hassle-free journey.