SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
Programming Style
Design Patterns +
Library +
Community =
Framework
Introduction
Conceptions
You can not be an individualist
Code Style
● camelCase
    getName, setName, init, ....

● PascalCase (UpperCamelCase)
    GetName, SetName, Init, ....

● Hungarian Notation
    bBusy, chInitial, fnFunction, ...
Design Patterns
Golden Rules
DRY



In software engineering, Don't Repeat
Yourself (DRY) or Duplication is Evil (DIE) is a
principle of software development
DRY (Programmers Story #1)
Hi.

I am Tom. I am writing my backend with PHP
and frontend with html5 and JS. Now I am
writing forms of my web shop. I am writing
frontend validator with js and backend
validation with php....

//Say no to Tom
KISS




KISS is an acronym for the design principle
"Keep it simple, Stupid!".
KISS (fuck logic #1)

#define true false

if(true==false){
   cout<<"OK";
}else{
   cout<<"NO";
}
KISS (fuck logic #2)

try {
    return true;
} finally {
    return false;
}

//Return??
KISS (fuck logic #3)
<?php

var_dump(NULL < -50); // TRUE
var_dump(NULL < 0); // FALSE

var_dump(FALSE < TRUE); // TRUE
var_dump(FALSE < FALSE); // FALSE
Design Patterns
OOP
SOLID
The principles when applied together intends
to make it more likely that a programmer will
create a system that is easy to maintain and
extend over time.

PS. SOLID (Single responsibility, Open-closed,
Liskov substitution, Interface segregation and
Dependency inversion) - WTF Name??
SRP (Single responsibility principle)
class RestaurantAndFirstShopOnTheLeft {
   //Restaurant
   int waiter_age;
   char[] waiter_name;
   float pizzaCost;

    //Shop
    float itemsCost;
}
OCP (Open/closed principle)
“software entities … should be open for
extension, but closed for modification”.

final class HashMap{...} //??
final class ArrayList{...} //??

final public getItem(...){...} //??
LSP (Liskov substitution principle)

“objects in a program should be replaceable
with instances of their subtypes without
altering the correctness of that program”


Object o = new ArrayList();
ISP (Interface segregation principle)

“many client-specific interfaces are better
than one general-purpose interface.”

class Restaurant : Building {
   //...
}
DIP (Dependency inversion principle)

@Stateless
class Users{

    @PersistenceContext
    private EntityManager entityManager;

    //...
}
Design Patterns
Application
MVC



Model–view–controller (MVC) is a software
architecture pattern which separates the
representation of information from the user's
interaction with it.
MVC Example: ZendFramework
MVP (First View)



Model–view–presenter (MVP) is a derivative of
the model–view–controller (MVC) software
pattern, also used mostly for building user
interfaces.
MVP Example - Java Server Face
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>
Library
Overview
Library



A collection of standard programs and
subroutines that are stored and available for
immediate use.
Library - Examples:



●   C++ (Standard Template Library)
●   OGRE
●   jQuery
●   Allegro

and many more...
Library Or Framework



But my ankle use ZendFramework
as Library...

Do you think Java Platform API is a library??
Community
support
WP7 & Google Map
Adobe - Phonegap group: https://groups.
google.com/forum/?hl=en%3Fhl%
3Den&fromgroups=#!
topic/phonegap/WVb3nvP0WVA

Google - Community:
https://plus.google.
com/110612117605767826163/posts/6J7CF2Z4
3A1
Google Search Engine & Dynamic
Content

GDG Dublin Group:
https://groups.google.com/forum/?
fromgroups=#!topic/gdg-dublin/KfmwVgbRY68

+ Private Messages
Thank you for attending
sebastian@pozoga.eu
events.pozoga.eu
LinkedIn
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

Más contenido relacionado

Destacado

Douglas Crockford - Programming Style and Your Brain
Douglas Crockford - Programming Style and Your BrainDouglas Crockford - Programming Style and Your Brain
Douglas Crockford - Programming Style and Your BrainWeb Directions
 
CS201- Introduction to Programming- Lecture 01
CS201- Introduction to Programming- Lecture 01CS201- Introduction to Programming- Lecture 01
CS201- Introduction to Programming- Lecture 01Bilal Ahmed
 
Introduction to Computer and Programming - Lecture 01
Introduction to Computer and Programming - Lecture 01Introduction to Computer and Programming - Lecture 01
Introduction to Computer and Programming - Lecture 01hassaanciit
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overviewJong Soon Bok
 
New Programming Style of Java
New Programming Style of JavaNew Programming Style of Java
New Programming Style of JavaYuichi Sakuraba
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java ProgrammingRavi Kant Sahu
 

Destacado (7)

Douglas Crockford - Programming Style and Your Brain
Douglas Crockford - Programming Style and Your BrainDouglas Crockford - Programming Style and Your Brain
Douglas Crockford - Programming Style and Your Brain
 
CS201- Introduction to Programming- Lecture 01
CS201- Introduction to Programming- Lecture 01CS201- Introduction to Programming- Lecture 01
CS201- Introduction to Programming- Lecture 01
 
Introduction to Computer and Programming - Lecture 01
Introduction to Computer and Programming - Lecture 01Introduction to Computer and Programming - Lecture 01
Introduction to Computer and Programming - Lecture 01
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overview
 
New Programming Style of Java
New Programming Style of JavaNew Programming Style of Java
New Programming Style of Java
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similar a Programming style

Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introductionBirol Efe
 
Lunch and learn as3_frameworks
Lunch and learn as3_frameworksLunch and learn as3_frameworks
Lunch and learn as3_frameworksYuri Visser
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ Ganesh Samarthyam
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLsintelliyole
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...Maarten Balliauw
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonifiedChristian Heilmann
 
Combating software entropy 2-roc1-
Combating software entropy 2-roc1-Combating software entropy 2-roc1-
Combating software entropy 2-roc1-Hammad Rajjoub
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011YoungSu Son
 
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL ProxyThe PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL ProxyUlf Wendel
 
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...Codemotion
 
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...Codemotion
 
Lotusphere 2007 AD505 DevBlast 30 LotusScript Tips
Lotusphere 2007 AD505 DevBlast 30 LotusScript TipsLotusphere 2007 AD505 DevBlast 30 LotusScript Tips
Lotusphere 2007 AD505 DevBlast 30 LotusScript TipsBill Buchan
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project AnalyzedPVS-Studio
 
Reviewing OOP Design patterns
Reviewing OOP Design patternsReviewing OOP Design patterns
Reviewing OOP Design patternsOlivier Bacs
 
Design pattern in an expressive language java script
Design pattern in an expressive language java scriptDesign pattern in an expressive language java script
Design pattern in an expressive language java scriptAmit Thakkar
 

Similar a Programming style (20)

Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introduction
 
Lunch and learn as3_frameworks
Lunch and learn as3_frameworksLunch and learn as3_frameworks
Lunch and learn as3_frameworks
 
Ruby On Rails Introduction
Ruby On Rails IntroductionRuby On Rails Introduction
Ruby On Rails Introduction
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
 
Ad505 dev blast
Ad505 dev blastAd505 dev blast
Ad505 dev blast
 
Final ppt
Final pptFinal ppt
Final ppt
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonified
 
Combating software entropy 2-roc1-
Combating software entropy 2-roc1-Combating software entropy 2-roc1-
Combating software entropy 2-roc1-
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL ProxyThe PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
 
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
 
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Lotusphere 2007 AD505 DevBlast 30 LotusScript Tips
Lotusphere 2007 AD505 DevBlast 30 LotusScript TipsLotusphere 2007 AD505 DevBlast 30 LotusScript Tips
Lotusphere 2007 AD505 DevBlast 30 LotusScript Tips
 
Why Ruby?
Why Ruby? Why Ruby?
Why Ruby?
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project Analyzed
 
Reviewing OOP Design patterns
Reviewing OOP Design patternsReviewing OOP Design patterns
Reviewing OOP Design patterns
 
Design pattern in an expressive language java script
Design pattern in an expressive language java scriptDesign pattern in an expressive language java script
Design pattern in an expressive language java script
 

Más de Sebastian Pożoga (20)

GoLang & GoatCore
GoLang & GoatCore GoLang & GoatCore
GoLang & GoatCore
 
Go dla elektronika
Go dla elektronikaGo dla elektronika
Go dla elektronika
 
Angular2 - Co jest grane?!?!
Angular2 - Co jest grane?!?! Angular2 - Co jest grane?!?!
Angular2 - Co jest grane?!?!
 
Fosdem i inne konferencje
Fosdem i inne konferencjeFosdem i inne konferencje
Fosdem i inne konferencje
 
Angular2 - In Action
Angular2  - In ActionAngular2  - In Action
Angular2 - In Action
 
Hardgroup - Raspberry PI #1
Hardgroup - Raspberry PI #1Hardgroup - Raspberry PI #1
Hardgroup - Raspberry PI #1
 
IoT dla programistów
IoT dla programistówIoT dla programistów
IoT dla programistów
 
Sails.js - Overview
Sails.js - OverviewSails.js - Overview
Sails.js - Overview
 
3D Printing
3D Printing3D Printing
3D Printing
 
Overview of AngularJS
Overview of AngularJS Overview of AngularJS
Overview of AngularJS
 
Meet.php #gpio
Meet.php #gpioMeet.php #gpio
Meet.php #gpio
 
OSFile#2
OSFile#2OSFile#2
OSFile#2
 
Game jump frontend introduction #workshop1
Game jump  frontend introduction #workshop1Game jump  frontend introduction #workshop1
Game jump frontend introduction #workshop1
 
Game jump: frontend introduction #1
Game jump: frontend introduction #1Game jump: frontend introduction #1
Game jump: frontend introduction #1
 
The future of technologies
The future of technologiesThe future of technologies
The future of technologies
 
OSFile
OSFileOSFile
OSFile
 
gameJUMP.pl#about
gameJUMP.pl#aboutgameJUMP.pl#about
gameJUMP.pl#about
 
Poznań 4.04.2013
Poznań 4.04.2013Poznań 4.04.2013
Poznań 4.04.2013
 
Blender3 d
Blender3 dBlender3 d
Blender3 d
 
Events poznań 7.02.2013
Events poznań 7.02.2013Events poznań 7.02.2013
Events poznań 7.02.2013
 

Programming style

  • 1. Programming Style Design Patterns + Library + Community = Framework
  • 3. You can not be an individualist
  • 4. Code Style ● camelCase getName, setName, init, .... ● PascalCase (UpperCamelCase) GetName, SetName, Init, .... ● Hungarian Notation bBusy, chInitial, fnFunction, ...
  • 6. DRY In software engineering, Don't Repeat Yourself (DRY) or Duplication is Evil (DIE) is a principle of software development
  • 7. DRY (Programmers Story #1) Hi. I am Tom. I am writing my backend with PHP and frontend with html5 and JS. Now I am writing forms of my web shop. I am writing frontend validator with js and backend validation with php.... //Say no to Tom
  • 8. KISS KISS is an acronym for the design principle "Keep it simple, Stupid!".
  • 9. KISS (fuck logic #1) #define true false if(true==false){ cout<<"OK"; }else{ cout<<"NO"; }
  • 10. KISS (fuck logic #2) try { return true; } finally { return false; } //Return??
  • 11. KISS (fuck logic #3) <?php var_dump(NULL < -50); // TRUE var_dump(NULL < 0); // FALSE var_dump(FALSE < TRUE); // TRUE var_dump(FALSE < FALSE); // FALSE
  • 13. SOLID The principles when applied together intends to make it more likely that a programmer will create a system that is easy to maintain and extend over time. PS. SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) - WTF Name??
  • 14. SRP (Single responsibility principle) class RestaurantAndFirstShopOnTheLeft { //Restaurant int waiter_age; char[] waiter_name; float pizzaCost; //Shop float itemsCost; }
  • 15. OCP (Open/closed principle) “software entities … should be open for extension, but closed for modification”. final class HashMap{...} //?? final class ArrayList{...} //?? final public getItem(...){...} //??
  • 16. LSP (Liskov substitution principle) “objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program” Object o = new ArrayList();
  • 17. ISP (Interface segregation principle) “many client-specific interfaces are better than one general-purpose interface.” class Restaurant : Building { //... }
  • 18. DIP (Dependency inversion principle) @Stateless class Users{ @PersistenceContext private EntityManager entityManager; //... }
  • 20. MVC Model–view–controller (MVC) is a software architecture pattern which separates the representation of information from the user's interaction with it.
  • 22. MVP (First View) Model–view–presenter (MVP) is a derivative of the model–view–controller (MVC) software pattern, also used mostly for building user interfaces.
  • 23. MVP Example - Java Server Face
  • 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>
  • 26. Library A collection of standard programs and subroutines that are stored and available for immediate use.
  • 27. Library - Examples: ● C++ (Standard Template Library) ● OGRE ● jQuery ● Allegro and many more...
  • 28. Library Or Framework But my ankle use ZendFramework as Library... Do you think Java Platform API is a library??
  • 30. WP7 & Google Map Adobe - Phonegap group: https://groups. google.com/forum/?hl=en%3Fhl% 3Den&fromgroups=#! topic/phonegap/WVb3nvP0WVA Google - Community: https://plus.google. com/110612117605767826163/posts/6J7CF2Z4 3A1
  • 31. Google Search Engine & Dynamic Content GDG Dublin Group: https://groups.google.com/forum/? fromgroups=#!topic/gdg-dublin/KfmwVgbRY68 + Private Messages
  • 32. Thank you for attending sebastian@pozoga.eu events.pozoga.eu LinkedIn
  • 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