ignace Posted October 20, 2007 Share Posted October 20, 2007 Which are considered to be the best programming practices? for example i prefer to not store sessions into files (as done by default by php), but in a database as this gives me the possibility to use the same session on multiple servers, this is possible because of the session_set_save_handler() function! So which do you use (non-oop)? To enlarge the topic a bit: which threads are all out there and how do you solve them (e.g.: cross site scripting)? Quote Link to comment https://forums.phpfreaks.com/topic/74070-programming-practices/ Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 Never let anyone rub there practices off on you. Listen to multiple view points and do what you think is best. I PERSONALLY find MVC a good pattern OOP a good programming standard. I also like to avoid ternary operator, and shorthand all together. I keep other basic rules in mind for myself when programming php 1. Always use full open tags <?php and avoid short tags and/or asp style tags. 2. always make code clean and neat. 3. Always comment code well. As far as sessions specifically I advise you to use php's basic built in session handling until you are very advanced because there can be a lot of security issues with custom session handling if you are not in full control of what you are doing. Quote Link to comment https://forums.phpfreaks.com/topic/74070-programming-practices/#findComment-373971 Share on other sites More sharing options...
ignace Posted October 20, 2007 Author Share Posted October 20, 2007 Which are those basic rules you stick to? Quote Link to comment https://forums.phpfreaks.com/topic/74070-programming-practices/#findComment-374007 Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 Me personally, those were all based on opinion. I stick to all of those when I program. It is especially helpful to me when I am working with other developers and I know someone else is goign to look throug my code. As for comments it'll help you later when you come back to your code and need to make changes. Quote Link to comment https://forums.phpfreaks.com/topic/74070-programming-practices/#findComment-374029 Share on other sites More sharing options...
igor berger Posted October 20, 2007 Share Posted October 20, 2007 You may want to look at Zend for PHP4 but for PHP5 it get techincal. The PHP4 Zend custom sessions are very easy to use. http://www.zend.com/zend/spotlight/code-gallery-wade8.php?article=code-gallery-wade8&kind=sl&id=4791&open=1&anc=0&view=1 Quote Link to comment https://forums.phpfreaks.com/topic/74070-programming-practices/#findComment-374036 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.