2 of Plato’s regimes – MMM Ch. 4

Conceptual integrity is to maintain the good initial ideas, even if it implies not making that many features. This is better than having lots of uncoordinated ideas.

Likewise, functionality and simplicity. Which is better? There have been software projects that have an outstanding performance in one of both.  But we have to say that it’s a combination of simplicity and straightforwardness. Every part must use the same philosophies, same semantics and syntax and the, you have conceptual integrity.

And how, or more precisely, who will achieve that integrity? Either one mind (Surgical team), the equivalent to an aristocracy; or a handful of minds, with a division of architecture and implementation, the equivalent to a democracy.

And it’s no bad to desire a democracy, but it has several problems. The people in charge of the architecture should consider methods to implement their architecture; the implementers, when suggesting ideas must preserve the integrity of the architects.
That’s why at the end, the aristocracy (Surgical team) is better because as long as the design and implementation are clear in the surgeon’s mind, everything is ok. Or at least, an aristocracy of architects, who have a clear idea of how the system should behave, and they should decide how to maintain integrity, even if that means to leave the implementers with practically no voice, at the end, what must endure the most is the design, not the implementation.

Using CC (BY-SA). Published by Jocelyn Kinghorn. From https://www.flickr.com/photos/joceykinghorn/11487085615



The Surgical Team – MMM Ch. 3

The dream: To develop a project with a small team you can know, and trust in their abilities. Forget the big teams, integrated by mediocre developers. In fact, by spending the double on a very good programmer, 10 times the performance could be expected. We can do this all by ourselves. Ah… The dream…

The reality: Big and complex problems need to be done and big teams are needed to do this.

How? Harlan Mills offers a solution. To make several teams, where only one member of each attacks the problem, and the rest only assist him in achieving maximum productivity. You keep a few number of people in the building design, but a lot of them in the actual construction. Just like a surgical team.

Here are the roles of this approach:

  • The surgeon: Define functional and performance specification. Designs, codes, tests the program and writes its documentation.
  • The copilot: Is a less-experienced surgeon. He advises the surgeon, and he can listen to him, or not. He knows the code perfectly but isn’t responsible for it.
  • The administrator: Even though the surgeon is the boss, he needs someone to be in charge of his administrative (Money, personnel, machines…) decisions. The administrator can serve 2 teams.
  • The editor: He writes the external and internal documentation. He reworks the draft of the surgeon.
  • Two secretaries: One for the administrator and the other one for the editor.
  • The program clerk:  He is in charge of the maintenance of the machine and user readable files.
  • The toolsmith: File, text and debugging services. Made fast and with quality
  • The tester: Design test cases and data.
  • The language lawyer: Master of the language selected for development. Can work with 2 or 3 surgeons.

Because the purpose of this team organization such that everyone is represented as just one, the surgeon. At the end, instead of organizing a 200 people team, you just have to deal with 20 surgeons.

Using CC (BY-NC-ND). Published by UCD School of Medicine in https://www.flickr.com/photos/76652722@N04/6878041625

Interpolación de Newton y Lagrange


Ambas interpolaciones son métodos que permiten la creación de un polinomio de grado n-1, donde n es el número de datos que se tienen. Ambos métodos asumen que no existe ruido en sus mediciones de datos, es decir, que el polinomio generado por el método pasara por todas las coordenadas insertadas al método.

A menos que se conozca la función original (Lo cual es prácticamente imposible al aplicarlos en la vida real), no hay manera de calcular algún error.

Justificación y propósito

El propósito de ambos métodos es poder generar una función para la cual se puedan introducir todos los datos originales y obtener 0 error, pues la curva se va modelando punto a punto. Al obtener una función, se puede crear aproximaciones y estimaciones.
(En nuestros métodos, no proporcionamos al usuario la función, solamente el valor f(x) para la x deseada)

El método de Newton utiliza la formula de polinomios de Newton:

N(x)=[y_{0}]+[y_{0},y_{1}](x-x_{0})+\cdots +[y_{0},\ldots ,y_{k}](x-x_{0})(x-x_{1})\cdots (x-x_{{k-1}}).
Donde las “y” entre corchetes se refieren al calculo de diferencias dividas, el cual es un algoritmo usado para computar tablas de funciones logarítmicas y trigonométricas, usando división recursiva.

El método de Larange obtiene una misma función, pero elimina por completo la necesidad de usar diferencias divididas:

L(x):=\sum _{j=0}^{k}y_{j}\ell _{j}(x)


\ell _{j}(x):=\prod _{\begin{smallmatrix}0\leq m\leq k\\m\neq j\end{smallmatrix}}{\frac {x-x_{m}}{x_{j}-x_{m}}}={\frac {(x-x_{0})}{(x_{j}-x_{0})}}\cdots {\frac {(x-x_{j-1})}{(x_{j}-x_{j-1})}}{\frac {(x-x_{j+1})}{(x_{j}-x_{j+1})}}\cdots {\frac {(x-x_{k})}{(x_{j}-x_{k})}},

Los polinomios de lagrange son más fáciles de computar, pues elimina la necesidad de recurrir a métodos de recursión,

