Programming style

656 views

Published on

Evry one have personal workshop. Everything what is part of them.

2 Comments
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total views
656
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
5
Comments
2
Likes
0
Embeds 0
No embeds

No notes for slide

Programming style

  1. 1. Programming StyleDesign Patterns +Library +Community =Framework
  2. 2. IntroductionConceptions
  3. 3. You can not be an individualist
  4. 4. Code Style● camelCase getName, setName, init, ....● PascalCase (UpperCamelCase) GetName, SetName, Init, ....● Hungarian Notation bBusy, chInitial, fnFunction, ...
  5. 5. Design PatternsGolden Rules
  6. 6. DRYIn software engineering, Dont RepeatYourself (DRY) or Duplication is Evil (DIE) is aprinciple of software development
  7. 7. DRY (Programmers Story #1)Hi.I am Tom. I am writing my backend with PHPand frontend with html5 and JS. Now I amwriting forms of my web shop. I am writingfrontend validator with js and backendvalidation with php....//Say no to Tom
  8. 8. KISSKISS is an acronym for the design principle"Keep it simple, Stupid!".
  9. 9. KISS (fuck logic #1)#define true falseif(true==false){ cout<<"OK";}else{ cout<<"NO";}
  10. 10. KISS (fuck logic #2)try { return true;} finally { return false;}//Return??
  11. 11. KISS (fuck logic #3)<?phpvar_dump(NULL < -50); // TRUEvar_dump(NULL < 0); // FALSEvar_dump(FALSE < TRUE); // TRUEvar_dump(FALSE < FALSE); // FALSE
  12. 12. Design PatternsOOP
  13. 13. SOLIDThe principles when applied together intendsto make it more likely that a programmer willcreate a system that is easy to maintain andextend over time.PS. SOLID (Single responsibility, Open-closed,Liskov substitution, Interface segregation andDependency inversion) - WTF Name??
  14. 14. SRP (Single responsibility principle)class RestaurantAndFirstShopOnTheLeft { //Restaurant int waiter_age; char[] waiter_name; float pizzaCost; //Shop float itemsCost;}
  15. 15. OCP (Open/closed principle)“software entities … should be open forextension, but closed for modification”.final class HashMap{...} //??final class ArrayList{...} //??final public getItem(...){...} //??
  16. 16. LSP (Liskov substitution principle)“objects in a program should be replaceablewith instances of their subtypes withoutaltering the correctness of that program”Object o = new ArrayList();
  17. 17. ISP (Interface segregation principle)“many client-specific interfaces are betterthan one general-purpose interface.”class Restaurant : Building { //...}
  18. 18. DIP (Dependency inversion principle)@Statelessclass Users{ @PersistenceContext private EntityManager entityManager; //...}
  19. 19. Design PatternsApplication
  20. 20. MVCModel–view–controller (MVC) is a softwarearchitecture pattern which separates therepresentation of information from the usersinteraction with it.
  21. 21. MVC Example: ZendFramework
  22. 22. MVP (First View)Model–view–presenter (MVP) is a derivative ofthe model–view–controller (MVC) softwarepattern, also used mostly for building userinterfaces.
  23. 23. MVP Example - Java Server Face
  24. 24. MVP - form<h:form> <h:outputText value="Enter your name: " /></td> <h:inputText value="#{StoreNameBean.personName}" /> <h:commandButton action="result" value="Say Hello" /></h:form>
  25. 25. LibraryOverview
  26. 26. LibraryA collection of standard programs andsubroutines that are stored and available forimmediate use.
  27. 27. Library - Examples:● C++ (Standard Template Library)● OGRE● jQuery● Allegroand many more...
  28. 28. Library Or FrameworkBut my ankle use ZendFrameworkas Library...Do you think Java Platform API is a library??
  29. 29. Communitysupport
  30. 30. WP7 & Google MapAdobe - Phonegap group: https://groups.google.com/forum/?hl=en%3Fhl%3Den&fromgroups=#!topic/phonegap/WVb3nvP0WVAGoogle - Community:https://plus.google.com/110612117605767826163/posts/6J7CF2Z43A1
  31. 31. Google Search Engine & DynamicContentGDG Dublin Group:https://groups.google.com/forum/?fromgroups=#!topic/gdg-dublin/KfmwVgbRY68+ Private Messages
  32. 32. Thank you for attendingsebastian@pozoga.euevents.pozoga.euLinkedIn
  33. 33. Sources● http://www.thefreedictionary. com/program+library● http://en.wikibooks.org● http://en.wikipedia. org/wiki/Software_design_pattern● Clean Code: A Handbook of Agile Software Craftsmanship● The Pragmatic Programmer: From Journeyman to Master

×