Poetry, in its radical meaning means : showing the stuff you do.
The « Art » and the « way » so dear to greek meant that not all ways of doing are equal : sometimes you can « inspire » by showing a path of lesser pain.
The « way » may be seen as a reference to the common way of doing things : the one best way, and the Art another way of doing more with less.
Yahi : coding as fractal poetry
Being jobless and thus a one man army kind of dev having to code everything alone, to ensure having a result at the end requires a lot of « poetry » and « Art » diverging from the one best way.
It is poetry in its goals, in its documentation, in its python code and naming and javascript code.
I will stress that basically poetry is meant to be perturbing, it is basically for some a synonym of trolling. It is fine for me, and I embrace it.
Poetry in python
It is a one line trick Basically, you transform a log thanks to a named regexp capture into a dict and then you use an addition to aggregate your data.
End of the story.
This is possible thanks to another « poetry » which are python dict (actually Mutable Mappings to be generic) that can add (and substract, divide, multiplied) thanks to the usage of traits.
Here, the God of (mis)fortune made me do a bad decision a long time ago ; try to make a metaphore based on trait.
Dict CAN be made to support linear algebrae in a non surprising way.
Some said : you invented a new algebraic data structure the tree-tor. A fractal-like vector that propagates the operation to the values.
I beg to differ since with a little trick you can restate that an intricated dict is no more than a one level dict, hence ... a Keep It Simple and Simpler algebraic Vector.
Suffice to pose the convention that any intricated dict { a : { b : 1 } } is the same as { ( a , b ) : 1 }.
Hence since you can transform a tree-tor in a vector without loss of information, a treetor is a vector with an expected behaviour of vector.
I actually proposed this to python-ideas as an inclusion to the stdlib, but core devs were less than willing to handle a code without a use that could fail in unexpected ways. And I do understand them.
So yahi, is a troll demo of using dicts to prove that (intricated) dicts that quacks like an algebraic vector, only using ONE operation (__add__) is already neat convenience. This single line is a TROLL by doing.
As a reader of poetry, when poetry is along the cliché, the expected way, it annoys me. I expect surprise, disturbance, perturbation from poetry.
Hence, when I do code poetry I expect to be perturbing, disrupting the « norm ».
Poetry in the naming
Well, trait is a trait, but it collides with the world « trait » meaning an arrow. Hence I decided to be metaphoric in the naming.
Archery based on traits, provides concrete classes of dicts that actually support linear algebrae: it's calleds bows.
I have been living on the american continent, curious of the culture of the native americans that was nowhere to be seen in the museum.
But when I was giving cigarettes away to squidjies on boulevard St Laurent in Montréal, they would tell me awesome stories that were nowhere to be seen.
So, when I read that there used to be a tribe of first nations specialized in archery : the Yahi which existence was wiped away from the surface of earth in the name of gold rush, I decided to use this name as both a reference to archery and the golden rush to the cloud. It is also a way to say fuck to the actual sorry state of the USA regarding the treatment of Native Americans that have my empathy.
It explains why my two main functions are notch to prepare the aggregation and shoot to aggregate. Using traits one line at a time fast to aggregate.
Maybe it is not smart since I may have trouble at the border, but anyway : I am too broke to buy myself a plan ticket to leave my country.
Poetry in design : being amish
I have implemented for companies numerous statistic in « real time » for web applications. It always struck me as overkill to use a multi tiers infrastructure some of which in the cloud to get frequentation data of a website at the second.
Sometimes, as a salaryman this excess of infrastructure was infuriating.
What if, we can simply parse log and make them available with the minimum « OPEX » ? (Operational Expanses).
What is less than using the cloud ? Deploying a local dynamic web server to serve all views required.
What is less than having a flask server ? A single all in one web page.
People in this case expect the full amish solution of static web pages, me I chose a all in one web page in the fashion of javascript driven à la single page app.
Breaking the purity of being actually statique, but not the security promise for people hosting the files as a static assets : no security holes comes from serving the result.
The result being standalone (JS/CSS/assets/HTML) it can even be sent by email as an archive/vizualisation format.
Poetry in javascript
I made to blog post to elaborate how I designed a « single page app behaviour with chained routing ».
The non poetic way to do this is to embedd virtual routing framework and not care how it is done. The one best way is to bloat your HTML page with shitloads of dependance.
I did not care less, I rewrote a full all in one view generator based on the included raw JSON I parse to build and graph everything.
The choice of using D3js (bar charts), and google jsapi (geo chart) instead of matplotlib was obvious to me : they produce great results with less investment in time than by using tools such as matplotlib that are a huge dependance.
Hence by chosing to graph views on the fly with JS libraries, I had already tainted my choice. It was a matter of time to put all the views in one page.
Conclusion
Doing more with less is more than trolling it is also questioning :
- our best practices/one best way;
- since doing without a result is not poetry but intellectual wanking, I worked my ass off that I fixed all the bugs I could before releasing (I need beta testers at this level)
- poetry itself, long boring piece of words don't move me, I think poetry should questions what it has become and focus back on REALISATIONS that DO SOMETHING in a way that raises questions
- while the world is burning, this code aiming at trolling grafana based stacks of data gathering, is also a question about where we go as a profession, with more useless CO2 being generated by our usage by having more and more bloated solutions
And at the end, releasing code that WORKS, DOING as a loser in my lonely dark room is a troll of all these projects coming to realm of free software without evangelists task force, public relations, marketing, famous rocks star developers. It feels great to go on the ring of free software (almost*) alone proving the strength of the ones seen as weak.
It is my poetry to show off what I can do from code to packaging and doc. Poetry is pride, pride is poetry.
Thanks
This project would not have had a refreshing without the help of @19emtuck that wanted to have fun on a project, and @be1 I begged logs to since I don't have a server anymore anywhere. And trust me, it's ridiculously hard to make this kind of project without millions of line of logs to test the robustness of the solution.