Explicación gráfica de la interpolación


Estas gráficas representan dado un conjunto de puntos la interpolación de grado 1 a 4 de una funciócon la intención de obtener el valor de f(10), y cómo se ve reflejado esto en una gráfica.

Para la gráfica a) se hace una interpolación de grado 4, por lo que se utilizan los 5 puntos dados y se obtiene una función que cruce por estos puntos, luego se evalúa en x = 10.

Para la gráfica b) se hace una interpolación cúbica, por lo que sólo se utilizan los 4 puntos más cercanos a 10, se obtiene una función que cruce por estos puntos y se evalúa en x = 10.

Para la gráfica c) se hace una interpolación cuadrática, por lo que sólo se utilizan los 3 puntos más cercanos a 10, se obtiene una función cuadrática que cruce por estos puntos y se evalúa esa función en x = 10.

Para la gráfica d) se hace una interpolación lineal, por lo que sólo se utilizan los 2 puntos más cercanos a 10, se obtiene una función lineal que cruce por estos puntos y se evalúa esa función en x = 10.

Por estas gráficas se puede observar, también, la influencia que tiene el tamaño de la muestra para el resultado.

Diagrama de flujo




Lagrange Intepolation

Código en C++

Ejemplos resueltos

A continuación se muestra los resultados de varias muestras resueltas por ambos métodos:

Con los siguientes puntos:

x, f(x) = (1, 0), (4, 1.386294), (6, 1.791759)

Se interpola usando estos datos para obtener una aproximación de f(5). Estos datos son muestras de la función f(x) = ln(x), por lo que ya conocemos el valor de f(5) = 1.61.


Con Polinomios de Interpolación de Newton se obtienen los valores para b0 … bn y aproximación siguientes:


Para Polinomios de Interpolación de Lagrange se obtienen los coeficientes de Lagrange y aproximación siguientes:


Con los siguientes puntos:

x, f(x) = (1, 1), (2, 0.5), (2.5, 0.4), (4, 0.25), (7, 0.14)

Se interpola usando estos datos para obtener una aproximación de f(3). Estos datos son muestras de la función f(x) = 1/x, por lo que ya conocemos el valor de f(3) = 0.33.


Con Polinomios de Interpolación de Newton se obtienen los valores para b0 … bn y aproximación siguientes:


Para Polinomios de Interpolación de Lagrange se obtienen los coeficientes de Lagrange y aproximación siguientes:


Building the software: Ch. 10 SG

Software architecture provides the technical structure for a project. The time in which the software is mapped to diagrams and prototypes, and the program is partitioned into systems and subsystems.
Everything is described in the software architecture document, that contains the software organization, support for changes, reuse or purchase of components, and design of functionalities.

This document has the following categories:

  • System Overview: Describe the system in general terms. Help build the developer the idea of what is he going to build. As well as a description of the design alternatives that were considered, and why were or weren’t chosen.
  • Conceptual Integrity: Descriptions and diagrams of the almost obvious solution to the problem. Simple, short, and easy.
  • Subsystems and Organization: Here the major clusters of functionality must be defined (Output formatting, data storage, analysis, user input…). Usually a complete system hast five to nine subsystems. The responsibilities of each subsystem are stated, and how are they intercommunicated and restricted.
  • Notation: Describe the notation that will be used for the pseudocode and diagrams (Such as UML)
  • Change Scenarios and Change Strategy: List what parts of the software will need (Most likely) to be changed, and how the team must approach this changes.
  • Reuse Analysis and Build vs. Build Decisions: Define what components are going to be developed from scratch, reused (If available) or bought.
  • Approach to Standard Functional Areas: Functional areas that the architecture must address:
    • External software interfaces: How is the software expected to communicate with other software.
    • User interfaces: How is it isolated, so that the changes made to the interface won’t affect to the system (And reverse).
    • Database organization: Organization and content of the DB.
    • Data storage: Major data structures and what isn’t stored in the DB.
    • Key algorithms: Defined, or for later definition.
    • Memory management: Allocation of memory.
    • String storage: How is the text stored and retrieved.
    • Concurrency/Threads: How is the concurrency going to be handled if the software is multithreaded.
    • Security: Is the software going to operate in a secure environment?
    • Localization: Is the software going to be translated for other countries or regions to use?
    • Networking: Network operations.
    • Portability: Handle other environments (Android/iOS, Windows/UNIX)
    • Programming language: Specific language?
    • Error handling: Strategy to handle errors.
  • Requirements Traceability: Assign each of the requirements to a subsystem.
  • Support for a Staged Delivery Plan: Describe how the project will adjust to support staged delivery. What is going to be delivered on each stage.

Quality Meter: Ch. 9 SG

Let’s do this fast folks, because this chapter was looooooooong.

So, first things first. What is quality? We have to thank McConnel for this simple definition: “the degree to which the software satisfies both stated and implied requirements”. Easy to understand. Perfect.

