Slides from a short talk given at January 2012 DC.pm. Covers "classic" exceptions in Perl as well as some libraries to make working with exceptions easier.
Code Fast, Die Young, Throw Structured ExceptionsJohn Anderson
The document discusses best practices for exception handling in Perl. It recommends using structured exceptions by throwing objects instead of strings to provide more context. This avoids issues with duplicated error messages. It presents the Exception::Class and Throwable modules which allow defining exception hierarchies as classes or roles. The document also advises throwing exceptions as early as possible and only catching them to handle errors, not for logging.
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.
This document discusses prototypal inheritance in JavaScript. It explains that objects are hashes, and prototypes allow objects to inherit properties from parent objects. The document demonstrates how to define prototypes using Object.create, and shows how this allows child objects to access properties from parents in the prototype chain even if they are not directly defined on the child. It also discusses how classes are an "inconvenient fiction" in JavaScript and are simply constructor functions with methods added to the prototype.
Part of a series of talk to help you write your first Perl 6 program today. So its basic syntax and concepts of its object orientation and a comparison to the widely used P5 OO system Moose which is similar by no accident.
This document provides an overview of JavaScript basics including data types, strings, objects, arrays, functions, and closures. It discusses the history and evolution of JavaScript, from its origins as LiveScript in 1995 to the modern ECMAScript standard. Various JavaScript operators, methods, and built-in objects like window and document are also explained at a high level.
The document discusses XUnit testing and its limitations. It argues that XUnit tests do too much by combining test execution with setup/teardown logic. Generative testing is proposed as an alternative where tests are automatically generated from the domain definition to find edge cases. However, verification is ultimately undecidable due to Rice's theorem, and testing can only improve confidence rather than prove correctness. Functional programming is suggested as a way to constrain the problem domain and make code easier to reason about and test.
Object Oriented got a lot easier since Moose came around.
This keynote is a one-day advanced Moose workshop covering (almost) everything Moose has to offer perl developers
This document discusses error handling in Ruby and Rails. It defines what an error is, how to report errors using exceptions or return values, and how to rescue from errors using begin/rescue/ensure blocks. It also covers topics like raising exceptions, the global error object $!, re-raising exceptions, and ensuring code is always run using ensure.
Code Fast, Die Young, Throw Structured ExceptionsJohn Anderson
The document discusses best practices for exception handling in Perl. It recommends using structured exceptions by throwing objects instead of strings to provide more context. This avoids issues with duplicated error messages. It presents the Exception::Class and Throwable modules which allow defining exception hierarchies as classes or roles. The document also advises throwing exceptions as early as possible and only catching them to handle errors, not for logging.
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.
This document discusses prototypal inheritance in JavaScript. It explains that objects are hashes, and prototypes allow objects to inherit properties from parent objects. The document demonstrates how to define prototypes using Object.create, and shows how this allows child objects to access properties from parents in the prototype chain even if they are not directly defined on the child. It also discusses how classes are an "inconvenient fiction" in JavaScript and are simply constructor functions with methods added to the prototype.
Part of a series of talk to help you write your first Perl 6 program today. So its basic syntax and concepts of its object orientation and a comparison to the widely used P5 OO system Moose which is similar by no accident.
This document provides an overview of JavaScript basics including data types, strings, objects, arrays, functions, and closures. It discusses the history and evolution of JavaScript, from its origins as LiveScript in 1995 to the modern ECMAScript standard. Various JavaScript operators, methods, and built-in objects like window and document are also explained at a high level.
The document discusses XUnit testing and its limitations. It argues that XUnit tests do too much by combining test execution with setup/teardown logic. Generative testing is proposed as an alternative where tests are automatically generated from the domain definition to find edge cases. However, verification is ultimately undecidable due to Rice's theorem, and testing can only improve confidence rather than prove correctness. Functional programming is suggested as a way to constrain the problem domain and make code easier to reason about and test.
Object Oriented got a lot easier since Moose came around.
This keynote is a one-day advanced Moose workshop covering (almost) everything Moose has to offer perl developers
This document discusses error handling in Ruby and Rails. It defines what an error is, how to report errors using exceptions or return values, and how to rescue from errors using begin/rescue/ensure blocks. It also covers topics like raising exceptions, the global error object $!, re-raising exceptions, and ensuring code is always run using ensure.
The document discusses achieving product/market fit. It defines product/market fit as having an offering that matches customer needs at a scale that can be delivered profitably. Achieving product/market fit is important because most startups fail due to not understanding customer needs. The key to product/market fit is repeatedly testing hypotheses about customers and needs before running out of money. This involves clarifying assumptions, identifying risks, understanding customers without solutions, testing solutions, and repeating. The goal is to continuously advance understanding of what customers want.
This document discusses social media strategies for sports organizations and events to monetize through sponsorship. It recommends creating a social media strategic plan aligned with business goals, determining social media influence through metrics like Klout scores, and using social media for sponsorship activation like the MLB Fan Cave. Examples are given of using social media to increase fan engagement for NCAA championships and sports teams.
This document discusses 7 common Thanksgiving food items that may contain hidden gluten: 1) Gravy, as it often contains a flour-based roux; 2) Cranberry sauce, due to potential cross-contamination; 3) Soups, as cream-based soups are thickened with flour and broth-based soups can contain gluten ingredients; 4) Wine, as some are aged in wooden barrels sealed with wheat; 5) Salads, as dressings may contain modified food starch; 6) Turkey, which can be contaminated through marinades or stuffing; 7) Pie fillings, as the filling becomes contaminated from baking in a gluten-containing crust.
Risk management within an organisation is a corporate treasurer’s raison d’être. At the same time, the job of corporate treasury is to create a suitable capital structure of debt and equity to fund the business. Hence, striking a balance between cost and risk is fundamental. This study explores the key macro and financial risks that corporate treasurers of large multinational corporations face and how they intend to manage them over the next 12 months. It examines what the evolving risk landscape means for the day-to-day role of the treasurer, the skill set required of treasury professionals, and the technological trends within corporate treasury.
La escuela primaria "Santiago de Quito" promueve la educación intercultural y bilingüe. Los estudiantes aprenden sobre su entorno natural y cultural a través de actividades como observaciones y dibujos de paisajes. La escuela busca fomentar el aprendizaje y el respeto por la diversidad.
5 Things Everyone Should Know about Low-Calorie SweetenersFood Insight
From the scientific studies to the variety of tastes, this infographic breaks down the essentials about low-calorie sweeteners, especially for those with diabetes or trying to lose weight!
Ipsos MORI Scotland Opinion Monitor - Lockerbie - October 2011Ipsos UK
Two years on from the release of the man convicted of the 1988 Lockerbie bombing, an Ipsos MORI poll finds that the majority of Scots still disagree with the decision to release him.
A empresa de tecnologia anunciou um novo smartphone com câmera aprimorada, maior tela e bateria de longa duração. O dispositivo também possui processador mais rápido e armazenamento expansível. O novo telefone será lançado em outubro por um preço inicial de US$799.
The geographic footprint of innovation is changing dramatically as research and development programs become more global. An overwhelming 94 percent of the world’s largest innovators now conduct elements of their R&D programs abroad, according to the 2015 Global Innovation 1000 study, our annual analysis of corporate R&D spending. These companies are shifting their innovation investment to countries in which their sales and manufacturing are growing fastest, and where they can access the right technical talent. Not surprisingly, innovation spending has boomed in China and India since our 2008 study, when we first charted the global flows of corporate R&D spending. Collectively, in fact, more R&D is now conducted in Asia than in North America or Europe.
For leading companies, implementing a global innovation strategy is paying off. We found that firms that favor a more global R&D footprint outperform their less globalized competitors on a variety of financial measures. This is important, because, as in previous years, we found no statistically significant evidence that higher levels of spending guarantee better results. Our refrain has long been that it’s not how much you spend on research and development, but how you spend it. But it’s also where you spend that determines your success — and our 2015 study shows that decisions about R&D location look very different today than they did less than a decade ago.
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
Section 8 Programming Style and Your Brain: Douglas Crockfordjaxconf
Computer programs are the most complicated things that humans make. They must be perfect, which is hard for us because we are not perfect. Programming is thought to be a "head" activity, but there is a lot of "gut" involved. Indeed, it may be the gut that gives us the insight necessary for solving hard problems. But gut messes us up when it come to matters of style.
The systems in our brains that make us vulnerable to advertising and propaganda also influence our programming styles. This talk looks systematically at the development of a programming style that specifically improves the reliability of programs. The examples are given in JavaScript, a language with an uncommonly large number of bad parts, but the principles are applicable to all languages.
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.
Exception Handling: Designing Robust Software in RubyWen-Tien Chang
The document discusses exception handling in Ruby. It begins with explaining why exception handling is important for building robust software. It then covers various aspects of exception handling in Ruby including raising exceptions, rescuing exceptions, ensuring code is executed, retrying code, and using else blocks. It provides guidelines for proper exception handling practices such as only raising exceptions for unexpected situations. The document concludes by discussing different failure handling strategies like ensuring exception safety and categorizing operational errors versus programmer errors.
Douglas Crockford - Programming Style and Your BrainWeb Directions
Computer programs are the most complicated things that humans make. They must be perfect, which is hard for us because humans are not perfect. Programming is thought to be a “head” activity, but there is a lot of “gut” involved. Indeed, it may be the gut that gives us the insight necessary for solving hard problems. But gut messes us up when it come to matters of style. The systems in our brains that make us vulnerable to advertising and propaganda also influence our programming styles. This talk looks systematically at the development of a programming style that specifically improves the reliability of programs. The examples are given in JavaScript, a language with an uncommonly large number of bad parts, but the principles are applicable to all programming languages.
The document discusses achieving product/market fit. It defines product/market fit as having an offering that matches customer needs at a scale that can be delivered profitably. Achieving product/market fit is important because most startups fail due to not understanding customer needs. The key to product/market fit is repeatedly testing hypotheses about customers and needs before running out of money. This involves clarifying assumptions, identifying risks, understanding customers without solutions, testing solutions, and repeating. The goal is to continuously advance understanding of what customers want.
This document discusses social media strategies for sports organizations and events to monetize through sponsorship. It recommends creating a social media strategic plan aligned with business goals, determining social media influence through metrics like Klout scores, and using social media for sponsorship activation like the MLB Fan Cave. Examples are given of using social media to increase fan engagement for NCAA championships and sports teams.
This document discusses 7 common Thanksgiving food items that may contain hidden gluten: 1) Gravy, as it often contains a flour-based roux; 2) Cranberry sauce, due to potential cross-contamination; 3) Soups, as cream-based soups are thickened with flour and broth-based soups can contain gluten ingredients; 4) Wine, as some are aged in wooden barrels sealed with wheat; 5) Salads, as dressings may contain modified food starch; 6) Turkey, which can be contaminated through marinades or stuffing; 7) Pie fillings, as the filling becomes contaminated from baking in a gluten-containing crust.
Risk management within an organisation is a corporate treasurer’s raison d’être. At the same time, the job of corporate treasury is to create a suitable capital structure of debt and equity to fund the business. Hence, striking a balance between cost and risk is fundamental. This study explores the key macro and financial risks that corporate treasurers of large multinational corporations face and how they intend to manage them over the next 12 months. It examines what the evolving risk landscape means for the day-to-day role of the treasurer, the skill set required of treasury professionals, and the technological trends within corporate treasury.
La escuela primaria "Santiago de Quito" promueve la educación intercultural y bilingüe. Los estudiantes aprenden sobre su entorno natural y cultural a través de actividades como observaciones y dibujos de paisajes. La escuela busca fomentar el aprendizaje y el respeto por la diversidad.
5 Things Everyone Should Know about Low-Calorie SweetenersFood Insight
From the scientific studies to the variety of tastes, this infographic breaks down the essentials about low-calorie sweeteners, especially for those with diabetes or trying to lose weight!
Ipsos MORI Scotland Opinion Monitor - Lockerbie - October 2011Ipsos UK
Two years on from the release of the man convicted of the 1988 Lockerbie bombing, an Ipsos MORI poll finds that the majority of Scots still disagree with the decision to release him.
A empresa de tecnologia anunciou um novo smartphone com câmera aprimorada, maior tela e bateria de longa duração. O dispositivo também possui processador mais rápido e armazenamento expansível. O novo telefone será lançado em outubro por um preço inicial de US$799.
The geographic footprint of innovation is changing dramatically as research and development programs become more global. An overwhelming 94 percent of the world’s largest innovators now conduct elements of their R&D programs abroad, according to the 2015 Global Innovation 1000 study, our annual analysis of corporate R&D spending. These companies are shifting their innovation investment to countries in which their sales and manufacturing are growing fastest, and where they can access the right technical talent. Not surprisingly, innovation spending has boomed in China and India since our 2008 study, when we first charted the global flows of corporate R&D spending. Collectively, in fact, more R&D is now conducted in Asia than in North America or Europe.
For leading companies, implementing a global innovation strategy is paying off. We found that firms that favor a more global R&D footprint outperform their less globalized competitors on a variety of financial measures. This is important, because, as in previous years, we found no statistically significant evidence that higher levels of spending guarantee better results. Our refrain has long been that it’s not how much you spend on research and development, but how you spend it. But it’s also where you spend that determines your success — and our 2015 study shows that decisions about R&D location look very different today than they did less than a decade ago.
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
Section 8 Programming Style and Your Brain: Douglas Crockfordjaxconf
Computer programs are the most complicated things that humans make. They must be perfect, which is hard for us because we are not perfect. Programming is thought to be a "head" activity, but there is a lot of "gut" involved. Indeed, it may be the gut that gives us the insight necessary for solving hard problems. But gut messes us up when it come to matters of style.
The systems in our brains that make us vulnerable to advertising and propaganda also influence our programming styles. This talk looks systematically at the development of a programming style that specifically improves the reliability of programs. The examples are given in JavaScript, a language with an uncommonly large number of bad parts, but the principles are applicable to all languages.
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.
Exception Handling: Designing Robust Software in RubyWen-Tien Chang
The document discusses exception handling in Ruby. It begins with explaining why exception handling is important for building robust software. It then covers various aspects of exception handling in Ruby including raising exceptions, rescuing exceptions, ensuring code is executed, retrying code, and using else blocks. It provides guidelines for proper exception handling practices such as only raising exceptions for unexpected situations. The document concludes by discussing different failure handling strategies like ensuring exception safety and categorizing operational errors versus programmer errors.
Douglas Crockford - Programming Style and Your BrainWeb Directions
Computer programs are the most complicated things that humans make. They must be perfect, which is hard for us because humans are not perfect. Programming is thought to be a “head” activity, but there is a lot of “gut” involved. Indeed, it may be the gut that gives us the insight necessary for solving hard problems. But gut messes us up when it come to matters of style. The systems in our brains that make us vulnerable to advertising and propaganda also influence our programming styles. This talk looks systematically at the development of a programming style that specifically improves the reliability of programs. The examples are given in JavaScript, a language with an uncommonly large number of bad parts, but the principles are applicable to all programming languages.
This document summarizes common Ruby "gotchas", or unexpected behaviors that can trip up developers. It covers topics like string interpolation requiring double quotes, truthiness of values other than false and nil, differences between symbols and strings, accessing characters in strings, variable scope in blocks, freezing arrays, and initializing arrays and hashes with the same object. The goal is to explain behaviors that may surprise those from other languages and help developers avoid potential pitfalls.
This presentation covers various "gotchas" or unexpected behaviors in Ruby that can trip up programmers. It begins with simple gotchas like string interpolation requiring double quotes and progresses to more advanced gotchas. Some of the gotchas discussed include: the difference between symbols and strings, truthy vs falsey values, constant reassignment only issuing a warning, class variable sharing between subclasses, block variable scoping, freezing arrays freezing contents but not elements, bang methods not always returning the expected value, and exceptions using raise/rescue rather than throw/catch. The presentation encourages watching out for these gotchas and referring back to it if Ruby behaves unexpectedly. It offers to add additional gotchas people encounter.
These are slides from a lecture on Red Flags in Programming that took place at an Israeli Open Source Developers meeting.
Red flags in programming are signs that you likely made a mistake with your application design or code.
Noticing and avoiding these mistakes help us write better code, at any language.
The subject related to mostly dynamic (higher level) languages, even though the sample code is in Perl.
Introduction to writing readable and maintainable PerlAlex Balhatchet
An introduction to writing readable Perl code, for people who write Perl that other people may want to read. Covers the most important lessons from Perl Best Practices, and ends by showing how to use Perl::Critic to test that you are meeting the standards set out.
Given at FOSDEM 2011
This document discusses best practices for exception handling, logging, and diagnostics. It emphasizes that exceptions are a communication mechanism, and logging is used to convey exception information. Proper exception handling involves cleanup, logging at key points, and either propagating the exception, attempting recovery, or requesting user action. Throwing informative exceptions, adding context data, and avoiding loss of stack traces are also recommended.
This document provides an overview introduction to the Ruby programming language. It discusses what Ruby is, basic syntax, key features like being dynamically typed and object-oriented, implementations, applications, and the ecosystem. It also covers topics like variables, data types, control flow, methods, classes, and encapsulation. Code examples are provided to demonstrate various language constructs.
This document provides an introduction to the Perl 6 programming language through a hands-on tutorial. It covers basic Perl 6 concepts like values, variables, flow control, and I/O. The tutorial encourages readers to try examples in the Perl 6 REPL to learn through experimentation. It summarizes key features of Perl 6 like its flexible type system for values, scalar and list variables, and built-in data structures like arrays and hashes.
Ruby is a dynamic, open source programming language that was created in 1993 by Yukihiro Matsumoto who wanted to ensure that programming is simple, practical and enjoyable. It combines object-oriented and imperative programming and provides automatic memory management. Some key aspects of Ruby include being dynamically typed, following the principle of least surprise, and being multi-paradigm supporting object-oriented, functional and imperative programming.
The document discusses Modern Perl and how the language has evolved over time. Some key changes include new features like say() in Perl 5.10, improved object orientation with Moose, and improved error handling with modules like autodie. Modern Perl development focuses on stability while still innovating and uses CPAN to share thousands of open source modules.
The document provides an overview of modern Perl features including:
- Using say() instead of print for output
- Defined-or operator //
- switch/given statement for conditionals
- Smart matching with ~~ operator
- state keyword for static variables
- New regex features like named capture buffers
- Object oriented programming with Moose
- Defining classes, attributes, types and inheritance with Moose
- Exception handling with TryCatch and autodie
- Best practices for coding style, layout, testing and more
Duck typing refers to the concept that in a dynamically typed language like Ruby, an object's suitability is based on whether it implements the expected methods or behaviors, rather than its class or type. So if an object "walks like a duck and quacks like a duck," it can be treated like a duck even if it's not an actual Duck class instance.
Similar to Code Fast, die() Early, Throw Structured Exceptions (20)
People are frequently encouraged to get into public speaking to advance their careers -- and public speaking can be great for that. But it can also be hard to figure out how to get started. This talk gives you the inside scoop on the speaker life.
Introduction to Git (even for non-developers)John Anderson
Git is a revision control system that is used for many Open Source projects. Having a basic understanding of Git is essential being able to join an Open Source project and become a contributor. It's also super useful for many other activities! This talk will explore the basics of Git, assuming no existing background experience. Via analogies to other, familiar technolgies, the basic principles of using Git will be explained in an approachable, understandable fashion. People who attend this talk should come away ready to make an initial contribution to an Open Source project, and will leave with a list of additional resources to explore to learn more.
Git is a powerful, critical, yet poorly understood tool that virtually all Open Source developers use. One of the key features that git provides is a powerful and comprehensive log that displays the history of all the changes that have happened in a project, including potential developments that weren't ever merged, details about former versions of software that can inform future development, and even such mundane details as whether development on feature A started before or after development of bugfix B.
Despite the power and utility of git's log, few developers take full advantage of it. Worse, some common practices that developers have adopted in the name of convenience (or just plain cargo culting) can actually destroy this useful information. Moreover, if developers are following the common exhortation to "commit often", they may end up with logs full of uninteresting noise, as all the details of debugging attempts and experiments are inadvertently recorded.
This talk will:
* detail the potential benefits of having informative and well structured logs
* discuss common developer habits that can make logs less useful
* explain techniques to preserve informative development history
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouJohn Anderson
Git is a powerful, critical, yet poorly understood tool that virtually all Open Source developers use. One of the key features that git provides is a powerful and comprehensive log that displays the history of all the changes that have happened in a project, including potential developments that weren't ever merged, details about former versions of software that can inform future development, and even such mundane details as whether development on feature A started before or after development of bugfix B.
Despite the power and utility of git's log, few developers take full advantage of it. Worse, some common practices that developers have adopted in the name of convenience (or just plain cargo culting) can actually destroy this useful information. Moreover, if developers are following the common exhortation to "commit often", they may end up with logs full of uninteresting noise, as all the details of debugging attempts and experiments are inadvertently recorded.
This talk will:
* detail the potential benefits of having informative and well structured logs
* discuss common developer habits that can make logs less useful
* explain techniques to preserve informative development history
A static site generator should be your next language learning projectJohn Anderson
When learning a new language, some folks prefer to read the language documentation, or work through simple exercises like you might find on http://exercism.io — but I prefer to have something more like an actual project. I find that holds my focus a little better, and that I do a better job of absorbing the new language syntax and features if I’m using them for something real.
In this talk, I’m going to outline why writing a static website generator is the perfect task for this sort of language learning project. I’ll cover the code you’ll need to write in order to develop a simple template-based website generation system, and show how this particular project actually manages to hit all the points you need to understand to claim basic understanding of a language.
Do you want to be right or do you want to WIN?John Anderson
The document discusses rebranding a Perl-specific group to appeal to a wider technology audience. It suggests casting a wider net to attract more people by using generic branding that does not lead with Perl. While the group could still keep the "monger" name due to nostalgia, the primary goal at this point should be growth over being right about the branding. Effective marketing is not inherently evil if done to sincerely share knowledge with others.
An Introduction to Git (even for non-developers)John Anderson
Git is a revision control system that is used for many Open Source projects. Having a basic understanding of Git is essential to being able to join an Open Source project and become a contributor. It’s also super useful for many other activities! This talk will explore the basics of Git, assuming no existing background experience. Via analogies to other, familiar technolgies, the basic principles of using Git will be explained in an approachable, understandable fashion. People who attend this talk should come away ready to make an initial contribution to an Open Source project, and will leave with a list of additional resources to explore to learn more.
You got chocolate in my peanut butter! .NET on Mac & LinuxJohn Anderson
Microsoft has open sourced .NET and made it cross-platform on Mac and Linux, and done a surprisingly great job of it. In this talk I'll walk you through creating a simple .NET app — LIVE — on a Mac, and I won't use the mouse even once — that's how good the CLI support is. It's easy, and more importantly, it's useful.
The .NET Core tooling has made a believer of me — come see for yourself just how good the new open source .NET Core is!
A static site generator should be your next language learning projectJohn Anderson
When learning a new language, some folks prefer to read the language documentation, or work through simple exercises like you might find on http://exercism.io -- but I prefer to have something more like an actual project. I find that holds my focus a little better, and that I do a better job of absorbing the new language syntax and features if I'm using them for something *real*.
In this talk, I'm going to outline why writing a static website generator is the perfect task for this sort of language learning project. I'll cover the code you'll need to write in order to develop a simple template-based website generation system, and show how this particular project actually manages to hit all the points you need to understand to claim basic understanding of a language.
Old Dogs & New Tricks: What's New with Perl5 This CenturyJohn Anderson
Perl5? Isn't that language dead? No, wait, wasn't it replaced by Perl6? Neither is true, but if you haven't paid attention to the Perl world since a year beginning with the digit '1', you've missed a lot of great new stuff! This talk will get you up to speed on Perl5 in 2018, with a focus on new language features, best practices, and even why you might want to learn Perl if you don't know it.
Introduction to Git (even for non-developers!)John Anderson
Git is a revision control system that is used for many Open Source projects. Having a basic understanding of Git is essential to being able to join an Open Source project and become a contributor. It's also super useful for many other activities! This talk will explore the basics of Git, assuming no existing background experience. Via analogies to other, familiar technolgies, the basic principles of using Git will be explained in an approachable, understandable fashion. People who attend this talk should come away ready to make an initial contribution to an Open Source project, and will leave with a list of additional resources to explore to learn more.
Git is a revision control system that is used for many Open Source projects. Having a basic understanding of Git is essential to being able to join an Open Source project and become a contributor. It’s also super useful for many other activities! This talk will explore the basics of Git, assuming no existing background experience. Via analogies to other, familiar technologies, the basic principles of using Git will be explained in an approachable, understandable fashion. People who attend this talk should come away ready to make an initial contribution to an Open Source project, and will leave with a list of additional resources to explore to learn more.
Swift was originally released in 2014, and Open Sourced by Apple in late 2015. The Open Source release generated an explosion of community interest and support, resulting in ports to other platforms and significant language changes. Swift version 3, which reflects the results of much of this work, was released in September of 2016, bringing with it some significant refinements to the core language and a new package manager.
Swift is a multi-paradigm language, supporting imperative, functional, and object-oriented programming styles. The language is strongly typed but has extensive support for type inference and substantial tooling available in XCode to identify and in some cases automatically fix common programming errors. Swift uses a memory management strategy called automatic reference counting (ARC), freeing programmers from the tedium of manually managing memory allocation. This combination of strong typing, maximal type inference, automatic reference counting (ARC), and excellent tooling results in an experience that can be described as “the Macintosh of programming languages”.
This talk will present some of the history of the development of Swift with emphasis on how the Open Source release of the language kick-started activity, review the basic syntax of Swift (with comparisons to similar languages that attendees may be more familiar with), and describe what tools are available to help learn the language, including XCode, the Swift REPL available from XCode, and the new Swift Playgrounds for iPad that debuted with Swift 3 and iOS10. After attending this talk, an attendee with no previous Swift experience will understand exactly why they should be excited about this relatively new programming language and be up to date on exactly what they need to do to dive into Swift coding for themselves.
A static site generator should be your next language learning projectJohn Anderson
The document recommends that a static site generator should be someone's next language learning project. It discusses how building a basic static site generator allows one to learn fundamental programming concepts and provides an iterative, incremental way to learn a new language. Static site generators can then be expanded upon to learn more advanced topics like templating, conditional logic, and building full-fledged websites and apps. Regularly learning new languages through such projects is important for lifelong learning.
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouJohn Anderson
Git is a powerful, critical, yet poorly understood tool that virtually all Open Source developers use. One of the key features that git provides is a powerful and comprehensive log that displays the history of all the changes that have happened in a project, including potential developments that weren't ever merged, details about former versions of software that can inform future development, and even such mundane details as whether development on feature A started before or after development of bugfix B.
Despite the power and utility of git's log, few developers take full advantage of it. Worse, some common practices that developers have adopted in the name of convenience (or just plain cargo culting) can actually destroy this useful information. Moreover, if developers are following the common exhortation to "commit often", they may end up with logs full of uninteresting noise, as all the details of debugging attempts and experiments are inadvertently recorded.
This talk will:
* detail the potential benefits of having informative and well structured logs
* discuss common developer habits that can make logs less useful
* explain techniques to preserve informative development history
JSON Web Tokens, or JWTs, are a standardized way of representing a JSON-based data structure and transmitting it between two parties. JWTs rely on cryptographic signatures which ensure that the data transmitted in the JWT isn’t modified during transit. JWTs are designed to be extremely compact—small enough to be transmitted in an HTTP header, for example—and can be used in a variety of ways: as authorization tokens, client-side data storage, or even for the implementation of single sign on (SSO) solutions. They’re based on a very simple and elegant algorithm that’s easy to understand and quickly put to use. JWT implementations are available in virtually every programming language in common use for Web and mobile development.
Unfortunately, learning how to use JWTs can be complicated by the terminology that’s commonly used. “Claims,” “signatures,” “body,” “payload”—a large part of learning how JWTs work is deciphering these buzzwords and understanding how they map onto more familiar programming terms. This talk will focus on reducing this barrier to entry and making JWTs understandable to any programmer.
This talk will cover:
the structure of a JSON Web Token
the algorithm for generating one
available libraries and tooling
some common scenarios where JWTs can be used.
Particular emphasis will be given as to when and why JWTs provide for better solutions than other methods. Attendees should come away from this talk with a full understanding of how to use JWTs for a variety of purposes, and be ready and eager to put JWTs into use in both personal and professional contexts.
Old Dogs & New Tricks: What's New With Perl5 This CenturyJohn Anderson
The document provides a summary of updates and improvements to the Perl programming language from 2001 to 2017. Some key points include:
- After a period of slow development from 2001-2007, Perl saw a "renaissance" starting in 2010 with regular yearly releases and a predictable development cycle.
- Many language improvements were made, such as improved Unicode support, the defined-or operator, non-destructive regular expressions, and subroutine signatures.
- New tools like Perlbrew, plenv, local::lib, and cpanm were created to more easily install and manage Perl versions and modules.
- The talk encourages using a "modern Perl" approach with new tools rather than relying on the
As presented at KCDC 2017:
Swift was originally released in 2014, and Open Sourced by Apple in late 2015. The Open Source release generated an explosion of community interest and support, resulting in ports to other platforms and significant language changes. Swift version 3, which reflects the results of much of this work, was released in September of 2016, bringing with it some significant refinements to the core language and a new package manager.
Swift is a multi-paradigm language, supporting imperative, functional, and object-oriented programming styles. The language is strongly typed but has extensive support for type inference and substantial tooling available in XCode to identify and in some cases automatically fix common programming errors. Swift uses a memory management strategy called automatic reference counting (ARC), freeing programmers from the tedium of manually managing memory allocation. This combination of strong typing, maximal type inference, automatic reference counting (ARC), and excellent tooling results in an experience that can be described as "the Macintosh of programming languages".
This talk will present some of the history of the development of Swift with emphasis on how the Open Source release of the language kick-started activity, review the basic syntax of Swift (with comparisons to similar languages that attendees may be more familiar with), and describe what tools are available to help learn the language, including XCode, the Swift REPL available from XCode, and the new Swift Playgrounds for iPad that debuted with Swift 3 and iOS10. After attending this talk, an attendee with no previous Swift experience will understand exactly why they should be excited about this relatively new programming language and be up to date on exactly what they need to do to dive into Swift coding for themselves.
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouJohn Anderson
Git is a powerful, critical, yet poorly understood tool that virtually all Open Source developers use. One of the key features that git provides is a powerful and comprehensive log that displays the history of all the changes that have happened in a project, including potential developments that weren't ever merged, details about former versions of software that can inform future development, and even such mundane details as whether development on feature A started before or after development of bugfix B.
Despite the power and utility of git's log, few developers take full advantage of it. Worse, some common practices that developers have adopted in the name of convenience (or just plain cargo culting) can actually destroy this useful information. Moreover, if developers are following the common exhortation to "commit often", they may end up with logs full of uninteresting noise, as all the details of debugging attempts and experiments are inadvertently recorded.
This talk will:
* detail the potential benefits of having informative and well structured logs
* discuss common developer habits that can make logs less useful
* explain techniques to preserve informative development history
Friends Don't Let Friends Browse Unencrypted: Running a VPN for friends and f...John Anderson
The document discusses various options for helping non-technical friends and family browse the internet safely, such as using encryption and VPNs. It recommends browser extensions like Privacy Badger to block tracking, enabling two-factor authentication, and using a password manager. The document also discusses setting up a personal VPN using tools like Streisand or Algo that automate the process.
Building Production Ready Search Pipelines with Spark and MilvusZilliz
Spark is the widely used ETL tool for processing, indexing and ingesting data to serving stack for search. Milvus is the production-ready open-source vector database. In this talk we will show how to use Spark to process unstructured data to extract vector representations, and push the vectors to Milvus vector database for search serving.
Best 20 SEO Techniques To Improve Website Visibility In SERPPixlogix Infotech
Boost your website's visibility with proven SEO techniques! Our latest blog dives into essential strategies to enhance your online presence, increase traffic, and rank higher on search engines. From keyword optimization to quality content creation, learn how to make your site stand out in the crowded digital landscape. Discover actionable tips and expert insights to elevate your SEO game.
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on integration of Salesforce with Bonterra Impact Management.
Interested in deploying an integration with Salesforce for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
A Comprehensive Guide to DeFi Development Services in 2024Intelisync
DeFi represents a paradigm shift in the financial industry. Instead of relying on traditional, centralized institutions like banks, DeFi leverages blockchain technology to create a decentralized network of financial services. This means that financial transactions can occur directly between parties, without intermediaries, using smart contracts on platforms like Ethereum.
In 2024, we are witnessing an explosion of new DeFi projects and protocols, each pushing the boundaries of what’s possible in finance.
In summary, DeFi in 2024 is not just a trend; it’s a revolution that democratizes finance, enhances security and transparency, and fosters continuous innovation. As we proceed through this presentation, we'll explore the various components and services of DeFi in detail, shedding light on how they are transforming the financial landscape.
At Intelisync, we specialize in providing comprehensive DeFi development services tailored to meet the unique needs of our clients. From smart contract development to dApp creation and security audits, we ensure that your DeFi project is built with innovation, security, and scalability in mind. Trust Intelisync to guide you through the intricate landscape of decentralized finance and unlock the full potential of blockchain technology.
Ready to take your DeFi project to the next level? Partner with Intelisync for expert DeFi development services today!
HCL Notes and Domino License Cost Reduction in the World of DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-and-domino-license-cost-reduction-in-the-world-of-dlau/
The introduction of DLAU and the CCB & CCX licensing model caused quite a stir in the HCL community. As a Notes and Domino customer, you may have faced challenges with unexpected user counts and license costs. You probably have questions on how this new licensing approach works and how to benefit from it. Most importantly, you likely have budget constraints and want to save money where possible. Don’t worry, we can help with all of this!
We’ll show you how to fix common misconfigurations that cause higher-than-expected user counts, and how to identify accounts which you can deactivate to save money. There are also frequent patterns that can cause unnecessary cost, like using a person document instead of a mail-in for shared mailboxes. We’ll provide examples and solutions for those as well. And naturally we’ll explain the new licensing model.
Join HCL Ambassador Marc Thomas in this webinar with a special guest appearance from Franz Walder. It will give you the tools and know-how to stay on top of what is going on with Domino licensing. You will be able lower your cost through an optimized configuration and keep it low going forward.
These topics will be covered
- Reducing license cost by finding and fixing misconfigurations and superfluous accounts
- How do CCB and CCX licenses really work?
- Understanding the DLAU tool and how to best utilize it
- Tips for common problem areas, like team mailboxes, functional/test users, etc
- Practical examples and best practices to implement right away
Monitoring and Managing Anomaly Detection on OpenShift.pdfTosin Akinosho
Monitoring and Managing Anomaly Detection on OpenShift
Overview
Dive into the world of anomaly detection on edge devices with our comprehensive hands-on tutorial. This SlideShare presentation will guide you through the entire process, from data collection and model training to edge deployment and real-time monitoring. Perfect for those looking to implement robust anomaly detection systems on resource-constrained IoT/edge devices.
Key Topics Covered
1. Introduction to Anomaly Detection
- Understand the fundamentals of anomaly detection and its importance in identifying unusual behavior or failures in systems.
2. Understanding Edge (IoT)
- Learn about edge computing and IoT, and how they enable real-time data processing and decision-making at the source.
3. What is ArgoCD?
- Discover ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes, and its role in deploying applications on edge devices.
4. Deployment Using ArgoCD for Edge Devices
- Step-by-step guide on deploying anomaly detection models on edge devices using ArgoCD.
5. Introduction to Apache Kafka and S3
- Explore Apache Kafka for real-time data streaming and Amazon S3 for scalable storage solutions.
6. Viewing Kafka Messages in the Data Lake
- Learn how to view and analyze Kafka messages stored in a data lake for better insights.
7. What is Prometheus?
- Get to know Prometheus, an open-source monitoring and alerting toolkit, and its application in monitoring edge devices.
8. Monitoring Application Metrics with Prometheus
- Detailed instructions on setting up Prometheus to monitor the performance and health of your anomaly detection system.
9. What is Camel K?
- Introduction to Camel K, a lightweight integration framework built on Apache Camel, designed for Kubernetes.
10. Configuring Camel K Integrations for Data Pipelines
- Learn how to configure Camel K for seamless data pipeline integrations in your anomaly detection workflow.
11. What is a Jupyter Notebook?
- Overview of Jupyter Notebooks, an open-source web application for creating and sharing documents with live code, equations, visualizations, and narrative text.
12. Jupyter Notebooks with Code Examples
- Hands-on examples and code snippets in Jupyter Notebooks to help you implement and test anomaly detection models.
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
5th LF Energy Power Grid Model Meet-up SlidesDanBrown980551
5th Power Grid Model Meet-up
It is with great pleasure that we extend to you an invitation to the 5th Power Grid Model Meet-up, scheduled for 6th June 2024. This event will adopt a hybrid format, allowing participants to join us either through an online Mircosoft Teams session or in person at TU/e located at Den Dolech 2, Eindhoven, Netherlands. The meet-up will be hosted by Eindhoven University of Technology (TU/e), a research university specializing in engineering science & technology.
Power Grid Model
The global energy transition is placing new and unprecedented demands on Distribution System Operators (DSOs). Alongside upgrades to grid capacity, processes such as digitization, capacity optimization, and congestion management are becoming vital for delivering reliable services.
Power Grid Model is an open source project from Linux Foundation Energy and provides a calculation engine that is increasingly essential for DSOs. It offers a standards-based foundation enabling real-time power systems analysis, simulations of electrical power grids, and sophisticated what-if analysis. In addition, it enables in-depth studies and analysis of the electrical power grid’s behavior and performance. This comprehensive model incorporates essential factors such as power generation capacity, electrical losses, voltage levels, power flows, and system stability.
Power Grid Model is currently being applied in a wide variety of use cases, including grid planning, expansion, reliability, and congestion studies. It can also help in analyzing the impact of renewable energy integration, assessing the effects of disturbances or faults, and developing strategies for grid control and optimization.
What to expect
For the upcoming meetup we are organizing, we have an exciting lineup of activities planned:
-Insightful presentations covering two practical applications of the Power Grid Model.
-An update on the latest advancements in Power Grid -Model technology during the first and second quarters of 2024.
-An interactive brainstorming session to discuss and propose new feature requests.
-An opportunity to connect with fellow Power Grid Model enthusiasts and users.
Fueling AI with Great Data with Airbyte WebinarZilliz
This talk will focus on how to collect data from a variety of sources, leveraging this data for RAG and other GenAI use cases, and finally charting your course to productionalization.
Dive into the realm of operating systems (OS) with Pravash Chandra Das, a seasoned Digital Forensic Analyst, as your guide. 🚀 This comprehensive presentation illuminates the core concepts, types, and evolution of OS, essential for understanding modern computing landscapes.
Beginning with the foundational definition, Das clarifies the pivotal role of OS as system software orchestrating hardware resources, software applications, and user interactions. Through succinct descriptions, he delineates the diverse types of OS, from single-user, single-task environments like early MS-DOS iterations, to multi-user, multi-tasking systems exemplified by modern Linux distributions.
Crucial components like the kernel and shell are dissected, highlighting their indispensable functions in resource management and user interface interaction. Das elucidates how the kernel acts as the central nervous system, orchestrating process scheduling, memory allocation, and device management. Meanwhile, the shell serves as the gateway for user commands, bridging the gap between human input and machine execution. 💻
The narrative then shifts to a captivating exploration of prominent desktop OSs, Windows, macOS, and Linux. Windows, with its globally ubiquitous presence and user-friendly interface, emerges as a cornerstone in personal computing history. macOS, lauded for its sleek design and seamless integration with Apple's ecosystem, stands as a beacon of stability and creativity. Linux, an open-source marvel, offers unparalleled flexibility and security, revolutionizing the computing landscape. 🖥️
Moving to the realm of mobile devices, Das unravels the dominance of Android and iOS. Android's open-source ethos fosters a vibrant ecosystem of customization and innovation, while iOS boasts a seamless user experience and robust security infrastructure. Meanwhile, discontinued platforms like Symbian and Palm OS evoke nostalgia for their pioneering roles in the smartphone revolution.
The journey concludes with a reflection on the ever-evolving landscape of OS, underscored by the emergence of real-time operating systems (RTOS) and the persistent quest for innovation and efficiency. As technology continues to shape our world, understanding the foundations and evolution of operating systems remains paramount. Join Pravash Chandra Das on this illuminating journey through the heart of computing. 🌟
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...alexjohnson7307
Predictive maintenance is a proactive approach that anticipates equipment failures before they happen. At the forefront of this innovative strategy is Artificial Intelligence (AI), which brings unprecedented precision and efficiency. AI in predictive maintenance is transforming industries by reducing downtime, minimizing costs, and enhancing productivity.
6. “Classic” Perl exception throwing
• Throw an exception with die()
• Or Carp::croak(), Carp::confess(), etc.
7. “Classic” Perl exception throwing
• Throw an exception with die()
• Or Carp::croak(), Carp::confess(), etc.
• TIMTOWTDI!
8. “Classic” Perl exception throwing
• Throw an exception with die()
• Or Carp::croak(), Carp::confess(), etc.
• TIMTOWTDI!
• Catch an exception with eval {}
9. “Classic” Perl exception throwing
• Throw an exception with die()
• Or Carp::croak(), Carp::confess(), etc.
• TIMTOWTDI!
• Catch an exception with eval {}
• Handle an exception by looking at $@
10. “Classic” Perl exception throwing
1 #! /usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 eval { my $result = this_might_fail() };
7
8 if( $@ ) {
9 # handle the error here
10 }
11
12 sub this_might_fail {
13 die "FAILED!"
14 if rand() < 0.5;
15 }
13. Problems with “classic” Perl exceptions
• $@ can get clobbered
• $@ can get clobbered by code you don’t own
14. Problems with “classic” Perl exceptions
• $@ can get clobbered
• $@ can get clobbered by code you don’t own
• $@ might be a false value
15. Problems with “classic” Perl exceptions
• $@ can get clobbered
• $@ can get clobbered by code you don’t own
• $@ might be a false value
• If $@ is a string, you’re depending on duplicated
information, which will break.
17. Use Try::Tiny for
“semi-modern” Perl exceptions
• Provides try{}/catch{}/finally{} blocks
18. Use Try::Tiny for
“semi-modern” Perl exceptions
• Provides try{}/catch{}/finally{} blocks
• Handles details of properly dealing with complexities
around $@
19. Use Try::Tiny for
“semi-modern” Perl exceptions
• Provides try{}/catch{}/finally{} blocks
• Handles details of properly dealing with complexities
around $@
• Lightweight and generally Just Works(tm).
20. Use Try::Tiny for
“semi-modern” Perl exceptions
• Provides try{}/catch{}/finally{} blocks
• Handles details of properly dealing with complexities
around $@
• Lightweight and generally Just Works(tm).
• N.b.: you have to end try{}/catch{} with a
semicolon. Don’t forget this!
21. Use Try::Tiny for
“semi-modern” Perl exceptions
1 #! /usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Try::Tiny;
7
8 try {
9 my $result = this_might_fail();
10 }
11 catch {
12 # handle the error here
13 };
14
15 sub this_might_fail {
16 die "FAILED!"
17 if rand() < 0.5;
18 }
22. Problems with
“semi-modern” Perl exceptions
• $@ can get clobbered
• $@ can get clobbered by code you don’t own
• $@ might be a false value
• If $@ is a string, you’re depending on duplicated
information, which will break.
23. Problems with
“semi-modern” Perl exceptions
• If $@ is a string, you’re depending on duplicated
information, which will break.
24. Wait, where’s the duplicated information?
1 my $answer;
2 try {
3 # any of these might throw an exception
4 my $this = this_might_fail();
5 my $that = something_else_might_fail();
6 $answer = combine_them( $this , $that );
7 }
8 catch {
9 # our error is in $_
10 if( $_ =~ /some error/ ) {
11 # handle some error
12 }
13 elsif( $_ =~ /another error/ ) {
14 # handle another error
15 }
16 else { # not sure what the problem is, just give up
17 confess( $_ );
18 }
19 };
25. Wait, where’s the duplicated information?
1 my $answer;
2 try {
3 # any of these might throw an exception
4 my $this = this_might_fail();
5 my $that = something_else_might_fail();
6 $answer = combine_them( $this , $that );
7 }
8 catch {
9 # our error is in $_
10 if( $_ =~ /some error/ ) {
11 # handle some error
12 }
13 elsif( $_ =~ /another error/ ) {
14 # handle another error
15 }
16 else { # not sure what the problem is, just give up
17 confess( $_ );
18 }
19 };
26. Wait, where’s the duplicated information?
• As soon as somebody “fixes” the string in some die()
somewhere, you’ve potentially broken exception
handling
27. Wait, where’s the duplicated information?
• As soon as somebody “fixes” the string in some die()
somewhere, you’ve potentially broken exception
handling
• And you can’t even easily tell where, because it’s
probably in a regexp that doesn’t look at all like the
changed string
28. Wait, where’s the duplicated information?
• Even if you have tests for the code in question, do you
really have test coverage on all your exception cases?
29. Wait, where’s the duplicated information?
• Even if you have tests for the code in question, do you
really have test coverage on all your exception cases?
• (Almost certainly not. If you do, come write tests for
$WORK_PROJECT, we need the help...)
31. So what’s the solution?
• die() can also take a reference as an argument
32. So what’s the solution?
• die() can also take a reference as an argument
• So you can die() with an object!
33. So what’s the solution?
• die() can also take a reference as an argument
• So you can die() with an object!
• Which means you can cram all sorts of useful information into your
exceptions
34. So what’s the solution?
• die() can also take a reference as an argument
• So you can die() with an object!
• Which means you can cram all sorts of useful information into your
exceptions
• And more importantly, handle them in a structured fashion that’s much less
brittle than string comparisons
35. A framework for structured exceptions:
Exception::Class
use Exception::Class (
'MyException',
'AnotherException' => { isa => 'MyException' },
'YetAnotherException' => {
isa => 'AnotherException',
description => 'These exceptions are related to IPC'
},
'ExceptionWithFields' => {
isa => 'YetAnotherException',
fields => [ 'grandiosity', 'quixotic' ],
},
);
39. Exception::Class Pros
• Nice declarative syntax
• Possible to declare detailed or simple exception class
hierarchies very simply
40. Exception::Class Pros
• Nice declarative syntax
• Possible to declare detailed or simple exception class
hierarchies very simply
• Supports macro definitions to make throwing particular
exception types easier
43. Exception::Class Cons
• Not really designed for use with Try::Tiny
• Based on Class::Data::Inheritable, not Moose
44. A Moose role for structured exceptions:
Throwable
package Redirect;
use Moose;
with 'Throwable';
has url => (is => 'ro');
...then later...
Redirect->throw({ url => $url });
46. Throwable Pros
• Implemented as a Moose role, so your exception
classes are just normal Moose classes that consume
the role
47. Throwable Pros
• Implemented as a Moose role, so your exception
classes are just normal Moose classes that consume
the role
• So you get the usual Moose-y good stuff around
attributes and methods and such.
48. Throwable Pros
• Implemented as a Moose role, so your exception
classes are just normal Moose classes that consume
the role
• So you get the usual Moose-y good stuff around
attributes and methods and such.
• Comes with a grab-bag of typical exception behaviors
(in Throwable::X), like stack traces, printf-ish
messages, etc.
54. Error Handling
Patterns & Anti-Patterns
• DO use exceptions instead of error flags
55. Error Handling
Patterns & Anti-Patterns
• DO use exceptions instead of error flags
• DO throw exceptions as early as possible
56. Error Handling
Patterns & Anti-Patterns
• DO use exceptions instead of error flags
• DO throw exceptions as early as possible
• DON’T catch exceptions unless you’re going to handle
them – just let them propagate upwards
57. Error Handling
Patterns & Anti-Patterns
• DO use exceptions instead of error flags
• DO throw exceptions as early as possible
• DON’T catch exceptions unless you’re going to handle
them – just let them propagate upwards
• DO design your web application-level error actions to
handle your business logic-level exceptions
58. Use exceptions instead of error flags
1 sub some_catalyst_action :Local {
2 my( $self , $c ) = @_;
3 my $session = get_huge_session_object( $c->session );
4
5 my $validated_params = validate_request_params( $c->request->params )
6 or $c->detach( 'error' );
7
8 my $step_one_result = $c->model('BusinessLogic')->do_step_one( $session , $validated_params );
9 $c->detach( 'error' ) if $session->has_error();
10
11 my $step_two_result = $c->model('BusinessLogic')->do_step_two( $step_one_result, $session );
12 $c->detach( 'error' ) if $session->has_error();
13
14 $c->stash({
15 one => $step_one_result ,
16 two => $step_two_result ,
17 });
18 }
61. Use exceptions instead of error flags
• Forget just one of those checks and you’ve got a hard to track down
bug
62. Use exceptions instead of error flags
• Forget just one of those checks and you’ve got a hard to track down
bug
• Many times, $session was passed just to provide access to that
error flag. Far too much information was being passed around for
no reason
63. Use exceptions instead of error flags
• Forget just one of those checks and you’ve got a hard to track down
bug
• Many times, $session was passed just to provide access to that
error flag. Far too much information was being passed around for
no reason
• The error action gets no real info about what the problem was, or
it tries to pull it from $session itself (which has its own problems)
64. Use exceptions instead of error flags
1 sub some_catalyst_action :Local {
2 my( $self , $c ) = @_;
3
4 try {
5 my $validated_params = validate_request_params( $c->request->params )
6
7 my $step_one_result = $c->model('BusinessLogic')->do_step_one( $session , $validated_params );
8
9 my $step_two_result = $c->model('BusinessLogic')->do_step_two( $step_one_result, $session );
10 }
11 catch { $c->detach( 'error' , [ $_ ] ) };
12
13 $c->stash({
14 one => $step_one_result ,
15 two => $step_two_result ,
16 });
17 }
66. Throw exceptions as early as
possible
• If you’re going to throw an exception because you
didn’t get passed something, do it ASAP.
67. Throw exceptions as early as
possible
• If you’re going to throw an exception because you
didn’t get passed something, do it ASAP.
• In general, the quicker you can die(), the better –
because it reduces the amount of code that might
contain the bug.
69. Don’t catch exceptions
except to handle them
• Most of the time, your business logic code is going to
throw exceptions, not catch them
70. Don’t catch exceptions
except to handle them
• Most of the time, your business logic code is going to
throw exceptions, not catch them
• If you do catch an exception, you should be trying to fix
the problem.
71. Don’t catch exceptions
except to handle them
• Most of the time, your business logic code is going to
throw exceptions, not catch them
• If you do catch an exception, you should be trying to fix
the problem.
• Don’t catch exceptions just to munge them or log them
and re-throw them. Munge them or log them before
you throw them.
73. Web application error actions
should handle exceptions
1 sub error :Private {
2 my( $self , $c , $error ) = @_;
3
4 my $message = 'An unexpected error happened.';
5
6 # NOTE: duck typing
7 $message = $error->user_visible_message
8 if( $error->has_user_visible_message and ! $error->is_private );
9
10 $c->stash({
11 message => $message ,
12 template => 'error',
13 });
14 }
(again, not the best example ever...)
74. Further reading
• Throwable::X: common behavior for thrown exceptions
(<http://rjbs.manxome.org/rubric/entry/1860>)
• Exceptionally Extensible Exceptions
(<http://advent.rjbs.manxome.org/2010/2010-12-03.html>)
• Structured Data and Knowing versus Guessing
(<http://www.modernperlbooks.com/mt/2010/10/structured-data-and-knowing-versus-guessing.html>)