This website uses cookies to ensure you get the best experience on our website. Learn more

Stop Writing Classes

x

Stop Writing Classes

Jack Diederich
Classes are great but they are also overused. This talk will describe examples of class overuse taken from real world code and refactor the unnecessary classes, exceptions, and modules out of them.
x

Antonio Verardi - Write more decorators (and fewer classes)

Write more decorators (and fewer classes)
[EuroPython 2017 - Talk - 2017-07-11 - Anfiteatro 2]
[Rimini, Italy]

In the wake of famous talk “Stop Writing Classes” by Jack Diederich ( I’d like to present a pattern that can be used to design clean and pythonic interfaces for programmers based on replacing single-method classes with decorated functions.

This pattern is already used by some famous frameworks and libraries, like Pyramid ( but I believe it isn’t that well-known to many (even experienced) Python developers and is not as widely used as it deserves.

I’ll show how this pattern can be employed to improve a programming interface which is used by an internal log processing framework at Yelp. This will demonstrate how a more functional approach, leveraging the power of Python decorators, can lead to simpler, more beautiful and easier to understand code.

However, this talk doesn’t suggest giving up classes altogether, but making use of them only when they are truly useful. In fact, the use-case I’m going to analyze will combine classes, functions, and decorators to make the best out of these tools.

Given that the presentation is going to be very code-oriented, the talk is intended for an audience of developers who are already familiar with most Python constructs, including decorators, even though the concept will be briefly introduced at the beginning of the talk. But, if you are one of these people, I promise you that the code will speak for itself.

License: This video is licensed under the CC BY-NC-SA 3.0 license:
Please see our speaker release agreement for details:
x

Jack Diederich - HOWTO Write a Function - PyCon 2018

Speaker: Jack Diederich

A function is a small chunk of code that does useful work. Your job when writing a function is to do it in a way that it easy to read. Based on over 15 years of code reviews here are some tips and guidelines I give again and again.

Slides can be found at: and
x

Stop Writing Classes

x

How to write actually object-oriented python - Per Fagrell

The multi-paradigm flexibility of Python can bite developers new to Python or object-orientation, since self-restraint and design know-how is needed to keep code style paradigm-consistent. Learn about OO principles like SOLID and Tell-Don't-Ask and how they apply in Python for more uniform, testable, and working OO code.

Raymond Hettinger - Dataclasses: The code generator to end all code generators - PyCon 2018

Speaker: Raymond Hettinger

The PEP 557 dataclasses module is available in starting in Python 3.7. It will become an essential part of every Python programmer's toolkit. This talk shows what problem the module solves, explains its key design decisions, and provides practical examples of how to put it to work.

Dataclasses are shown to be the next step in a progression of data aggregation tools: tuple, dict, simple class, bunch recipe, named tuples, records, attrs, and then dataclasses. Each builds upon the one that came before, adding expressiveness at the expense of complexity.

Dataclasses are unique in that they let you selectively turn-on or turn-off its various capabilities and it lets the user choose the underlying data store (either instance dictionary, instance slots, or an inherited base class).

Dataclasses and typing.NamedTuple both use variable annotations which were new in Python 3.6.









Slides can be found at: and

Stop Writing Classes

Writing Tip: Stop Writing

UCLA Extension Writers’ Program instructor and fiction writer Daniel M. Jaffe gives a tip for aspiring writers.

Check out his full list of publications and bio here:

STOP WRITING NOVELS

BUY LITTLE BIRDS:

CRITIQUING A FLASH FICTION:

SOCIAL LINKS
PATREON:
FACEBOOK:
TWITTER:
INSTAGRAM:

EQUIPMENT
RING LIGHT:
CAMERA (sorta, mine is discontinued, but this is close):
MICROPHONE:
LAPTOP:

DISCOUNT LINKS FOR SCRIVENER
Mac:
Windows:
CODE: hannahlee
Gonna Start (Version 1) by Kevin MacLeod is licensed under a Creative Commons Attribution license (
Source:
Artist:

Quit Writing Everything Yourself by Evan Lucas, Help.com

Quit Writing Everything Yourself - Evan Lucas, Help.com

Maintaining the separation of business logic and data validation in JavaScript can easily become difficult. Writing similar data validation code over and over again gets boring quite quickly. In this session, we will explore how to generate code that will help take away the busywork of writing data validation and allow developers to focus on writing the business logic.
x

Are Writing Classes Necessary?

Do you need to take writing classes to get published? Are they even helpful? Today I'm sharing my experience with creative writing in academia.


RELATED VLOGS:

Do You Need a Degree to Get Published?:

How to Juggle Writing and School:


WHERE TO FIND ME:

BEYOND THE RED & INTO THE BLACK buy links (where you can buy my books)!

Writability (aka my blog)!

Patreon (where you can get access to extras!):

Twitter (where I spend way too much time)!

tumblr (because pictures! and inspirational thingies!)

Facebook (where you can like me)!

Instagram (because more pictures!)

Goodreads (where you can add my book to your TBR shelf)!

Stop Writing JavaScript Frameworks - Joe Gregorio - OSCON 2015

JavaScript frameworks seem like death and taxes; inevitable and unavoidable. But that's not the way it needs to be, and actually, it must stop. A talk based on the zero framework manifesto:

Slides:

Blog post:

Object Oriented Programming 2 - Classes and Objects

Suggest new or help me make more videos here:

In this lesson we delve into what is a Class and Object is in Object Oriented Programming terms. Using real world examples of Objects we can see how they can be modeled into Computer applications and games. We understand what are attributes and methods of an Object using examples of each.

We go through step by step on the construction of a class file called Player.as, we step through the structure and syntax necessary. We learn about Strictly typed and the use of Constructors. By the end of this lesson you should understand the difference between a Class and an Object.

Python 3's __init__(), self, Class and Instance Objects Explained Concisely

Looking for a concise but thorough explanation of what Python 3's self means? What __init__() in classes does? What Class Objects and Instance Objects are and how they're related? This 8 minute tutorial covers all of these topics and provides a succinct explanation which'll be the only one you ever need!

This tutorial is best followed from start to finish as each point follows on logically from the last.

Python Programming Tutorial - 33 - Classes and Self

Facebook -
GitHub -
Google+ -
LinkedIn -
reddit -
Support -
thenewboston -
Twitter -
x

Introduction to Python Classes

Python classes are collections of variables and functions. Instances of the class can be initialized and customized to store properties, data, or use methods that belong to the class and instance. The tutorial concludes with an example of using a class to do parallel programming with a multi-threaded application (see

Python Classes and Objects || Python Tutorial || Learn Python Programming

Classes are a fundamental part of modern programming languages. Python makes it easy to make a class and use it to create objects. Today you will learn the essentials of programming with classes: how to initialize them, write methods, store fields, and more.

➢➢➢➢➢➢➢➢➢➢
To learn Python, you can watch our playlist from the beginning:

➢➢➢➢➢➢➢➢➢➢
We recommend:
Python Cookbook, Third edition from O’Reilly


The Mythical Man Month - Essays on Software Engineering & Project Management


Shop Amazon Used Textbooks - Save up to 90%


➢➢➢➢➢➢➢➢➢➢
Subscribe to Socratica:

To support more videos from Socratica, visit
Socratica Patreon


Socratica Paypal


We also accept Bitcoin! :)
Our address is: 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9

➢➢➢➢➢➢➢➢➢➢
Python instructor: Ulka Simone Mohanty @ulkam on Twitter
Written & Produced by Michael Harrison
FX by Andriy Kostyuk

Stop writing human error

When your measurements in lab do not work out perfectly, the reason is not human error. There is a specific reason why the results do not match the theory. It's probably not instrumental limitations either.
If you make a mistake with calculations, redo them rather than write that you messed them up.
If you analyze your results properly you should have a reason why your answer is off and how that error impacts the direction of your final answer (too big or too small). It's better to say that your answer is too big than to say that there is an error that makes your answer too big or too small.
Artwork by Hannah Kim
Thanks!

Stop Writing Code - Keith Casey

We are problem solvers. We love looking at the world, seeing a problem, and attacking it with everything we've got. At the end of the day, things work and everyone goes home happy. Except that almost never happens.

As developers, we try to approach every problem with code but we’re limiting ourselves to a single tool in the toolbox. If we tried to understand the details and implications of the problem, we might learn that code is the last thing we should use. This applies in our projects and work and the world as a whole because - as problem solvers - we have responsibilities to the people down the hall, across the street, and even the people sleeping on the street.

Easier Classes: Python Classes Without All the Cruft

Trey Hunner



When bundling up data, sometimes tuples and dictionaries don't quite cut it. Python's classes are powerful tools for data storage and manipulation, but it can take quite a bit of boilerplate code to make a well-behaved Python class. In this talk we're going to discuss how a well-behaved class should work and take a look at a number of helper libraries for creating well-behaved classes.

We'll first see how to make classes with proper string representations, comparability, iterability, and immutability. Then we'll dive into helper tools built-in to the standard library and available in third-party libraries.

We'll look at namedtuple, NamedTuple (not a typo), attrs, and the new Python 3.7 dataclasses.

Most of the libraries discussed in this talk are only available in Python 3, so if you're not using Python 3, hopefully this talk will encourage you to upgrade.

===


A FREE annual conference for anyone interested in Python in and around Ohio, the entire Midwest, maybe even the whole world.

Shares

x

Check Also

x

Menu