But why is this important? Because keeping defects controlled affects the development speed, cost and characteristics. A delivered low-quality software increases the cost of end-user support, among other things. McConnel emphasizes in remembering that the end-user tends to forget the delivery time of the software, but not if they liked using it. They forgive taking even taking more time than expected if they will enjoy using the software.

And how to keep the quality up at all times? Using the Quality Assurance Plan. The team must commit to the QA Plan. The activities of the QA must be planed and committed to writing, the QA must be established at least at the same time as the project requirements, a group that will take care of the quality must exist, with capable people, and finally, all the QA activities must be well funded.

And which activities conform the QA Plan?

  • Defect Tracking: Keep record of every defect that is found during development. The moment of detection, and the moment where the defect was resolved (And how). Its important to keep the information public, so the team can adjust the estimates, and see progress.
  • Unit Testing: Testing made by the developer who wrote the code. The unit can refer to any programming entity. It’s informal.
  • Source-Code Tracing: Carried out also by the person who wrote the code. Consist in going through the code, line-by-line, using a debugger.
  • Technical Reviews: This are reviews made by the peers of the code author. Usually are given by the full team, and the QA staff just makes sure this reviews are being carried out. Technical reviews have a pattern:
    • Notification and distribution: The code’s author notifies to the QA team that the work is ready to be reviewed. The material is distributed to the corresponding people.
    • Preparation: Reviewers review the work, using checklists of common errors. They schedule a review meeting.
    • Review meeting: Evaluate the work alongside the developers and a moderator. The main objective is to detect defects.
    • Review report: The results of the meeting are written to paper, committed, and added to the defect tracking.
    • Follow-up: The developer applies the changes, which are evaluated again, and if approved and passes the review, the material is added to the list of materials that have been successfully reviewed.
  • Integration Testing: Test the code developed with already tested code, which has been integrated to the complete system.
  • System Testing: Execute the complete software to find defects. This is by no means a complete way to find all of the defects.

Sometimes companies also use Beta Testing. Even if the book doesn’t recommend it as much as the other tactics (Which are internal), it might be helpful to consider using it, because of the great final-user feedback the developers might receive.

And that’s it. Let’s not stop the testing, until we run out of cake…

Used under CC 2.0 (BY-SA). Published in: https://www.flickr.com/photos/chripell/3409348666

Regresión Polinomial


Como ya fue explicado en el anterior post. La regresión (De cualquier tipo) es utilizada para generar una recta o curva que se ajusta a un diagrama de dispersión. Este diagrama contiene datos previamente capturados.

En el caso de regresión polinomial, el objetivo es crear una función que mejor se adapte a los datos introducidos. El grado de la función es especificado por el usuario.

Justificación y propósito

El propósito de todas las regresiones lineales es encontrar la relación de la variable dependiente con la independiente. Así realizar hipótesis, analizar tendencias y hacer estimaciones. En este caso se introducen términos polinomiales para realizar esta aproximación: a0 + a1*x + a2*x^2 + a3*x^3 + … + am*x^m

Al igual que anteriores métodos de regresión lineal, el error de regresión polinomial se mide a través del error estándar (Sy/x), coeficiente de determinación (r^2)  y el coeficiente de correlación (r).

Diagrama de flujo

Regresión Polinomial

Código en C++

Link a Github.



Ejemplos resueltos con gráficos y cuantificación del error













My comment on: Citizenfour

The first time I’ve heard about this movie was in class. I mean, it’s not like if I didn’t knew Edward Snowden’s story. I read it when it was developing, and followed each of his movements since. But unexpectedly, this movie passed unseen. So, thanks for making me watch it.

And my final verdict is a solid thumbs up. I like it. It’s interesting and very informative. The only problem I found was the difficulty to watch some slow parts. Where ES was just watching the TV, and we didn’t saw the TV, we saw him, and only him watching it. I understand that this is the kind of things that makes people stop the movie and search for more entertaining stuff (Like the new episode of Rick and Morty). And I also understand that this stuff is what makes the audience feel anxious and preoccupied for ES. But after a very long day, of working and accumulated sleep deprivation, I felt I was 3 seconds away from quitting when this scenes appeared, before it change to something else.

But as I said. Final verdict: Thumbs up. Must see for everyone.

Because this films demands being watch, not only by Americans (And not because, as the movie explains, not only them are being spied), but by anyone who cares about freedom and privacy, HER or HIS freedom and privacy.

The interesting stuff this documentary doesn’t doesn’t comment much (Maybe the data wasn’t enough at 2014?), is that this type of espionage has provided almost 0 arrests, and hasn’t prevented not even one terrorist attack. Because, as this Kurzgesagt video explains, (PLEASE WATCH. REALLY. WATCH IT), “If you are trying to find a needle in a hay stack, adding more hay won’t make the search easier”. And looking at all of the citizens data won’t make it easier for security agencies worldwide to protect us from terrorism (It might serve them another purpose). The reality is that all fashion espionage is what works.

And now, go and watch Citizenfour, and then PLEASE watch “Safe and Sorry” video of Kurzgesagt (In fact, watch all of their videos).

Used under CC (BY-NC). Publishen in https://www.flickr.com/photos/screenpunk/15906061651