web developer & system programmer

coder . cl

ramblings and thoughts on programming...


typing is not a problem

published: 10-06-2012 / updated: 12-06-2012
posted in: development, haskell, java, programming, python, rants, tips
by Daniel Molina Wegener

Typing is not a problem. We have many programming languages which are using dynamic typing. Dynamic typing is not so good as you can think. It allows you to do much stuff, where you can evaluate some expressions like (int)"1" + 1 = 2, without type errors. The problem with that kind of flexibility is the fact that there is no standard on boolean evaluations, leading to logic errors, and obviously to program failures. Even in some type-safe programming languages, they allow some stuff like that, there is C++98 and further versions allowing a wide variety of type casts, where any mistake on the casted values can generate logic errors and failures.

my software design principles

published: 05-05-2012 / updated: 06-05-2012
posted in: development, haskell, java, programming, projects, tips
by Daniel Molina Wegener

Most modern applications are providing APIs. That allows you to integrate those applications providing APIs with third party applications and create a real cloud computing environment. From an architectural perspective, we should have at least to have in mind the architectural pattern to be used, design patterns to be implemented, the protocol to use and the data format to expose the API. The architectural pattern should be simple, the design pattern efficient, the protocol lightweight and the data format flexible for your requirements. With a good API design, it should be stable enough to support changes along the time dynamically.

what is thread-safe?

published: 26-11-2011 / updated: 26-11-2011
posted in: c, development, java, programming, tips
by Daniel Molina Wegener

What is thread-safe?. Thread-safe implies that for a given resource it will not be used at the same time by two or more threads or processes. By resource, we must understand a memory block or similar kind of resources. If you create a list that is shared between threads to store data, you will need a way to write that list — appending nodes or removing nodes — without writing it simultaneously. This implies the usage of thread-safety techniques that will bring you sequential access to the list allowing sequential writes, instead concurrent writes that will probably crash your application.

evolutionary unit tests

published: 08-07-2011 / updated: 08-07-2011
posted in: development, haskell, java, programming, tips
by Daniel Molina Wegener

Evolutionary development depends on continuous iterations with the customer, being a final customer or not, like an intern QA engineer. If you create unit tests in your evolutionary development process, you can also work with evolutionary unit tests. An evolutionary unit test can be used on code hardening tasks, because you must make your test fail using unexpected environment behaviour, for example passing null references to your unit tests, avoiding the well known “Null References: The Billion Dollar Mistake”, once the code is refactored to support null references.

considerations in code review

published: 06-07-2011 / updated: 06-07-2011
posted in: development, java, programming, python, tips
by Daniel Molina Wegener

Once we have created code, we can evaluate how it was done. We can use various tools to check our creation among other activities. To do standard checks, we can use style checkers, static checkers, unit testing suites and the most important one, the human code review.

singleton are not dangerous

published: 30-06-2011 / updated: 30-06-2011
posted in: development, java, programming, tips
by Daniel Molina Wegener

Yes, singleton patterns are not dangerous. That pattern is dangerous only for those developers that cannot handle concurrent programming or parallel programming, where you need to manage resources with concurrent access, even if they are read or write. There are some myths related to the singleton pattern, but they are just created by that kind of developers. If you don’t know about concurrent programming techniques, is obvious that your application is at risk if your are using singletons with the wrong implementation. Also it depends on how large is your application, how do you apply governance over you application design and which platform is using.

code hardening techniques

published: 23-02-2011 / updated: 23-02-2011
posted in: development, java, programming, tips
by Daniel Molina Wegener

Do you know something about Test Driven Development?, It is OK, you can reach optimal development performance using TDD, and similar methodologies. You will find yourself developing applications very quickly, but “how hard is your code?”. You can reach very high quality code only using your debugger, making tests is just not enough. Using some debugging techniques, you can find not evident bugs, and you will probably find succesfuly some bugs that can cause your application to core dump — core dump is one of the ugliest forms of application failures, I prefer to think that each application failures is not another thing than a core dump.