web developer & system programmer

coder . cl

ramblings and thoughts on programming...


mutability on states machines

published: 30-09-2012 / updated: 30-09-2012
posted in: c, c++, development, programming, proview, tips
by Daniel Molina Wegener

The basic definition of a state machine is a set of states S, with a subset of initial states I, another subset of final states F, and a set of transitions between states T, and every state s’Ss”S where ISFS, and each element on T { s’, s”, h }, with s’ as the current state, s” as the next state and h as the state action. On my current automation project where I am using ProView, I have each device controlled by state machines, and each user or automatic control request is queued on a priority queue, where the highest priority is executed replacing any previous execution state, because we have only one communication channel. So the basic state machine definition is not enough to hold every environmental variable that we are using to control each device.

CSDS is comming…

published: 26-09-2012 / updated: 26-09-2012
posted in: development, haskell, programming, projects
by Daniel Molina Wegener

I have started a new project on Haskell. It is called CSDS, or Core Stateful Data Structures. It will hold common functional data structures, mostly based on the implementation described on the book “Purely Functional Data Structures”, but on Haskell I am using type classes and implementing some common interfaces for that kind of data structures. Is very nice to work on project like this, I think that I will use this kind of project on integrations with projects like Cloud Haskell, for distributed processing. For example some of them like the StackLT and QueueLT are providing a class interface to work with the Foldable and Monoid type classes.

if you pay peanuts, you get monkeys

published: 21-09-2012 / updated: 21-09-2012
posted in: development, programming, projects, tips
by Daniel Molina Wegener

How many times did you get an “amazing job offering from an amazing company with an amazing environment, but they want the cheapest employee that they can get”. I have stopped trying to handle that kind of job offerings. Also, I am filtering all of them. Specially that job announce where you read in emphasis “market reference salary”. If they are expecting to pay an average salary, why should I work for them if am over the average? I am a real polyglot programmer that can handle more than three programming language paradigms and over 10 programming languages, and my understanding of programming goes much over the average.

how I won my latest project

published: 19-09-2012 / updated: 19-09-2012
posted in: development, programming, projects, python, tips
by Daniel Molina Wegener

As freelancer I am constantly looking for new projects. Sometimes is hard to find good projects, mainly because not all customers are technical customers, making hard to communicate some aspects of the project, among other stuff like programmer evaluation, without too much technical evaluation, mostly based on his accreditations. One of my latest projects was earned by handling a programming problem on the middle of the interview, I was using Skype to share my screen and allow the customer to review the source code and watch me how I was solving the problem. That was great.

choose C or C++

published: 18-09-2012 / updated: 18-09-2012
posted in: c, c++, development, haskell, programming, tips
by Daniel Molina Wegener

How to choose between C and C++?. The answer is pretty clear. C allows powerful data type abstractions using three star and two star pointers, C++ only allows one star pointers. Also void pointers on C are more powerful once you try to pass abstract parameters to functions and procedures. The abstractions on C++ are built on top of virtual classes and templates, not its data types as C does. So, if you need to create complex data types, for example to handle hardware buffers, you should use C rather than C++, but if you want to create abstractions to manage real life objects, an object oriented interface like C++ does have is pretty good, enough to support almost any object oriented abstraction that you want to implement.

dynamic control on state machines

published: 14-09-2012 / updated: 14-09-2012
posted in: c, c++, development, programming, proview, tips
by Daniel Molina Wegener

We are doing pretty good advances on the ICS/DCS that we are doing. The current code base is using the STL std::priority_queue as operation request queue, but we are changing the task request priority each time that the communication channel is being used by any transition that requests the Profibus channel. We cannot saturate the communication channel with requests, because it runs on a very low bandwidth connection, so each request should be correctly measured, where all operations on the machinery is being directed by states machines with dynamic priorities of execution, and the STL priority queue is doing a good job. But was a little bit complex to think in terms of source code with the model presented as state diagrams and flow control diagrams on a whiteboard, and took me about one week to finish the final skeleton of the primary source code.

start building products

published: 12-09-2012 / updated: 12-09-2012
posted in: development, programming, projects, tips
by Daniel Molina Wegener

If you drive a company and his main business is development as service, have you ever thought on building products?. If you cannot cover the real cost of building a product with your current utilities and you have a well known market where to sell the product, you can start searching for investment, because you have several options to start building a product. You already know developers that you know that can do the product, you already know the market, and you just need to think a little bit more on the product to start building it, and start searching for investment. If you are not capable of do something as searching for investment, you are not probably good enough to make business. There is a related post that I loved, which also I am using as guide to answer many questions related to similar communications that I receive, which is entitled “Dear Programmer, I have an idea”, where the developer as final answer has four key points to review before asking for help on building a project, where he answers “So, either you need to:”