Category: Language Specific
-
How to Use C Functions in Python
Did you know you can write functions in C and then call them directly from Python? Isn’t that cool? Let’s skip all the background and the “why would I ever need to do this” for now and just dive on in to the code! Originally posted here on dev.to First, the C Function To demonstrate,…
-
How to Debug Code (with Python Examples)
Often in your programming career, you will inadvertently write flawed code that introduces some fault into your codebase. These faults are called bugs and the activity of fixing bugs is called “debugging.” Of course, as developers, we try to write correct code every time, but writing bugs is simply a fact of life for programmers.…
-
Python Exception Handling and Customization
Like bugs, exceptions are inevitable when developing software, especially as the complexity of that software increases. Sometimes exceptions are surprising, other times we can anticipate them coming. How a program responds to the occurrence of exceptions is called exception handling, and as programmers, we can define and customize exception handling. In this chapter, we’ll learn…
-
Test-Driven Development with Python: a Primer
Making sure the software we build works the way we (and our customers) want it to work is called, unsurprisingly, software testing. Software testing is an enormous topic; indeed, there are entire books, courses, conferences, academic journals, and more about the topic. One can even make a career out of testing software. We couldn’t possibly…
-
Delegate and Decorate in Python: Part 3 – Reusable Decorators
Note: This is not about Python’s language feature called decorators (with the @ symbol), but about the design patterns called “decorator” and “delegate.” In the final installment of this series, we will take the universal concepts of delegation and decoration and put them into a base Decorator class. Doing so will allow us to abstract the universal…
-
Delegate and Decorate in Python: Part 2 – The Decorator Pattern
Note: This is not about Python’s language feature called decorators (with the @ symbol), but about the design patterns called “decorator” and “delegate.” In the previous article, we learned how to implement the Delegation pattern in Python. With this knowledge, we’ll now learn about the Decorator pattern, which will make use of delegation. We’ll learn…
-
Delegate and Decorate in Python: Part 1 – The Delegation Pattern
Note: This is not about Python’s language feature called decorators (with the @ symbol), but about the design patterns called “decorator” and “delegate.” In this series we’re going to learn two very useful design patterns: the delegation pattern and the decorator pattern. Each pattern is useful in that they help us enforce the single responsibility…
-
Stop Worrying About Which Programming Language to Learn First
I remember when I first decided I wanted to learn to write code, my google search history would look like this: Best first programming language What programming language should I learn How to avoid Ebola (unrelated) Python good first language? Ultimately, this time I spent was a waste and I’ll tell you why.
-
Why You Shouldn’t Learn C
Knowledge of the C programming language is often touted as the mark of a “true” programmer. You don’t really know programming unless you know this language, or so the wisdom goes. Many aspiring programmers have been advised by gatekeepers senior developers to learn C to up their skills and bring them to the next level.…
-
C Pointers 101: Part 3 – Pointer Arithmetic
In part 1, we learned the basics of pointers. In part 2, we learned what it meant to pass a variable by value or reference. Remember in part 2 I said that when C passes an array to a function, it passes the pointer to the first element of the array and then pointer arithmetic…