+ All Categories
Home > Technology > Programmers slang

Programmers slang

Date post: 28-Nov-2014
Category:
Upload: bocribbz
View: 1,154 times
Download: 5 times
Share this document with a friend
Description:
In modern programming, developers frequently use and follow some principles to become better and produce quality code. This is a talk to introduce yourself to the acronyms that we have encountered most often while writing our day to day code. We will give examples, discuss what they mean and how to follow things like DRY, KISS, TDD and many more.
46
PROGRAMMERS SLANG Frequent acronyms
Transcript
Page 1: Programmers slang

PROGRAMMERS SLANGFrequent acronyms

Page 2: Programmers slang

BOB CRIBBS

Python I Ruby I iOS

bocribbzf t bocribbz

slide share bocribbz

bocribbzin GitHub bocribbz

http bocribbz.com

Page 3: Programmers slang

/flôs/

FLOS

Page 4: Programmers slang

FLOSFree Libre and Open Source

This is not something that you will hear too often, but its a good concept to follow. !The programmers community is huge and a lot of them have tons of things to share, so why not join them?

Page 5: Programmers slang

/ə pē ī/

API

Page 6: Programmers slang

APIApplication Programming Interface

Defines the way software applications can interact with each other.

Page 7: Programmers slang

/krəd/

CRUD

Page 8: Programmers slang

CRUDCreate Read Update and Delete

These are the basic operations for persistent storage. !It’s implementations are found in database systems and in API actions.

Page 9: Programmers slang

/ō är em/

ORM

Page 10: Programmers slang

ORMObject-Relational Mapping

A technique for converting data between incompatible type systems in OOP languages. !Some web frameworks implement their own ORMs for mapping to different database systems using the same structure.

Page 11: Programmers slang

/em vē sē/

MVC

Page 12: Programmers slang

MVCModel View Controller

It refers to a pattern for storing and interacting with information.

Page 13: Programmers slang

MVCModel: refers to storing the information, usually the database layer. !View: how the user sees the information (eg HTML). !Controller: performs various operations to produce the expected output or modify the information.

Page 14: Programmers slang

/em vē pē/

MVP

Page 15: Programmers slang

MVPMinimum Viable Product

Represents a strategy used to release a new product with the least needed functionality in order to produce feedback from clients and enhance it later.

Page 16: Programmers slang

/sas/

SaaS

Page 17: Programmers slang

SaaSSoftware as a service / Service Oriented Architecture

Represents a software architecture where all components are designed to be services. !Which means, the web is a client/server architecture.

Page 18: Programmers slang

SaaSIt has 3 demands on the infrastructure: !Communication: allow customers to interact with service !Scalability: new services can be created rapidly to handle load spikes !Dependability: service and communication continuously available 24x7

Page 19: Programmers slang

/tē dē dē/

TDD

Page 20: Programmers slang

TDDTest-Driven Development

Is a programming strategy that consists of short cycles, where tests are written first and the actual implementation comes second. !It’s especially useful to ensure code quality. !A frequent strategy used with TDD is Red-Green-Refactor.

Page 21: Programmers slang

def test_my_profile(self):! response = client.get(‘/myprofile/’)! assert response.code == 302! !!!def test_my_profile(self):! response = client.get(‘/myprofile/’)! assert response.code == 302!! user = UserFactory(’foo’, ’pass’)! client.login(‘foo’, ‘bar’})! response = client.get(‘/myprofile/’)! assert response.code == 200!!!!def test_my_profile(self):! user = UserFactory(’foo’, ’pass’)! client.login(‘foo’, ‘bar’})! response = client.get(‘/myprofile/’)! assert 'Hello foo' in response

TDDdef my_profile(request):! return redirect('/login/')!!!!!def my_profile(request):! if not request.user.is_auth:! return redirect('/login/')! return 'OK'!!!!!!!!def my_profile(request):! if not request.user.is_auth:! return redirect('/login/')! return 'Hello %s' % request.user

Page 22: Programmers slang

/bē dē dē/

BDD

Page 23: Programmers slang

BDDBehavior-Driven Development

Is a technique introduced to ensure that the software is doing what the client expects, while at the same time maintaining code quality. !Behaviors had to be defined first and implementation had to follow them, by providing test first and only then writing the actual code.

Page 24: Programmers slang

As a registered user I can visit my profile page.!

BDDdef test_my_profile(self):! response = client.get(‘/myprofile/’)! assert response.code == 302!! user = UserFactory(’foo’, ’pass’)! client.login(‘foo’, ‘bar’})! response = client.get(‘/myprofile/’)! assert 'Hello foo' in response

Page 25: Programmers slang

/fərst/

FIRST

Page 26: Programmers slang

FIRSTFast Independent Repeatable Self-checking Timely

These are properties that a good test has to meet in order to be useful and effective.

Page 27: Programmers slang

FIRSTFast: it has to run quick !Independent: a test has to be able to be executed isolated and not rely on other tests. !Repeatable: a test can be executed anytime and the outcome will still be the same. !Self-checking: it must automatically detect if it passed !Timely: refers to test being written before code (TDD)

Page 28: Programmers slang

FIRST - FASTFast means fast...

Page 29: Programmers slang

