Articles tagged in programming

  1. Absolute URLs in Feeds in Pelican

    I am still tinkering with Pelican 2 weeks after migrating this blog from WordPress. There are a few things just aren't right but fortunately it is written in Python, has a basic plugin architecture and is easy to mock around to produce the result I am looking for. One issue I had was absolute URLs in the feeds. I much prefer to write with relative URLs if possible, and previously wrote URL Absolutifier WordPress Plugin to fix up links in the RSS / Atom feeds. Googling around I couldn't find anything similar for Pelican so I decided to roll my own.

    Here it is. A bit hack'ish with monkey patching the feedgenerator library, but hey, it works :)

    Installation steps:

    1. Download the plugin file

    2. Save it to your plugins directory.

    3. Add 'urlabsolutifier' to PLUGINS in your

    That's it! If you are not sure how to install plugins for Pelican here is the doco. All your relative anchor tags and image tags will now have absolute URL in the feeds.

  2. OOP is Distracting

    Don't Distract New Programmers with OOP.

    The shift from procedural to OO brings with it a shift from thinking about problems and solutions to thinking about architecture. That's easy to see just by comparing a procedural Python program with an object-oriented one. The latter is almost always longer, full of extra interface and indentation and annotations. The temptation is to start moving trivial bits of code into classes and adding all these little methods and anticipating methods that aren't needed yet but might be someday.

    Haven't I seen that all too often on that project that I have worked on over the past 10 years?! Premature optimisation is the root of all evil. Unnecessary architecting the solution won't be too far from that.

  3. Vicious Cycle of Dirty Code

    Via Hacker News, Chad Austin: 10 Pitfalls of Dirty Code.

    1. Dirty code does not scale to larger teams.
    2. Dirty code reduces team morale.
    3. Dirty code makes programmers slower.
    4. Dirty code inhibits the formation of an ownership culture.
    5. If product concepts are not reflected in the code, programmers might implement features in ways that don't make sense in the product.
    6. Dirty code incentivizes the business to invest in tangential revenue work rather than attacking core business problems.
    7. Even with good automated test coverage, dirty code increases the risk of introducing regressions.
    8. Wide or unclear dependencies reduce the quality of tests.
    9. Dirty code hides real bugs.
    10. Dirty code gets dirtier.

    And his final thought:

    "Well, what can I do about it?" First, try to pay attention to your code. After you finish writing some, ask yourself "Could I make this clearer?" Then ask your neighbor the same question.

    Only if it is as trivial! Currently working on dirty code lingered over the past 10 years, and have no opportunity to fix it, due to the fact that the company has always been pushing for products and features first. Hacks can be fixed later -- well they never get fixed when you do not reserve your developers' time on refactoring.

    Teams are messily structured that the management assumes "everyone should be able to work on anything". That throws any code ownership out of window. That leads to reduced motivation. When I don't get motivated to make code better -- even more dirty code gets produced.

    It's a vicious cycle. That sucks.

  4. Joel Spolsky and Jeff Atwood on Learning C

    Stackoverflow Podcast #2, where Joel Spolsky argued that all developers should learn C starting at around 39min. His argument is, that it is like driving with a stick and know about the mechanics, coding in C (or easy-to-use assemble) helps you to understand what's going on under the bonnet, where …
  5. Google App Engine - AWS Competitor?

    Google has just launched a preview version of Google App Engine, a development platform for your next start-up web-based application that is designed to be scalable. Looks like it is designed to compete against Amazon Web Services, and it includes the full suit of development stack, including: Web serving environment …
  6. Update - Permalink Redirect and ESVPopup

    Two small updates on my code snippet collections. Permalink Redirect 0.8.4 I have updated Permalink Redirect plugin to 0.8.4. The main functionality of this plugin has been replaced by WordPress' redirect_canonical() function since WP 2.3, but somehow some people are still using this plugin for …
  7. Java is Considered Bad for Computer Science

    Via Reddit, Who Killed the Software Engineer? "One of the most ill-considered steps that universities took was to adopt Java as the most widely used language in introductory programming courses..." Why are the universities replacing Miranda/Haskell/Modula-2 with Java/C#? Because that's what the IT industry uses, but not …
  8. Amazon SimpleDB

    Amazon SimpleDB -- released last week that provides access to a scalable storage of structured data via a REST API, which runs along side with EC2 and S3 to provide the "scalable backend" for online applications. Comments over the weekend have ranged from "it sucks" to "who needs Oracle/MSSQL/DB2 …
  9. Agile Programming according to Dilbert

    What exactly is Agile Programming Methodology anyway? During interview for developers, we usually asked our candidates their preferred development methodology and whether they have heard of agile programming, although we are not structurally practising any of these unstructural programming methodology anyway (just that they are buzzwords these days and nothing …
  10. Stuck

    On the left hand side, we have multiple vulnerabilities with PHP release 5.2.1 or less. Remote attackers might be able to exploit these issues in PHP applications making use of the affected functions, potentially resulting in the execution of arbitrary code, Denial of Service, execution of scripted contents …
  11. Mark Pilgrim's Translation of DHH vs. Al3x

    Mark Pilgrim took the John Gruber-style translation of DHH's response to Al3x/Twitter's issue with Rails' scalability. One of the funnies posts I have seen recently. "My ego is the size of Montana." Now, if that is the size of DHH's ego, I wonder what is the size of collective …
  12. Twitter is Slow, but not because of Ruby

    Jeff Atwood commented on the Twitter scalability problem and blamed on Ruby's slowness. I have quoted from Coding Horror a few times (in my other blogs as well), but I still do not get how his opinions can be so highly regarded in programming community, when he cannot even distinguish …
  13. Is Computer Science Dead?

    The Age: Is computer science dead? Because things are more automated, and most tasks only require drag and click? It is like arguing mechanical engineering is dead because wheels have been invented -- by no means! As mechanical engineering does not train you to just produce machines, computer science does not …
  14. Solving the Fizz-Buzz Question

    Coding Horror: Why Can't Programmers.. Program?. It's a shame you have to do so much pre-screening to have the luxury of interviewing programmers who can actually program. It'd be funny if it wasn't so damn depressing. He quoted Irman's FizzBuzz question, a trivial programming problem but surprisingly has stumbled many …
  15. Trackback 'Em All 0.1 Released

    I have just released Trackback 'em All 0.1. It is basically an RSS/Atom feed to pingbacks/trackbacks converter. It fetches a list of RSS/Atom feeds, scan through the entries, and send pingback/trackback to all external links in the feed entries. I have actually been using it …
  16. The Inner-Platform Effect

    Daily WTF: The Inner Platform Effect -- "The Inner-Platform Effect is a result of designing a system to be so customizable that it ends becoming a poor replica of the platform it was designed with." Way too many examples these days. Think Java-based enterprise systems that can be configured into everything …
  17. Shooting Yourself in the Foot in Programming Languages

    How to shoot yourself in the foot in any programming language. Very funny (if you happen to acquire different programming languages on your belt). For example, "Perl -- You shoot yourself in the foot, but nobody can understand how you did it. Six months later, neither can you.", and "Python -- You …
  18. IronPython 1.0 Released

    IronPython 1.0 has been released. IronPython has been on my "to-play" list ever since the start of this project, and being an "old school" developer I would love to take a look on .NET.
  19. Closures are dangerously powerful

    Christopher Diggins on closures and anonymous functions: ... closures have a very clear downside: they increase code coupling. Passing a single closure can extend the lifetime of massive numbers of objects, leading to a huge performance hit. Closures are a very powerful feature, but dangerously so. They are arguably too easily …
  20. Zawodny on Python or Ruby

    Jeremy Zawodny asked "Ruby or Python", when trying to pick up a new language to add into his collection of tools. Many have contributed comments, and so far there seems to be more Python people on board, even though many have tried to comment subjectively (Ian Bicking for example). Interesting …