Six Feet Up's senior developer Clayton Parker will lead you on a journey to become a Python zen master. Your code should be as fashionable as it is functional. To quote the Zen of Python, "Beautiful is better than ugly". This talk will teach you about the Python style guide and why it is important. The talk will show you examples of well written Python and how to analyze your current code to make Guido proud.
Six Feet Up's senior developer Clayton Parker will lead you on a journey to become a Python zen master. Your code should be as fashionable as it is functional. To quote the Zen of Python, "Beautiful is better than ugly". This talk will teach you about the Python style guide and why it is important. The talk will show you examples of well written Python and how to analyze your current code to make Guido proud.
Full-day tutorial for the dutch php conference 2011 giving a very quick tour around all the various areas of the ZCE syllabus and some tips on the exam styles
Six Feet Up's senior developer Clayton Parker will lead you on a journey to become a Python zen master. Your code should be as fashionable as it is functional. To quote the Zen of Python, "Beautiful is better than ugly". This talk will teach you about the Python style guide and why it is important. The talk will show you examples of well written Python and how to analyze your current code to make Guido proud.
Full-day tutorial for the dutch php conference 2011 giving a very quick tour around all the various areas of the ZCE syllabus and some tips on the exam styles
I try to explain what SOLID principles are all about, how to refactor an example code according to these principles and summarize what are the benefits of writing a SOLID code.
Version 5.0 will include version 2.0 of the Zend Engine
New object model is more powerful and intuitive
Objects will no longer be passed by value; they now will be passed by reference
Increases performance and makes OOP more attractive
Object Orientation vs. Functional Programming in PythonPython Ireland
Python is a multi-paradigm language meaning it supports different programming styles, Object Orientation and Functional Programming being the major ones. However choice is not always a good thing, if you are interested in writing modular programs that are easy to maintain and promote code reuse what should you do? This talk discusses modularity in this context looking at Python's support for both paradigms, comparing and contrasting them. We then look at Python techniques and tools that bridge the perceived impedance mismatch between Object Orientation and Functional Programming.
La charla propone hacer un recorrido y revisión de componentes y conceptos empleados en Zope que puedan ser empleados de forma independiente en otras aplicaciones, incluso que no sean web.
These are the slides I was using when delivering a short talk in Vienna PHP. The talk took place in Vienna on September 22th. More information about the PHP course I deliver can be found at php.course.lifemichael.com
This is the ninth set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
In this talk we will explore the Zen of Python and the famous PEP8 Style Guide. Learn about the tenets of the Python language and how you can apply them to make your code beautiful and functional. After all, Readability Counts!
Code Like Pythonista
Beautifully made PPT.
Ref. http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
Image ref : https://pixabay.com/ko/ and https://morguefile.com/
licensed under a Creative Commons Attribution/Share-Alike (BY-SA) license.
I try to explain what SOLID principles are all about, how to refactor an example code according to these principles and summarize what are the benefits of writing a SOLID code.
Version 5.0 will include version 2.0 of the Zend Engine
New object model is more powerful and intuitive
Objects will no longer be passed by value; they now will be passed by reference
Increases performance and makes OOP more attractive
Object Orientation vs. Functional Programming in PythonPython Ireland
Python is a multi-paradigm language meaning it supports different programming styles, Object Orientation and Functional Programming being the major ones. However choice is not always a good thing, if you are interested in writing modular programs that are easy to maintain and promote code reuse what should you do? This talk discusses modularity in this context looking at Python's support for both paradigms, comparing and contrasting them. We then look at Python techniques and tools that bridge the perceived impedance mismatch between Object Orientation and Functional Programming.
La charla propone hacer un recorrido y revisión de componentes y conceptos empleados en Zope que puedan ser empleados de forma independiente en otras aplicaciones, incluso que no sean web.
These are the slides I was using when delivering a short talk in Vienna PHP. The talk took place in Vienna on September 22th. More information about the PHP course I deliver can be found at php.course.lifemichael.com
This is the ninth set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
In this talk we will explore the Zen of Python and the famous PEP8 Style Guide. Learn about the tenets of the Python language and how you can apply them to make your code beautiful and functional. After all, Readability Counts!
Code Like Pythonista
Beautifully made PPT.
Ref. http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
Image ref : https://pixabay.com/ko/ and https://morguefile.com/
licensed under a Creative Commons Attribution/Share-Alike (BY-SA) license.
Secure Programming Practices in C++ (NDC Oslo 2018)Patricia Aas
Bjarne Stroustrup, the creator of C++, once said : “C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.” He has also said : “Within C++, there is a much smaller and cleaner language struggling to get out.” Both are true.
This talk is for programmers wishing to feel more comfortable navigating the C++ landscape. Motivated by going through well known vulnerability patterns that have been used in exploits for decades, we will explore the programming culture that has developed around the C++ language. Specifically, we will look at programming patterns that navigate around or through some of the dangerous parts of the C++ language. The goal is to build a set of programming practices based in the “smaller and cleaner language” inside C++. And by doing so, we will also build an awareness around code constructs that can potentially “blow your whole leg off”.
A talk about the current state of java enterprise development, evaluation of the available alternatives to conventional enterprise solutions, tools and languages for the JVM, and possibly beyond.
JUG-Roma meeting 16 Sept 2014
Drupal 8: A story of growing up and getting off the islandAngela Byron
The Drupal project has traditionally held a strong internal value for doing things "The Drupal Way." As a result, Drupal developers have historically needed to build up reams and reams of tricks and workarounds that were specific to Drupal itself, and Drupal was inaccessible to people with a more traditional programming background. Starting in Drupal 8, however, we've effectively done a ground-up rewrite of the underlying code and in the process made major inroads to getting more inline with the rest of the PHP world. Procedural code is out, OO code is in. "Creative" hacks have been replaced with FIG standards. "Not invented here" is now "Proudly found elsewhere." This story will talk about the journey that Drupal 8 and the Drupal core development team has taken during this transition over the past 3+ years, including some of the pros and cons of this approach and how we dealt (and are dealing) with some of the community management challenges that resulted.
TYPO3 Extension development using new Extbase frameworkChristian Trabold
My presentation for the TYPO3 community day in Tokyo, Japan.
The code is available at https://github.com/ctrabold/t3ski-workshop.
Due to copyright issues I had to remove all pictures of Miffy.
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018Mike Harris
I never wrote it; everybody else did! How many times have you waded through an ageing, decaying, tangled forrest of code and wished it would just die? How many times have you heard someone say that what really needs to happen is a complete rewrite? I have heard this many times, and, have uttered that fatal sentence myself. But shouldn’t we love our legacy code? Doesn’t it represent our investment and the hard work of ourselves and our predecessors? Throwing it away is dangerous, because, before we do, we’ll need to work out exactly what it does, and we’ll need to tweeze out that critical business logic nestled in a deeply entangled knot of IF statements. It could take us years to do, and we’ll have to maintain two systems whilst we do it, inevitably adding new features to them both. Yes we get to reimplement using the latest, coolest programming language, instead of an old behemoth, but how long will our new cool language be around, and who will maintain that code, when it itself inevitably turns to legacy? We can throw our arms in the air, complaining and grumbling about how we didn’t write the code, how we would never have written it the way it is, how those that wrote it were lesser programmers, possibly lesser humans themselves, but the code still remains, staring us in the face and hanging around for longer that we could possibly imagine. We can sort it out, we can improve it, we can make it testable, and we can learn to love our legacy code.
https://www.youtube.com/watch?v=qRP45l5UugE
As a long time C# developer, I started with Python as a second language for ML purposes. Starting in Python is easy, doing engineering grade python turned out to be a lot harder, so these are 10 things I learned along the way to writing production code in Python.
Managing Chaos: Merging 120 Sites into a single Plone Multisite SolutionClayton Parker
Discover how the Penn State College of Liberal Arts moved over 120 separate websites running on their own Plone installation into a single system utilizing Lineage in less than 90 days. The new system retains the independent permissions and workflows each site needed to have. This talk will discuss the reasons for the consolidation and why the new system is more efficient and easier to navigate for administrators.
A historical discussion along with a survey of the current landscape of Python packaging. Also learn the basics of uploading your package to PyPi.
Presentation was given at the IndyPy user group meeting in February 2014.
Notre Dame Seamless Syndication with LineageClayton Parker
Learn how Lineage can be used to manage numerous nested websites and how a multi-directional syndication and publication mechanism is allowing them to leverage content across all sites.
Six Feet Up will present how the College of Engineering at the University of Notre Dame has replaced a profusion of independent and disconnected websites with a Plone-based hub-and-spoke site using Lineage. Content can be easily syndicated to and from any of the participating sites through a sophisticated mechanism that lets content contributors submit syndication requests through a publication workflow.
This case study will show how the deployed solution is giving the University the ability to delegate content creation while still controlling the quality of the output, as well as give more visibility to some of the content pieces authored by its faculty members.
Pioneer a Strategic Change in Content Organization with PloneClayton Parker
Waking up to the reality of SEO and social media, large corporate organizations are now looking to better control content on their long list of child sites, as well as prevent strategic information from evading to third-party sites such as LinkedIn, Facebook, Twitter, etc.
One forward-thinking school – College of Engineering at University of Notre Dame – has set the ball rolling by implementing a large hub and spoke infrastructure to manage the content of a dozen departments and a dozen research centers. The new structure was unveiled in January 2012 and is powered by Plone.
In this talk, we will unveil how the Plone add-on Lineage can be used to create a powerful structure of parent and child sites. First, we will explain how Lineage works out of the box with no customizations. The default behavior is simple and allows for the new microsites to be created instantly, but they will look the same as their parent.
After reviewing the stock behavior, we will explore how to extend Lineage. There are several Lineage add-ons that allow child sites to have their own theme or even their own properties. We will present what these add-ons provide on top of the out-of-the box experience. We will also reveal how to use the child site creation hooks to populate the new child sites with content, set up properties and prepare the child site for use by the end users.
Using Buildout, GenericSetup and a Policy Package to Rule the WorldClayton Parker
So you have your code on the filesystem and you are using buildout;
what's next? You can take your build to the next level by reducing the
amount of manual steps needed to create and maintain your site. Using
collective.recipe.plonesite, you can ensure that every member of your
team is working on an identical Plone site at any given time.
Without the plonesite recipe, when you run your buildout for the first
time, you are left with an empty Zope site. This talk will show you how
to utilize buildout to create a Plone site for you and make sure it is
all set up via a policy package and GenericSetup so you can hit the
ground running.
Make Plone Search Act Like Google Using SolrClayton Parker
Solr is a powerful open source search engine server which has become a popular choice for extending the search capabilities of Plone sites. The default configuration works well, but how do you answer the client's request to "Make my search just like Google's"?
In this talk we will take a look at the various options that are available for configuring Solr's schema and configuration. We will discuss how to set up stop words, spell checking, n-grams and alternate query handlers. We will see what effect these settings will have on the search results and find out how to debug problems when they arise.
Migrating from drupal to plone with transmogrifierClayton Parker
Transmogrifier is a migration framework that can help you easily migrate from one platform to another. It has been written in a way that allows re-use of migration code through blueprints. In this talk we will walk through the steps necessary to migrate from Drupal, a popular CMS written in PHP, into Plone. We will see how to use the various blueprints available to build a pipeline that prepares and imports the content into Plone
Buildout is a great tool for creating repeatable environments. But what happens when things change and you are left with a broken buildout? This talk will focus on creating a buildout that can survive the test of time. The talk will cover how to keep your packages pinned so that releases don't cause you headaches. We will also discuss how to set up your own package server in order to make sure that you always have the packages that you need.
Transmogrifier is a tool that gives you the ability to create a configurable pipeline to import and export from various systems. Each section of the pipe can be turned into a re-usable blueprint that can be given back to the community. This gives us the ability to quickly create migration paths for existing systems and maintain them as Python packages.
LDAP and Active Directory Authentication in PloneClayton Parker
In this presentation, we will discuss the benefits of having Plone authenticate
against a directory server. We will explore which tools are available to make
this authentication option successful as well as how to configure them.
Finally, disadvantages and possible problems with such a setup will be
discussed.
Using Buildout to Develop and Deploy Python ProjectsClayton Parker
Buildout gives you a way to manage, build and deploy your Python project with ease. Large Python projects such as Plone use it to distribute repeatable development environments. Buildout allows you to easily get up and running with your project versus the traditional method of installing all the dependancies and manually configuring your applications instance for each environment. The buildout community is rapidly growing with a large repository of recipes that allow you to extend it's functionality. This talk will show you the basics of using buildout and how to make it a vital part of your project's life cycle.
Your Plone instance can dance and sing. Now you need to pretty it up. Ever wondered about how to stylize Plone's look and rearrange the layout? Ever contemplated interacting with Plone's stylesheets or going with a full face-lift? Six Feet Up's Senior Developer Clayton Parker will be your Beauty Specialist and lead you through the makeover of your Plone site referring to several Plone fashion models. Some of the topics touched on will include a review of the various philosophies to reskinning Plone, beauty tips for augmenting the site layout via viewlets, training on when to use Zope 3 resources, and help with registering your customizations with the resource registries. The presentation will also go over how to use base properties to create your site's very special look. Some common Plone fashion faux-pas will be unveiled as well, such as using the custom folder or bloating your site's HTML.
5. The Zen of Python
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
sixfeetup.com/deploy2010
6. Important Zen
• Beautiful is better than ugly.
• Readability counts.
• Now is better than never.
• Although never is often better than right now.
sixfeetup.com/deploy2010
7. What is PEP8?
• A style guide for Python
• Common sense
sixfeetup.com/deploy2010
8. The importance of PEP8
• Code is read more than it is written
• Consistency
sixfeetup.com/deploy2010
9. When to break the rules
• Less readable
• Be aware of your surroundings
sixfeetup.com/deploy2010
10. Code layout
• 4 space indents
• Never mix tabs and spaces!
• Maximum line length 79 characters
• Use blank lines sparingly
sixfeetup.com/deploy2010
12. Maximum line length
BAD
# Example 1
things = ['overwrite', 'photobathic', 'tranquillization', 'resiny', 'runt', 'elpidite', 'Siganus', 'upplough', 'coed']
# This list comprehension is insane and should probably be split up into multiple statements
special_things = [special_thing for special_thing in special_things if special_thing == 'elpidite']
# 79 columns ->
# Example 2
if event.new_state.id == 'offline' and (state == 'published' or state == 'external'):
workflow.doActionFor(content, 'reject', workflow='my_custom_workflow', comment='Rejecting content automatically')
sixfeetup.com/deploy2010
13. Maximum line length
GOOD
# Example 1
things = [
'overwrite',
'photobathic',
'tranquillization',
'resiny',
'runt',
'elpidite',
'Siganus',
'upplough',
'coed']
# Instead of using a list comprehension, we'll use the filter built-in
# to make the code have more clarity.
def my_checker(item):
if item == "elpidite":
return item
special_things = filter(my_checker, things)
sixfeetup.com/deploy2010
14. Maximum line length
GOOD
# Example 2
public_state = state in ['published', 'external']
if event.new_state.id == 'offline' and public_state:
workflow.doActionFor(
content,
'reject',
workflow='my_custom_workflow',
comment='Rejecting content automatically')
sixfeetup.com/deploy2010
15. Blank lines
import random
ASCII_CAT1 = """
/_/
( o.o )
> ^ <
"""
ASCII_CAT2 = """
_ _/|
'o.0'
=(___)=
U
"""
CATS = [ASCII_CAT1, ASCII_CAT2]
class CatMadness(object):
"""Cats are curious animals. This is a silly example"""
def __init__(self, num_cats=0):
self.num_cats = num_cats
def make_it_rain(self):
"""Just cats, no dogs yet."""
count = self.num_cats
while count > 0:
count -= 1
print random.choice(CATS)
sixfeetup.com/deploy2010
16. Imports
BAD
import os, sys
import config
from my.package.content import *
GOOD
import os
import sys
# explicit is better than implicit
from my.package import config
from my.package.content import Octopus, Blowfish
sixfeetup.com/deploy2010
19. Guido taking a look
http://www.flickr.com/photos/7901942@N04/3528995869/ sixfeetup.com/deploy2010
20. Comments
# Comments start with a space after the comment symbol. Use complete
# sentences and proper grammar when writing comments. Comments should
# be in English unless you are certain the readers will *not* be
# English speaking.
# Long flowing text should be kept to under 72 characters like above.
x = 5 # Use inline comments sparingly.
sixfeetup.com/deploy2010
22. Recommendations
BAD
if type(obj) is type(1)
if my_variable == None
if not len(my_list)
if boolean_value == True
GOOD
if isinstance(obj, int):
if my_variable is None
if not my_list
if boolean_value
sixfeetup.com/deploy2010
23. pep8.py
• Check your code against PEP8
• Brought back from the dead!
sixfeetup.com/deploy2010
24. pep8.py
$ pep8 example-pep8.py
example-pep8.py:1:10: E401 multiple imports on one line
example-pep8.py:3:1: E302 expected 2 blank lines, found 1
example-pep8.py:4:80: E501 line too long (91 characters)
example-pep8.py:9:16: E225 missing whitespace around operator
example-pep8.py:10:5: E301 expected 1 blank line, found 0
example-pep8.py:10:35: E251 no spaces around keyword / parameter equals
example-pep8.py:11:26: W601 .has_key() is deprecated, use 'in'
sixfeetup.com/deploy2010
25. pep8.py
$ pep8 --ignore=W601,E301 example-pep8.py
example-pep8.py:1:10: E401 multiple imports on one line
example-pep8.py:3:1: E302 expected 2 blank lines, found 1
example-pep8.py:4:80: E501 line too long (91 characters)
example-pep8.py:9:16: E225 missing whitespace around operator
example-pep8.py:10:35: E251 no spaces around keyword / parameter equals
sixfeetup.com/deploy2010
26. Pyflakes
• Fast
• Catch common mistakes
sixfeetup.com/deploy2010
27. Pyflakes
$ pyflakes example-pyflakes.py
example-pyflakes.py:4: invalid syntax
for directory in os.listdir('.')
^
sixfeetup.com/deploy2010
28. Pylint
• More in depth
• Knows about your code
sixfeetup.com/deploy2010
29. Pylint
$ pylint example-pep8.py
************* Module example-pep8
C: 4: Line too long (91/80)
C: 1: Missing docstring
C: 1: Invalid name "example-pep8" (should match (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$)
C: 9:WidgetMaker.__init__: Operator not preceded by a space
whatzit=None
^
W: 9:WidgetMaker.__init__: Unused variable 'whatzit'
W: 8:WidgetMaker.__init__: Unused variable 'blerg'
C: 10:WidgetMaker.blerg_list: Missing docstring
E: 11:WidgetMaker.blerg_list: Instance of 'WidgetMaker' has no 'blerg' member
E: 12:WidgetMaker.blerg_list: 'continue' not properly in loop
E: 13:WidgetMaker.blerg_list: Instance of 'WidgetMaker' has no 'blerg' member
R: 3:WidgetMaker: Too few public methods (1/2)
W: 1: Unused import sys
W: 1: Unused import os
Report
======
10 statements analysed.
Global evaluation
-----------------
Your code has been rated at -15.00/10
sixfeetup.com/deploy2010