def test_my_profile(self):! self.client.post(‘register’, ! {‘user’: ‘foo’, ‘pwd’: ‘bar’})! client.login(‘foo’, ‘bar’})! response = client.get(‘/myprofile/’)! assert 'Hello foo' in response

FIRST - INDEPENDENTdef test_create_user(self):! self.client.post(‘register’, ! {‘user’: ‘foo’, ‘pwd’: ‘bar’})! [...]!!def test_logged_in(self):! client.login(‘foo’, ‘bar’})! response = client.get(‘/myprofile/’)! assert 'Hello foo' in response!!

Page 30: Programmers slang

def test_last_login(self):! tdelta = datetime.timedelta(days=1)! today = datetime.today()!! user = UserFactory(’foo’, ’pass’)! user.last_login = today - tdelta! ! tdelta = datetime.timedelta(days=30)! since = today - tdelta! assert user in User.objects.filter(! last_login > since)!

FIRST - REPEATABLEdef test_last_login(self):! tdelta = datetime.timedelta(days=1)! today = datetime.today()!! user = UserFactory(’foo’, ’pass’)! user.last_login = ‘2013-09-01’! ! since = today - tdelta! assert user in User.objects.filter(! last_login > since)!!!

Page 31: Programmers slang

def test_last_login(self):! tdelta = datetime.timedelta(days=1)! today = datetime.today()!! user = UserFactory(’foo’, ’pass’)! user.last_login = today - tdelta! ! tdelta = datetime.timedelta(days=30)! since = today - tdelta!! assert user in User.objects.filter(! last_login > since)!

FIRST - SELF CHECKINGdef test_last_login(self):! tdelta = datetime.timedelta(days=1)! today = datetime.today()!! user = UserFactory(’foo’, ’pass’)! user.last_login = today - tdelta! ! tdelta = datetime.timedelta(days=30)! since = today - tdelta! users = User.objects.filter(! last_login > since)! if user not in users:! print ‘We have a problem’!!!

Page 32: Programmers slang

FIRST - TIMELY (TDD)def test_my_profile(self):! response = client.get(‘/myprofile/’)! assert response.code == 302! !!!def test_my_profile(self):! response = client.get(‘/myprofile/’)! assert response.code == 302!! user = UserFactory(’foo’, ’pass’)! client.login(‘foo’, ‘bar’})! response = client.get(‘/myprofile/’)! assert response.code == 200!!!!def test_my_profile(self):! user = UserFactory(’foo’, ’pass’)! client.login(‘foo’, ‘bar’})! response = client.get(‘/myprofile/’)! assert 'Hello foo' in response

def my_profile(request):! return redirect('/login/')!!!!!def my_profile(request):! if not request.user.is_auth:! return redirect('/login/')! return 'OK'!!!!!!!!def my_profile(request):! if not request.user.is_auth:! return redirect('/login/')! return 'Hello %s' % request.user

Page 33: Programmers slang

/sē ī/

CI

Page 34: Programmers slang

CIContinuous Integration

Is a practice of running tests and creating a build automatically.

Page 35: Programmers slang

CIPrinciples you have to follow for CI: !Maintain a code repo Automate the build/deploy Make the build self-testable Keep the build fast Everyone can see the results of the build Automate deployment (Continuous Deployment)

Page 36: Programmers slang

/drī/ vs /wet/

DRY vs WET

Page 37: Programmers slang

DRY vs WETDon’t Repeat Yourself vs Write Everything Twice

Is a principle that refers to reducing repeated blocks of common functionality to a separate sequence that can be called independently. !It will help you achieve more reusability and automation.

Page 38: Programmers slang

def login_required():! if not user.is_authenticated():! return redirect(‘/login’)!!def get(request):! login_required()! [ … ]!!def post(request):! login_required()! [ … ]!!

def get(request):! if not user.is_authenticated():! return redirect(‘/login’)! [ … ]!!def post(request):! if not user.is_authenticated():! return redirect(‘/login’)! [ … ]!!

DRY vs WET

Page 39: Programmers slang

/kis/

KISS

Page 40: Programmers slang

KISSKeep it simple, stupid

Is a principle that the implementation has to follow the simplest logic instead of a complex one. !It's probably the most difficult strategy in programming. Most user-friendly interfaces and interactions, are probably also the most over engineered.

Page 41: Programmers slang

KISSDo not overcomplicate design or code, consider different approach and trade-off and finally choose the simplest one, based on system constraints and business rules. !It will improve testability, usability and your code would probably be self-documented and much easier to refactor in the future, if required.

Page 42: Programmers slang

def add_user(uname, pwd):! epwd = md5(pwd)! user = User(uname, epwd)! user.save()! return user!

def add_user(uname, pwd):! epwd = md5(pwd)! user = User(uname, epwd)! user.save()!! send_email(user, ‘Hello World!’)! send_email(admin, ‘New User!’)!! stats = Stats.filter('country')! stats += 1! stats.save()!! login(uname, pwd)! redirect(‘/myprofile/’)

KISS

Page 43: Programmers slang

/eks pē/

XP

Page 44: Programmers slang

XPExtreme programming

Is a software development methodology which is intended to improve software quality and responsiveness to changing customer requirements. !

Page 45: Programmers slang

XPPractices: !Pair programming TDD CI Small releases KISS

Page 46: Programmers slang

What are the acronyms you encountered? What are the principles you follow to deliver better code?

!Questions?

Thank you!


Recommended