<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="3.9.5">Jekyll</generator><link href="https://www.h1alexbel.xyz/feed.xml" rel="self" type="application/atom+xml" /><link href="https://www.h1alexbel.xyz/" rel="alternate" type="text/html" hreflang="en" /><updated>2024-07-17T08:40:31+00:00</updated><id>https://www.h1alexbel.xyz/feed.xml</id><title type="html">h1alexbel</title><subtitle>My blog about Programming</subtitle><author><name>Aliaksei Bialiauski</name></author><entry><title type="html">Collecting big dataset of GitHub repositories with a ghminer</title><link href="https://www.h1alexbel.xyz/2024/05/24/ghminer.html" rel="alternate" type="text/html" title="Collecting big dataset of GitHub repositories with a ghminer" /><published>2024-05-24T00:00:00+00:00</published><updated>2024-05-24T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2024/05/24/ghminer</id><content type="html" xml:base="https://www.h1alexbel.xyz/2024/05/24/ghminer.html"><![CDATA[<p>During research of <a href="https://github.com/h1alexbel/samples-filter">samples-filter</a>, where we try to detect sample
repositories, that mostly contain educational or demonstration materials
supposed to be copied instead of reused as a dependency, we stuck at the
point of dataset collection. GitHub API <a href="https://stackoverflow.com/questions/37602893/github-search-limit-results">can</a>
return only the 1000 results at once. In order to conquer this problem, we
developed <a href="https://github.com/h1alexbel/ghminer">ghminer</a>, a command-line tool that aggregates limitless amount 
of repositories from GitHub, using provided <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens">GitHub PATs</a>.</p>

<!--more-->

<p><img src="/assets/images/2024/05/house.png" /></p>

<p>In order to use <code class="language-plaintext highlighter-rouge">ghminer</code>, let’s install first (you will need <a href="https://nodejs.org/en/download/package-manager">npm</a> installed):</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>npm <span class="nb">install</span> <span class="nt">-g</span> ghminer
</code></pre></div></div>

<p>Then, execute:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ghminer <span class="nt">--query</span> <span class="s2">"stars:2..100000 size:&gt;=20 mirror:false template:false topic:ruby"</span> <span class="se">\</span>
  <span class="nt">--start</span> <span class="s2">"2019-01-01"</span> <span class="se">\</span>
  <span class="nt">--end</span> <span class="s2">"2024-05-01"</span> <span class="se">\</span>
  <span class="nt">--tokens</span> pats.txt <span class="se">\</span>
  <span class="nt">--json</span>
</code></pre></div></div>

<p>Where <code class="language-plaintext highlighter-rouge">stars:2..100000 size:&gt;=20 mirror:false template:false topic:ruby</code> is
the <a href="https://docs.github.com/en/search-github/searching-on-github/searching-for-repositories">search query</a> to the <a href="https://api.github.com">GitHub API</a>, <code class="language-plaintext highlighter-rouge">2019-01-01</code> is a start date to search
the repositories those were created at this date, <code class="language-plaintext highlighter-rouge">2024-05-01</code> is an end to
search the repositories those were created at this date.
<code class="language-plaintext highlighter-rouge">pats.txt</code> is a file that contains a number of your <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens">GitHub PATs</a>, separated by
the line break, should look like this:</p>

<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ghp_pAAAAAA......VCL7wgw
ghp_oBBBBB......XE1ySTKq
</code></pre></div></div>

<p>Depends on the possible captured repositories, the collection process can take
a while. When it’s done, you should have both: <code class="language-plaintext highlighter-rouge">result.csv</code> and <code class="language-plaintext highlighter-rouge">result.json</code>.</p>

<p>That’s it, now you can use it in your researches!</p>

<p>PS. Here is the <a href="https://huggingface.co/datasets/h1alexbel/github-repos">example</a> of collected 14.4k Javascript repositories
(took me ~57min to collect) that were created during 2023-01-01..2024-05-01.</p>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="research" /><summary type="html"><![CDATA[During research of samples-filter, where we try to detect sample repositories, that mostly contain educational or demonstration materials supposed to be copied instead of reused as a dependency, we stuck at the point of dataset collection. GitHub API can return only the 1000 results at once. In order to conquer this problem, we developed ghminer, a command-line tool that aggregates limitless amount of repositories from GitHub, using provided GitHub PATs.]]></summary></entry><entry><title type="html">My Work Environment</title><link href="https://www.h1alexbel.xyz/2024/03/17/my-work-environment.html" rel="alternate" type="text/html" title="My Work Environment" /><published>2024-03-17T00:00:00+00:00</published><updated>2024-03-17T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2024/03/17/my-work-environment</id><content type="html" xml:base="https://www.h1alexbel.xyz/2024/03/17/my-work-environment.html"><![CDATA[<p>This one post I dedicate for myself in order to remember what kind of software I need to install
on my new hardware.</p>

<!--more-->

<p>Let’s start.</p>

<p><a href="https://www.apple.com"><img style="width:75px;height:50px;" src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ffreepngimg.com%2Fdownload%2Fapple%2F58687-logo-computer-apple-icons-free-hd-image.png&amp;f=1&amp;nofb=1&amp;ipt=6b67f1d4e3a1dd672bb36a6d0c6dfbcba5cf3bffb681e8823bfb4c5612f25d31&amp;ipo=images" /></a> <br />
My computer is <a href="https://support.apple.com/en-us/111893">2020 MacBook Pro 13’ with M1 chip</a>.</p>

<p><a href="https://iterm2.com"><img style="width:60px;height:55px;" src="/assets/images/2024/03/iterm.png" /></a>
<a href="https://www.warp.dev"><img style="width:60px;height:60px;" src="/assets/images/2024/03/warp.jpeg" /></a> <br />
Terminals I use are <a href="https://iterm2.com">iTerm 2</a> and <a href="https://www.warp.dev">Warp</a>.
Configured with <a href="https://ohmyz.sh">oh-my-zsh</a> and <a href="https://github.com/romkatv/powerlevel10k">powerlevel10k</a></p>

<p><a href="https://www.jetbrains.com/idea"><img style="width:75px;height:60px;" src="/assets/images/2024/03/idea.webp" /></a> <br />
My main IDE is <a href="https://www.jetbrains.com/idea/buy/?section=personal&amp;billing=yearly">IntelliJ IDEA Ultimate</a>.
My <a href="/assets/settings.zip">settings.zip</a>.</p>

<p><a href="https://arc.net"><img style="width:75px;height:60px;" src="/assets/images/2024/03/arc.png" /></a> <br />
Browser I use daily is <a href="https://arc.net">Arc</a>. Amazing Chrome/Safari/Vivaldi replacement.</p>

<p><a href="https://tug.org/mactex"><img style="width:75px;height:60px;" src="/assets/images/2024/03/latex.webp" /></a> <br />
For document writing and presentations I use <a href="https://tug.org/mactex">LaTeX</a>.
To my knowledge it’s the only system for this purpose.
Usually, I keep all my documents in <a href="https://git-scm.com">Git</a>.</p>

<p><a href="https://github.com"><img style="width:50px;height:50px;" src="/assets/images/2024/03/gh.png" /></a>
<a href="https://telegram.org"><img style="width:50px;height:50px;" src="/assets/images/2024/03/tg.webp" /></a>
<a href="https://slack.com"><img style="width:50px;height:50px;" src="/assets/images/2024/03/slack.png" /></a>
<a href="https://www.hey.com"><img style="width:75px;height:50px;" src="/assets/images/2024/03/hey.png" /></a> <br />
For social and communications I <a href="/2023/10/22/project-as-a-code.html">prefer using GitHub</a>, for chats with normal people I use <a href="https://telegram.org">Telegram</a>, <a href="https://slack.com">Slack</a> and Email over <a href="https://www.hey.com">HEY</a>.</p>

<p><a href="https://1password.com"><img style="width:50px;height:50px;" src="/assets/images/2024/03/1password.png" /></a> <br />
For storing passwords I choose <a href="https://1password.com">1Password</a>.</p>

<p><a href="https://bjango.com/mac/istatmenus"><img style="width:50px;height:50px;" src="/assets/images/2024/03/istat-menus.png" /></a> <br />
<a href="https://apps.apple.com/in/app/istat-menus/id1319778037">iStat Menus</a> helps me monitor my system.</p>

<p><a href="https://rectangleapp.com"><img style="width:50px;height:50px;" src="/assets/images/2024/03/rectangle.png" /></a> <br />
<a href="https://rectangleapp.com">Rectangle</a> for screen management.</p>

<p><a href="https://www.deepl.com/translator"><img style="width:50px;height:50px;" src="/assets/images/2024/03/deepl.png" /></a> <br />
<a href="https://www.deepl.com/translator">DeepL</a> for translations.</p>

<p>As productivity suite I use these apps:</p>
<ul>
  <li><a href="https://www.raycast.com">Raycast</a> provides hotkeys, automation and fast searching. Previously, I used <a href="https://www.alfredapp.com">Alfred 5</a> for this.</li>
  <li><a href="https://apps.apple.com/us/app/flow-focus-pomodoro-timer/id1423210932">Flow</a>, for time controlling</li>
  <li><a href="https://github.com/DevToys-app/DevToys">DevToys</a>, just a swiss army knife for each developer</li>
</ul>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="life" /><category term="programming" /><summary type="html"><![CDATA[This one post I dedicate for myself in order to remember what kind of software I need to install on my new hardware.]]></summary></entry><entry><title type="html">Incremental Codebase Contribution</title><link href="https://www.h1alexbel.xyz/2024/01/05/incremental-contribution.html" rel="alternate" type="text/html" title="Incremental Codebase Contribution" /><published>2024-01-05T00:00:00+00:00</published><updated>2024-01-05T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2024/01/05/incremental-contribution</id><content type="html" xml:base="https://www.h1alexbel.xyz/2024/01/05/incremental-contribution.html"><![CDATA[<p>Software development process must be traceable.
How we start from the <a href="https://www.yegor256.com/2015/11/10/ten-mistakes-in-specs.html">requirements</a>
and how it being converted into a ticket,
then in a <a href="https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request">Pull Request</a>
with a set of commits.
A set.
Not one in the day evening.
Why?
This post answers.</p>

<!--more-->

<p><img src="/assets/images/2024/01/atlanta-couple.png" /></p>

<p>The more reasonable commits you have, the more traceable <a href="https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History">git history</a>
the project will have.
That’s obvious.</p>

<p>But why do ween such “traceable” history of changes?
To trace results right in the middle.
When we have just 1 commit after year/week/day/etc, we don’t have a full “trace” of developers’ thoughts.
Just 0 and 1 state.
We can’t get back and take a look at some unfinished code.
We can’t check the <em>reason</em> why this code is being changed.
It’s not being developed in just one take.
But our history we will have only a squashed final one.</p>

<p>That’s why smart people invent <a href="https://en.wikipedia.org/wiki/Version_control">VCS</a>, including
<a href="https://subversion.apache.org/">SVN (2000)</a>, <a href="https://www.mercurial-scm.org/">Mercurial (2005)</a>
and <a href="https://git-scm.com/">Git (2005)</a>.</p>

<p>By committing every <em>reasonable</em> change, we are doing a good service for our project.
We can trace every ticket, every requirement till commits we create.</p>

<p>Let’s take a look at <a href="https://github.com/l3r8yJ/oop-cop/pull/125">l3r8yJ/oop-cop/pull/125</a>.
It’s a pull request we managed to merge just today.
This one solves this <a href="https://github.com/l3r8yJ/oop-cop/issues/85">l3r8yJ/oop-cop/issues/85</a>.</p>

<p>How its being done:</p>
<ul>
  <li>Project Manager (@zoeself) <a href="https://github.com/l3r8yJ/oop-cop/issues/85">assigned me on the task</a></li>
  <li>I’ve <a href="https://github.com/l3r8yJ/oop-cop/pull/125/commits/fdd0288b7893f21ef76e9d33d9c97b975678dc50">created a dirty skeleton</a> without unit tests</li>
  <li>Then <a href="https://github.com/l3r8yJ/oop-cop/pull/125/commits/0137b8df51f60005843998b3701ac7afbe05b467">added</a> a few tests</li>
  <li>Even <a href="https://github.com/l3r8yJ/oop-cop/pull/125/commits/6f48b1eb2264ebd5d3ea4b987ce06198bf22bb46">more</a> tests</li>
  <li><a href="https://github.com/l3r8yJ/oop-cop/pull/125/commits/627ab1fa727076d0b1600731d109b2d78a3b761a">Introduced</a> a <a href="https://github.com/l3r8yJ/oop-cop/pull/125/commits/a290d681fa75e91edbe69ccf7f275660ce1060a1">few</a> puzzles, and <a href="https://github.com/l3r8yJ/oop-cop/pull/125/commits/f9e4fba1783f7fd1f689955329f0598ea79a1804">this one</a> gets resolved according <a href="https://www.yegor256.com/2010/03/04/pdd.html">PDD methodology</a></li>
  <li>Clean it up, so <a href="https://www.qulice.com/">Qulice</a> says <code class="language-plaintext highlighter-rouge">BUILD SUCCEEDED</code>.</li>
  <li>@l3r8yJ approved pull request and @rultor <a href="https://github.com/l3r8yJ/oop-cop/pull/125#issuecomment-1878721917">merged</a> it into <code class="language-plaintext highlighter-rouge">master</code> branch</li>
</ul>

<p><img src="/assets/images/2024/01/oop-cop-commit-log.png" /></p>

<p>This is a traceable development.
Thanks to these <a href="https://cbea.ms/git-commit/">Git commit messages</a>, we can build a thought line.
A reasoning.
This is an incremental contribution.</p>

<p>The result is:</p>
<ul>
  <li>Each person can take a look at how this ticket being resolved</li>
  <li>Puzzles being converted into new tickets</li>
</ul>

<p>So, the more traceable your commits, the more maintainable and transparent is the project.
Many incremental commits a day.
That’s the way.</p>

<p>Check a few more examples:
<a href="https://github.com/eo-cqrs/eo-kafka/pull/429">eo-cqrs/eo-kafka/pull/429</a>:</p>
<ul>
  <li>@l3r8yJ reported a <a href="https://github.com/eo-cqrs/eo-kafka/issues/428">bug</a></li>
  <li>@l3r8yJ <a href="https://github.com/eo-cqrs/eo-kafka/pull/429/commits/f8bf3aa345203c78eea753195efd3a3108fb3933">created</a> a <a href="https://github.com/eo-cqrs/eo-kafka/pull/429/commits/cea2f00aefa3e2d42082436f3c2d1eff82c6089f">few</a> smart commits</li>
  <li>@h1alexbel (me) <a href="https://github.com/eo-cqrs/eo-kafka/pull/429#issuecomment-1685843190">asks</a> about tests</li>
  <li>@l3r8yJ <a href="https://github.com/eo-cqrs/eo-kafka/pull/429/commits/fe52c78899a85dd587f0ffdd913140d4fc4ec591">introduced</a> new puzzles, in order to <a href="https://www.yegor256.com/2015/01/15/how-to-cut-corners.html">cut corners</a></li>
  <li>@h1alexbel (me) <a href="https://github.com/eo-cqrs/eo-kafka/pull/429#pullrequestreview-1588325491">checked again</a>, make a comment</li>
  <li>@l3r8yJ <a href="https://github.com/eo-cqrs/eo-kafka/pull/429#discussion_r1300937458">responds</a> me back, we merged</li>
</ul>

<p><a href="https://github.com/objectionary/eo/pull/2731">objectionary/eo/pull/2731</a>:</p>
<ul>
  <li>I found an old <a href="https://github.com/objectionary/eo/issues/2422">issue</a></li>
  <li>Created a few commits including <a href="https://github.com/objectionary/eo/pull/2731/commits/1bedabd87023b1b0d4eb31f2d693b80de2e65913">skeleton</a>, <a href="https://github.com/objectionary/eo/pull/2731/commits/bd4dbaec0010e885940ee70fc88bec1003b51b44">adding/removing</a> object from <code class="language-plaintext highlighter-rouge">Place.java</code></li>
  <li><a href="https://github.com/objectionary/eo/pull/2731/commits/84fb590e0e142987329aea05f669ef0e1216ac94">Reported</a> a broken test with <code class="language-plaintext highlighter-rouge">@Disabled</code> + puzzle, as explained <a href="https://www.yegor256.com/2023/07/25/contribute-disabled-tests.html">here</a></li>
  <li>@maxonfjvipon <a href="https://github.com/objectionary/eo/pull/2731#pullrequestreview-1796502306">asked</a> me to resolve code duplication inside <code class="language-plaintext highlighter-rouge">Place.java</code> that task also <a href="https://github.com/objectionary/eo/issues/2422">mentioned</a></li>
  <li>I <a href="https://github.com/objectionary/eo/pull/2731/commits/25c022263132d9917ed8ad5349ae82ba38c9f05d">fixed</a> that, requested a re-review</li>
  <li>@maxonfjvipon approved</li>
  <li>@yegor256 (an Architect) approved too and @rultor merged</li>
</ul>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="programming" /><category term="productivity" /><category term="pdd" /><summary type="html"><![CDATA[Software development process must be traceable. How we start from the requirements and how it being converted into a ticket, then in a Pull Request with a set of commits. A set. Not one in the day evening. Why? This post answers.]]></summary></entry><entry><title type="html">HTML Templating on Top of RESTful API</title><link href="https://www.h1alexbel.xyz/2023/11/19/templating-on-top-of-api.html" rel="alternate" type="text/html" title="HTML Templating on Top of RESTful API" /><published>2023-11-19T00:00:00+00:00</published><updated>2023-11-19T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2023/11/19/templating-on-top-of-api</id><content type="html" xml:base="https://www.h1alexbel.xyz/2023/11/19/templating-on-top-of-api.html"><![CDATA[<p>Designing a beautiful frontend requires HTML and CSS only.
But while constructing some app, eventually we end up with 
<a href="https://en.wikipedia.org/wiki/Single-page_application">SPAs</a> or
<a href="https://asperbrothers.com/blog/spa-vs-mpa/">MPAs</a>.
Why?
I think we can simplify all of this stuff, going “back”
to templated HTML pages, rendering all your objects there.</p>

<!--more-->

<p><img src="/assets/images/2023/11/broen-sourcing.png" /></p>

<h2 id="problem">Problem</h2>

<p>Nowadays, all modern Frontend frameworks are completely
displaced HTML templates we had in the MVC era.</p>

<p>What have we got?</p>
<ul>
  <li>Components</li>
  <li>Handlers</li>
  <li>Services and other great code bloaters.</li>
</ul>

<p>All of them are help only to violate Thin Client Pattern
by adding extra complexity on plain HTML most of us need it these days.</p>

<blockquote>
  <p>By keeping all the code inside one simple monolith,
we can boost productivity and reduce the time
required to deliver full-stack features to the end-users.</p>
</blockquote>

<p>The main problem is that this extra complexity is not required.
For most of us.
And we want to reduce delivery time by utilizing the power
of a team that consists just of a few programmers and designers.
The team where each programmer can deliver full-stack
features.
Right from the backend to the Frontend part.</p>

<h2 id="whats-wrong-with-mvc">What’s Wrong With MVC?</h2>

<p>No SPAs/MPAs, lets get back to MVC!
Our backend now will be responsible for aggregating objects and
placing them into HTML Templates and rendering nice HTML pages.
Plain Old MVC!</p>

<p>Don’t rush it.</p>

<p>MVC is not the best here, I believe.
Well, HTML Templating is a good idea,
it will improve your app from simplicity side, 
and so, but <del>most</del> all modern Web Frameworks will force you
to not have an API in that case.
Instead, you will have a Controllers that return
you HTML templates, you will <a href="https://www.yegor256.com/2016/12/13/mvc-vs-oop.html">manage</a> your model
to place all its fields to that template.</p>

<p>The result of that is that other apps cannot integrate you,
only <a href="https://en.wikipedia.org/wiki/Web_crawler">crawl</a>, maybe.</p>

<p>Ideally, application should expose both interfaces:
Web pages to the end-users, a.k.a User Interface,
and an API, objects that your application stores/handles/sources.
That’s the separation of concerns.
That’s the best scenario.</p>

<p>What options do we have for this one?
For now, I think we have only one option that will do this:
<a href="https://www.yegor256.com/2014/09/09/restful-web-sites.html">XML+XSLT+HTML</a>.</p>

<p>And that one is not ideal either.
A way more complex, and <del>there is no JSON</del> have certain limitations.</p>

<h2 id="conceptual-solution">Conceptual Solution</h2>

<p>Imagine you have an Application, written in Java, that needs to be able to render users.
First, let’s define a RESTful endpoint that will return us JSON response:</p>
<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>GET /api/v1/users
</code></pre></div></div>
<p>And write some code for our “controller” (it is a conceptual code from <a href="https://github.com/l3r8yJ/towers">@l3r8yJ/towers</a>):</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">new</span> <span class="nc">ApiRouteOf</span><span class="o">(</span><span class="s">"/api/v1/users"</span><span class="o">,</span> <span class="k">new</span> <span class="nc">JsonUsers</span><span class="o">(...)).</span><span class="na">serve</span><span class="o">();</span>
</code></pre></div></div>

<p>Running our app, this endpoint should respond to us with JSON like this:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="w">
  </span><span class="p">{</span><span class="w">
    </span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"test1@test.com"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"4b53a171-139c-4808-b61c-fcad879b5084"</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="p">{</span><span class="w">
   </span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"test2@test.com"</span><span class="p">,</span><span class="w">
   </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"a3303252-343c-4c4f-baf1-f4f5a6f333a4"</span><span class="w">
   </span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span></code></pre></div></div>

<p>now we have a RESTful endpoint serves User Resources as JSON,
that we can integrate, process it somehow else, and so on.</p>

<p>And now we need some View/User Interface for this data.
We can do this by “wrapping” the API endpoint
and placing Templates on top of it.
Something like this:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">new</span> <span class="nc">Templated</span><span class="o">(</span>
  <span class="s">"/users.html"</span><span class="o">,</span>
   <span class="k">new</span> <span class="nf">ApiRouteOf</span><span class="o">(</span>
     <span class="s">"/api/v1/users"</span><span class="o">,</span>
      <span class="k">new</span> <span class="nf">JsonUsers</span><span class="o">(...),</span>
      <span class="k">new</span> <span class="nf">Render</span><span class="o">(</span><span class="s">"users"</span><span class="o">)</span>
    <span class="o">)</span>
<span class="o">).</span><span class="na">serve</span><span class="o">();</span>
</code></pre></div></div>

<p>Finally, we create an HTML Template <code class="language-plaintext highlighter-rouge">users.html</code>:</p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;</span><span class="err">%</span> <span class="na">users</span> <span class="nt">&gt;</span>
...
</code></pre></div></div>

<p>Thus, our App can serve both API to integrate and HTML View to the end-users.</p>

<p>This is a concept on which we are <a href="https://github.com/l3r8yJ/towers/issues/8">working</a> right now.
What do you think?
Don’t hesitate to submit your ideas in the comments and <a href="https://github.com/l3r8yJ/towers/issues">here</a>.</p>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="web" /><category term="productivity" /><summary type="html"><![CDATA[Designing a beautiful frontend requires HTML and CSS only. But while constructing some app, eventually we end up with SPAs or MPAs. Why? I think we can simplify all of this stuff, going “back” to templated HTML pages, rendering all your objects there.]]></summary></entry><entry><title type="html">Project as a Code</title><link href="https://www.h1alexbel.xyz/2023/10/22/project-as-a-code.html" rel="alternate" type="text/html" title="Project as a Code" /><published>2023-10-22T00:00:00+00:00</published><updated>2023-10-22T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2023/10/22/project-as-a-code</id><content type="html" xml:base="https://www.h1alexbel.xyz/2023/10/22/project-as-a-code.html"><![CDATA[<p>We’re living in an <a href="https://en.wikipedia.org/wiki/Agile_software_development">Agile</a> world.
Customers trust architects, programmers, designers and other product makers to deliver new software
to the market.
What is the result of this trust?
In the best cases, software doesn’t meet the requirements,
the product is <em>untraceable</em>, onboarding <a href="https://www.youtube.com/watch?v=WwjU1ORdz4s">takes</a> weeks,
and all the members are <em>demotivated</em> and hate their job.
In most cases, customer <a href="https://www.yegor256.com/2017/11/21/trust-pay-lose.html">has nothing</a> out of it.
Enough is enough.
Introducing Project as a Code, the software development philosophy that deals with
project traceability, artifact management and clearness to the customer on what’s going on.</p>

<!--more-->

<p><img src="/assets/images/2023/10/forbrydelsen-board.png" /></p>

<h2 id="traceability-and-clearness">Traceability and Clearness</h2>

<p>The main problem is that we’re trying to solve is that most projects
are untraceable and unclear enough for their crew.</p>

<ul>
  <li>“Why is this decision made?”</li>
  <li>“Why I get less than John doing the same Java coding?”</li>
  <li>“How to check out the code before new feature requests are employed?”</li>
</ul>

<p>We are here for clearness and traceability on your project.</p>

<h2 id="documents-under-control">Documents Under Control</h2>

<p>In 2023, most software teams manage quality gates, a.k.a CI/CD pipelines
in their code.
Why can’t we apply it to the documents we have?
Project as a Code means that.
Each change is controlled since kept in <a href="https://en.wikipedia.org/wiki/Git">git</a> and has to be pass
a merge pipeline before getting into <code class="language-plaintext highlighter-rouge">master</code> branch.</p>

<p>Thus, all the software documents including
<a href="https://www.yegor256.com/2015/11/10/ten-mistakes-in-specs.html">requirements document</a>,
Use-Cases, diagrams, and others can be defined in the source code
and empowered with control and integrity checks,
or even with AI post-analysis tools.</p>

<p>Tickets already <a href="#no-backlog-puzzles-instead">can</a> be defined in the code,
why documents can’t be?</p>

<p>Here are a few ideas of how it can be defined:</p>

<p>The project definition:</p>
<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">project</span><span class="pi">:</span>
  <span class="na">name</span><span class="pi">:</span> <span class="s">ai-secret</span>
  <span class="na">description</span><span class="pi">:</span> <span class="s">AI Secret Project</span>
  <span class="na">budget</span><span class="pi">:</span> <span class="s">1mil$</span>
  <span class="na">private</span><span class="pi">:</span> <span class="no">true</span>
  <span class="na">date</span><span class="pi">:</span>
    <span class="na">start</span><span class="pi">:</span> <span class="s">2023-10-03</span>
    <span class="na">end</span><span class="pi">:</span> <span class="s">2023-11-30</span>
<span class="na">team</span><span class="pi">:</span>
  <span class="pi">-</span> <span class="na">email</span><span class="pi">:</span> <span class="s">aliaksei.bialiauski@hey.com</span>
    <span class="na">roles</span><span class="pi">:</span> <span class="s">ARC</span>
  <span class="pi">-</span> <span class="na">email</span><span class="pi">:</span> <span class="s">john@google.com</span>
  <span class="pi">-</span> <span class="na">roles</span><span class="pi">:</span> <span class="s">DEV</span>
  <span class="pi">-</span> <span class="na">email</span><span class="pi">:</span> <span class="s">mary@gmail.com</span>
  <span class="pi">-</span> <span class="na">roles</span><span class="pi">:</span> <span class="pi">[</span><span class="nv">PM</span><span class="pi">,</span> <span class="nv">PO</span><span class="pi">]</span>
<span class="na">stakeholders</span><span class="pi">:</span> <span class="s">...</span>
</code></pre></div></div>

<p>Use-Case definition example:</p>
<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">name</span><span class="pi">:</span> <span class="s">where User can identify himself</span>
<span class="na">rdql</span><span class="pi">:</span> <span class="pi">|</span>
  <span class="s">The user logins with his credentials, if he has them.</span>
  <span class="s">Otherwise, he registers in the system first.</span>
</code></pre></div></div>

<h2 id="results-are-traceable">Results are Traceable</h2>

<p>Since we have all the stuff in the source code,
we can check, integrate and validate artifacts and results.
Thus, <em>productive</em> work can end only with lines of code, or new documents
but not with new Slack messages or meetings.</p>

<p>Also, a project means a role-based project.
We don’t know how to make customers happy.
Developers know how to develop Java classes;
PMs know how to manage a project.</p>

<p>Since this, a properly managed project’s required not just people, or just programmers.
We need concrete individuals capable in their realms.
The Goal is to find the best and segregate them using simple project roles.</p>

<h2 id="happy-or-quit">Happy or Quit</h2>

<p>All the team members know everything about the project.
They know how to boost their salary, what kind of performance
project expects from them, what are the project risks, and so.
They know what are the rewards.
They know how they will suffer if a task is not completed or deadline missed.
Simply put, they are not slaves kept in the dark.</p>

<p>On the project you are happy and productive, or you <em>quit</em>.</p>

<h2 id="no-backlog-puzzles-instead">No Backlog, Puzzles instead</h2>

<p>Project as a Code inherits <a href="https://www.yegor256.com/2010/03/04/pdd.html">Puzzle Driven Development</a>.
All the bugs kept as puzzles.
Puzzles are defined in source code and discovered
<em>while working</em> on tasks.
Tasks mean new tasks down the road.
But instead of keeping all of them in our minds,
we are simply doing it in the code.</p>

<p>Thus, we are slightly evicting
a PM role from the definition of done.
Now, we are formulating by us, people who know the reality.</p>

<h2 id="ecosystem">Ecosystem</h2>

<p>Moreover, this philosophy can be employed with
a new software development platform for enabling that kind of
productivity for all team members and stakeholders on a project.</p>

<p>We can go even further and make the platform programming language native.
I don’t think it can be Java/Kotlin or TypeScript.
Simply because those langs are good in enterprise/product development,
but we need some sort of DSL, like Ruby and Groovy, or
just plain XML/YAML sheets.</p>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="process" /><summary type="html"><![CDATA[We’re living in an Agile world. Customers trust architects, programmers, designers and other product makers to deliver new software to the market. What is the result of this trust? In the best cases, software doesn’t meet the requirements, the product is untraceable, onboarding takes weeks, and all the members are demotivated and hate their job. In most cases, customer has nothing out of it. Enough is enough. Introducing Project as a Code, the software development philosophy that deals with project traceability, artifact management and clearness to the customer on what’s going on.]]></summary></entry><entry><title type="html">Money in Open Source</title><link href="https://www.h1alexbel.xyz/2023/08/20/money-in-open-source.html" rel="alternate" type="text/html" title="Money in Open Source" /><published>2023-08-20T00:00:00+00:00</published><updated>2023-08-20T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2023/08/20/money-in-open-source</id><content type="html" xml:base="https://www.h1alexbel.xyz/2023/08/20/money-in-open-source.html"><![CDATA[<p>On August 10, 2023, HashiCorp made changes in their products:
by now Terraform and others will be developed
and distributed under <a href="https://www.hashicorp.com/bsl"><strong>Business Source License</strong></a>.
I think this move will scare open source enthusiasts off.</p>

<!--more-->

<p><img src="/assets/images/2023/08/dc.png" /></p>

<p>Open source is a must.
But open source is not about “free” software development.
At all.</p>

<p>I think it’s about quality and reusability.
First you develop on demand: pull requests,
new bugs by strangers from whole the world arrived.
You merge them and a new version of the product gets released.</p>

<p>How to make money on product in open area?
Let me explain my thoughts on this.</p>

<p>I think the best way to do it is to leave your product “free” and open-source
and sell services and service management on top of your product.
HashiCorp is doing the same what I described, maintaining <a href="https://www.terraform.io/"><strong>Terraform</strong></a>
and selling Terraform Cloud or whatever.</p>

<p>While other companies like <a href="https://spacelift.io"><strong>Spacelift</strong></a>, offer the same services as Terraform Cloud.
In terms of business, HashiCorp doing everything OK by restricting license.
So, for instance, Spacelift will be required to pay for Terraform usage after Terraform 1.6.</p>

<p>But along with that, Terraform and other HashiCorp open source products
will lack off quality and enthusiasm in their repos.
I’m not interested in contributing to the product that 
I can’t use if one day I decide to create some service that uses Terraform.</p>

<p>It’s sad.</p>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="oss" /><category term="business" /><summary type="html"><![CDATA[On August 10, 2023, HashiCorp made changes in their products: by now Terraform and others will be developed and distributed under Business Source License. I think this move will scare open source enthusiasts off.]]></summary></entry><entry><title type="html">Don’t Throw All At Once</title><link href="https://www.h1alexbel.xyz/2023/08/13/dont-throw-all-at-once.html" rel="alternate" type="text/html" title="Don’t Throw All At Once" /><published>2023-08-13T00:00:00+00:00</published><updated>2023-08-13T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2023/08/13/dont-throw-all-at-once</id><content type="html" xml:base="https://www.h1alexbel.xyz/2023/08/13/dont-throw-all-at-once.html"><![CDATA[<p>Most developers I met, lacking off various valuable <a href="https://www.yegor256.com/2018/08/29/soft-skills.html"><strong>soft skills</strong></a>.
I’m not talking about some mantra like “be right guy in the office”,
I’m talking about skills like diagramming, presenting, and other skills
that help us in our work.
Let’s stop on presenting skills here.
The best stuff I learned so far about it
is to don’t throw all at once and be a pinpoint at the problem.
Let me explain how it will impact you.</p>

<!--more-->

<p><img src="/assets/images/2023/08/communicate.png" /></p>

<p>Presenting is a skill that you need to actively master as a <a href="https://h1alexbel.github.io/2023/07/28/developer-realms.html"><strong>software developer</strong></a>.
But when you’re presenting your ideas, keep your point very specific and please 
just don’t throw all the facts you want to say.</p>

<p>It’s better to say less, but more specific, strictly connected to one point.
Create a general idea for your keynote and inject it going through the whole speech.</p>

<p>Here are the areas where it can be applicable:</p>

<h2 id="architecting">Architecting</h2>

<p>Instead of showing the full picture, create a simple design
pieces and deliver them continuously.
Your team will learn and puzzle faster, simply because
design sketches will be specific and granular for each task.
Instead of showing how smart you are, focus on a problem.</p>

<h2 id="teaching">Teaching</h2>

<p>When it comes to mentoring somebody,
I’m also making this mistake quite often.
Day to day you need to deliver a little bit of new information.
Otherwise, your students will be overwhelmed of
disconnected in their mind facts.</p>

<h2 id="conference-talks">Conference Talks</h2>

<p>Being in the conference talk, you need to be specific on one thing as only you can.
Thus, people can better understand your ideas, instead of just
shrug and walk away.</p>

<p>If you are a senior developer,
you have to know how to deliver your ideas
to many people in front of you.</p>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="career" /><summary type="html"><![CDATA[Most developers I met, lacking off various valuable soft skills. I’m not talking about some mantra like “be right guy in the office”, I’m talking about skills like diagramming, presenting, and other skills that help us in our work. Let’s stop on presenting skills here. The best stuff I learned so far about it is to don’t throw all at once and be a pinpoint at the problem. Let me explain how it will impact you.]]></summary></entry><entry><title type="html">Developer Realms</title><link href="https://www.h1alexbel.xyz/2023/07/28/developer-realms.html" rel="alternate" type="text/html" title="Developer Realms" /><published>2023-07-28T00:00:00+00:00</published><updated>2023-07-28T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2023/07/28/developer-realms</id><content type="html" xml:base="https://www.h1alexbel.xyz/2023/07/28/developer-realms.html"><![CDATA[<p>How did you deploy software to production?
Did you use Kubernetes?
No, I’m not a DevOps guy, I’m a Developer!
OK, which documents you produce and activities in which you participate
as a software developer besides coding?
I’m just writing code, I’m a Developer.
I’m here a lot these days.
And it’s a very wrong attitude.
Here, in this blog post, I’m saying what you
need to know and regularly practice as a software developer 
to become a <del>CTO</del> self-capable unit of work.</p>

<!--more-->

<p><img src="/assets/images/2023/07/trio.png" /></p>

<p>I strongly believe that being a developer, besides coding, you need to know
how to help your project.
Remember, when coders create lines of code,
professional developers create software that works.
<br />
What are the steps to build from zero some more or less
stable software product?</p>

<p>According to <a href="https://en.wikipedia.org/wiki/Rational_unified_process"><strong>RUP</strong></a>, there are 9 disciplines
in a common software project:</p>
<ul>
  <li>Business Modeling</li>
  <li>Requirements</li>
  <li>Analysis &amp; Design</li>
  <li>Implementation</li>
  <li>Testing</li>
  <li>Deployment</li>
  <li>Configuration &amp; Change Management</li>
  <li>Project Management</li>
  <li>Environment</li>
</ul>

<p>All of them you need to be aware of!</p>

<p>And don’t get me wrong.
It’s not about being Jack of all Trades.
You need to be a niche specialist, a niche-focused <strong>expert</strong>.
Imagine X &amp; Y coords, on X is your disciplines,
while on Y is your tech stack you’re expert in.
<strong>If you are a niche-focused expert,
and at the same time, know all activities in software project,
you will the MVP on each project</strong>.</p>

<p>I’ve summarized all the RUP phases into 
the following disciplines, the developer realms:</p>

<ul>
  <li>Business Modeling</li>
  <li>Requirements</li>
  <li>Design</li>
  <li>Implementation</li>
  <li>Testing</li>
  <li>Deployment</li>
  <li>Configuration</li>
  <li>Project Management</li>
</ul>

<h2 id="business-modeling">Business Modeling</h2>

<p>First things first.
Business modeling.
Here you need to have knowledge of use-cases modeling
and all things related to inception phase.
Try to follow simple rule: docs over talks.</p>

<h2 id="requirements">Requirements</h2>

<p>Then, after business modeling, we need to 
start collecting requirements.
To do it right, you need to know what <a href="https://en.wikipedia.org/wiki/Software_requirements_specification"><strong>SRS</strong></a> is.
Moreover, you need to be aware of <a href="https://www.yegor256.com/2015/11/10/ten-mistakes-in-specs.html"><strong>rules and 
best practices</strong></a> when it comes to requirements.
And again, start preparing the right documents.
I’m usually creating one long README.md file and 
then commit it into git repo.
So, your tooling can be: Git + Markdown/LaTeX.</p>

<h2 id="design">Design</h2>

<p>To become an <a href="https://h1alexbel.github.io/2023/06/11/arc-tools.html"><strong>architect</strong></a>, you definitely need 
to become very successful here.
First, master your UML skills.
You must be able to draw simple UML sketch,
that will be understood by all stakeholders, not only by your developers.
So, simplicity is also your instrument.
I believe that the simpler you present and sketch,
the better architect you are.</p>

<p>You need to know how to formulate design not only in diagrams,
but also in text.
Learn SAD by RUP or SDD by IEEE.
I suggest you to pick one standard and integrate it in your README.
Again, produce documents that emphasize all your decisions.</p>

<h2 id="implementation">Implementation</h2>

<p>Finally, coding!
Your main focus should be on <a href="https://h1alexbel.github.io/2023/06/25/maintainability-first-others-second.html"><strong>Software Maintainability</strong></a>.
It’s lots to learn how to reach it.
It’s hard.
Your open source skills can boost it significantly.
You can gain this skill only by creating and maintaining
your own software packages and products.
Simply put, code reusability is the main virtue here.
While duplication is a sin.</p>

<h2 id="testing">Testing</h2>

<p>First, understand why we need testing.
It’s not about comparing actual and expected results.
It’s about finding bugs in your software.</p>

<p>As software developers,
we need to know how to create maintainable tests.
Here, maintainability reflects on your design.
If you have a lot of procedural stuff in your production code,
you will notice that it’s so hard to maintain tests for such code.
I even believe that to become a better developer, you need to focus
mainly on automated tests and test architecture.
Some tools that will help you here: unit, integration, e2e, load,
performance testing.
Code coverage and any test control are also applicable here.</p>

<h2 id="deployment">Deployment</h2>

<p>My favorite here.
You need to be well-versed how your software gets 
deployed to the end users.
No excuses.
Popular tooling is some cloud provider like <a href="https://aws.amazon.com/"><strong>AWS</strong></a> or similar,
<a href="https://kubernetes.io/"><strong>Kubernetes</strong></a>, and <a href="https://www.docker.com/"><strong>Docker</strong></a>.
And your deployment must be configured at
the start of the project
and be fully automated like <a href="https://h1alexbel.github.io/2023/06/02/deploying-to-gcp.html"><strong>here</strong></a>.</p>

<h2 id="configuration">Configuration</h2>

<p>You need to know how to configure your CI/CD pipelines,
how to set up VCS.</p>

<p>Here, you can also merge <a href="#deployment"><strong>Deployment activities</strong></a> and configuration
management by using <a href="https://en.wikipedia.org/wiki/Infrastructure_as_code"><strong>IaC</strong></a>.
<a href="https://www.terraform.io"><strong>Terraform</strong></a> is a good one.</p>

<h2 id="project-management">Project Management</h2>

<p>To grow, you need to understand project management.
I’m not talking about Agile fairy tails, I’m talking about
some serious project management rules and best practices.
And you can’t learn them in one day.
From myself, I suggest to read <a href="https://www.pmi.org/pmbok-guide-standards/foundational/pmbok"><strong>PMBOK</strong></a>, <a href="https://cmmiinstitute.com/">CMMI</a> and try to apply them
into your project workflow.</p>

<p>Let me summarize all the stuff: you need to go full cycle.
The best way to do it is to create your own <a href="https://h1alexbel.github.io/pets.html"><strong>pet</strong></a> project.
There, you will practice all the disciplines, 
and you will be able to do them in a large-scale project.</p>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="process" /><category term="career" /><summary type="html"><![CDATA[How did you deploy software to production? Did you use Kubernetes? No, I’m not a DevOps guy, I’m a Developer! OK, which documents you produce and activities in which you participate as a software developer besides coding? I’m just writing code, I’m a Developer. I’m here a lot these days. And it’s a very wrong attitude. Here, in this blog post, I’m saying what you need to know and regularly practice as a software developer to become a CTO self-capable unit of work.]]></summary></entry><entry><title type="html">Scalar Driven Development</title><link href="https://www.h1alexbel.xyz/2023/07/09/scalar-programming-pattern.html" rel="alternate" type="text/html" title="Scalar Driven Development" /><published>2023-07-09T00:00:00+00:00</published><updated>2023-07-09T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2023/07/09/scalar-programming-pattern</id><content type="html" xml:base="https://www.h1alexbel.xyz/2023/07/09/scalar-programming-pattern.html"><![CDATA[<p>It’s very hard to make objects declarative.
Scalar Driven Development can help you to model
your objects as declarative parts of application.</p>

<!--more-->

<p><img src="/assets/images/2023/07/saul-take.png" /></p>

<p>First things first.
Imperative programming covers 99% of code.
We’re still writing the same procedural code, that we did in C 50 years ago.
We are done with it.
It’s time to cure our brains.</p>

<h2 id="scalars-are-declarative">Scalars are Declarative</h2>

<p>Scalar Driven Development is a way to model our objects as declarative parts,
some results, that will be computed later.</p>

<p>We define the interface first, where we denote our Scalar object.</p>

<p>Here is an example:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">interface</span> <span class="nc">User</span> <span class="kd">extends</span> <span class="nc">Scalar</span><span class="o">&lt;</span><span class="nc">Json</span><span class="o">&gt;{</span>
  <span class="nd">@Override</span>
  <span class="nc">Json</span> <span class="nf">value</span><span class="o">();</span>
<span class="o">}</span>
</code></pre></div></div>

<p>Our Scalar from User is a JSON document.
By the way, <code class="language-plaintext highlighter-rouge">Scalar&lt;T&gt;</code> taken from <a href="https://github.com/yegor256/cactoos"><strong>cactoos library</strong></a>.</p>

<p>Then we are creating a few implementations for it:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">final</span> <span class="kd">class</span> <span class="nc">Simple</span> <span class="kd">implements</span> <span class="nc">User</span> <span class="o">{</span>
  
  <span class="kd">private</span> <span class="kd">final</span> <span class="nc">String</span> <span class="n">username</span><span class="o">;</span>
  
  <span class="nd">@Override</span>
  <span class="kd">public</span> <span class="nc">Json</span> <span class="nf">value</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="k">new</span> <span class="nf">MutableJson</span><span class="o">().</span><span class="na">with</span><span class="o">(</span><span class="s">"urn"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="na">username</span><span class="o">);</span>
  <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<p>No big deal, just giving username and building a JSON document
from it.
Someday, the logic will scale or change completely.
But we want our object to stay the same, while adding new features.
The <a href=""><strong>Decorator</strong></a> will be in charge:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">final</span> <span class="kd">class</span> <span class="nc">Validated</span> <span class="kd">implements</span> <span class="nc">User</span> <span class="o">{</span>
  
  <span class="kd">private</span> <span class="kd">final</span> <span class="nc">Scalar</span><span class="o">&lt;</span><span class="nc">Json</span><span class="o">&gt;</span> <span class="n">user</span><span class="o">;</span>
  
  <span class="nd">@Override</span>
  <span class="kd">public</span> <span class="nc">Json</span> <span class="nf">value</span><span class="o">()</span> <span class="o">{</span>
    <span class="c1">// validate json</span>
    <span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="na">user</span><span class="o">.</span><span class="na">value</span><span class="o">();</span>
  <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<p>Now we can validate our username before applying it to JSON document storage.
Frankly speaking, it’s not a plain decorator, we are chaining a scalar by passing it.</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">final</span> <span class="kd">class</span> <span class="nc">Flushed</span> <span class="kd">implements</span> <span class="nc">User</span> <span class="o">{</span>

  <span class="kd">private</span> <span class="kd">final</span> <span class="nc">Scalar</span><span class="o">&lt;</span><span class="nc">Json</span><span class="o">&gt;</span> <span class="n">user</span><span class="o">;</span>
  <span class="kd">private</span> <span class="kd">final</span> <span class="nc">Documents</span> <span class="n">docs</span><span class="o">;</span>

  <span class="nd">@Override</span>
  <span class="kd">public</span> <span class="nc">Json</span> <span class="nf">value</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="na">docs</span><span class="o">.</span><span class="na">apply</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="na">user</span><span class="o">.</span><span class="na">value</span><span class="o">());</span>
  <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<p>That’s a composition of objects, where each of them
is a good citizen of a pipeline.
Each of them is represented as a small result,
as a part of a bigger one.</p>

<h2 id="delayed-calls">Delayed calls</h2>

<p>Nothing will be computed until <code class="language-plaintext highlighter-rouge">value()</code> is called:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">new</span> <span class="nc">Flushed</span><span class="o">(</span>
  <span class="k">new</span> <span class="nf">Validated</span><span class="o">(</span>
    <span class="k">new</span> <span class="nf">Simple</span><span class="o">(</span>
      <span class="s">"Aliaksei"</span>
    <span class="o">)</span>
  <span class="o">),</span>
  <span class="n">docs</span>  
<span class="o">).</span><span class="na">value</span><span class="o">();</span> <span class="c1">// trigger pipeline</span>
</code></pre></div></div>

<h2 id="scalars-vs-workers">Scalars vs. Workers</h2>

<p><code class="language-plaintext highlighter-rouge">XmlParser</code>, <code class="language-plaintext highlighter-rouge">BookMapper</code>, <code class="language-plaintext highlighter-rouge">UserValidator</code>.
Who are they?!
I think they are great candidates for refactoring…</p>

<p>Scalars also will help you to avoid <a href="https://www.yegor256.com/2015/03/09/objects-end-with-er.html"><strong>evil</strong></a>
suffix of your objects: <code class="language-plaintext highlighter-rouge">-ER</code>,
a.k.a Worker, we just need to <strong>define our results of manipulations with objects
as other objects</strong>, that’s how Scalar is born.</p>

<blockquote>
  <p>“<em>Declarative programming
  means you define results of manipulations
  with objects as other objects</em>”.</p>
</blockquote>

<p>Let’s see an example: we need to map <code class="language-plaintext highlighter-rouge">HttpRequest</code> to <code class="language-plaintext highlighter-rouge">Song</code> object:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">interface</span> <span class="nc">Mapper</span><span class="o">&lt;</span><span class="no">F</span><span class="o">,</span> <span class="no">T</span><span class="o">&gt;</span> <span class="o">{</span>
  <span class="no">T</span> <span class="nf">to</span><span class="o">(</span><span class="no">F</span> <span class="n">from</span><span class="o">);</span>
<span class="o">}</span>

<span class="kd">final</span> <span class="kd">class</span> <span class="nc">SongMapper</span> <span class="kd">implements</span> <span class="nc">Mapper</span><span class="o">&lt;</span><span class="nc">HttpRequest</span><span class="o">,</span> <span class="nc">Song</span><span class="o">&gt;</span> <span class="o">{</span>
  <span class="nd">@Override</span>
  <span class="kd">public</span> <span class="nc">Song</span> <span class="nf">to</span><span class="o">(</span><span class="kd">final</span> <span class="nc">HttpRequest</span> <span class="n">rq</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">return</span> <span class="k">new</span> <span class="nf">Song</span><span class="o">(</span><span class="n">rq</span><span class="o">.</span><span class="na">path</span><span class="o">(</span><span class="s">"name"</span><span class="o">));</span>
  <span class="o">}</span>
<span class="o">}</span>

<span class="c1">// call it</span>
<span class="kd">final</span> <span class="nc">SongMapper</span> <span class="n">mapper</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">SongMapper</span><span class="o">();</span>
<span class="kd">final</span> <span class="nc">Song</span> <span class="n">song</span> <span class="o">=</span> <span class="n">mapper</span><span class="o">.</span><span class="na">to</span><span class="o">(</span><span class="n">request</span><span class="o">);</span>
</code></pre></div></div>
<p><code class="language-plaintext highlighter-rouge">SongMapper</code> encapsulates nothing, frankly speaking
it’s not even a class, it’s nothing more than a set of procedures.
More than that, <code class="language-plaintext highlighter-rouge">SongMapper</code>
represent nothing from a <a href="https://www.yegor256.com/2014/11/20/seven-virtues-of-good-object.html#1-he-exists-in-real-life"><strong>real-world</strong></a>.
We are just treating it like some smart object to manage our dumb DTOs.</p>

<p>Instead of doing such procedural things, we can go with SDD; 
it will make our objects more declarative:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">final</span> <span class="kd">class</span> <span class="nc">SongFromHttp</span> <span class="kd">implements</span> <span class="nc">Scalar</span><span class="o">&lt;</span><span class="nc">Song</span><span class="o">&gt;</span> <span class="o">{</span>
  
  <span class="kd">private</span> <span class="kd">final</span> <span class="nc">HttpRequest</span> <span class="n">request</span><span class="o">;</span>
  
  <span class="nd">@Override</span>
  <span class="kd">public</span> <span class="nc">Song</span> <span class="nf">value</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="k">new</span> <span class="nf">Song</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="na">request</span><span class="o">.</span><span class="na">path</span><span class="o">(</span><span class="s">"name"</span><span class="o">));</span>
  <span class="o">}</span>
<span class="o">}</span>

<span class="c1">// call it</span>
<span class="kd">final</span> <span class="nc">Song</span> <span class="n">song</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">SongFromHttp</span><span class="o">(</span><span class="n">request</span><span class="o">).</span><span class="na">value</span><span class="o">();</span>
</code></pre></div></div>

<p>The same functionality, but now:</p>

<ol>
  <li>we are treating <code class="language-plaintext highlighter-rouge">SongFromHttp</code>as real-world entity.</li>
  <li><code class="language-plaintext highlighter-rouge">SongFromHttp</code> has a state inside self: object encapsulates <code class="language-plaintext highlighter-rouge">HttpRequest</code></li>
  <li>thanks to 2., we can perform lazy computation of <code class="language-plaintext highlighter-rouge">SongFromHttp#value()</code></li>
</ol>

<p>Watch this:</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/6GMiosTLUTc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen=""></iframe>

<h2 id="summary">Summary</h2>

<p>What are we learning here?
Here is my summary of what SDD means:</p>
<ol>
  <li>State (your object must encapsulate something)</li>
  <li>Declarative (scalars are treated as parts of other objects, as some results)</li>
  <li>Delayed calls (unless <code class="language-plaintext highlighter-rouge">value()</code> is called, nothing will happen)</li>
  <li>Absence of getters (there is <code class="language-plaintext highlighter-rouge">value()</code>, no sense to violate encapsulation)</li>
</ol>

<p>There are a few real-world examples of how we maintain those ‘scalars’ in our projects:
<a href="https://github.com/eo-cqrs/eo-kafka"><strong>eo-kafka</strong></a>,
<a href="https://github.com/eo-cqrs/cmig"><strong>cmig</strong></a>,
<a href=""><strong>cactoos</strong></a> and many more at <a href="https://github.com/eo-cqrs"><strong>EO-CQRS</strong></a>.</p>

<p>That’s it.</p>

<p><strong>P.S</strong>
<br />
<a href="https://www.l3r8y.ru/"><strong>@l3r8yJ</strong></a> called this way of development - <strong>Scalar Driven Development (SDD)</strong>.</p>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="oop" /><category term="java" /><summary type="html"><![CDATA[It’s very hard to make objects declarative. Scalar Driven Development can help you to model your objects as declarative parts of application.]]></summary></entry><entry><title type="html">Degradation of Programming Languages</title><link href="https://www.h1alexbel.xyz/2023/07/02/degratation-of-programming-languages.html" rel="alternate" type="text/html" title="Degradation of Programming Languages" /><published>2023-07-02T00:00:00+00:00</published><updated>2023-07-02T00:00:00+00:00</updated><id>https://www.h1alexbel.xyz/2023/07/02/degratation-of-programming-languages</id><content type="html" xml:base="https://www.h1alexbel.xyz/2023/07/02/degratation-of-programming-languages.html"><![CDATA[<p>I am coding in Java and TypeScript.
I am creating backend applications using Java platform and a bit of Node.Js.
These languages and related platforms are being created in 1995 (Java) and 2012 (TypeScript).
Do we change something?
17 years are gone, more complex problems to solve, but
the same level of abstraction we have in programming languages and platforms.
It’s time to change our tooling.</p>

<!--more-->

<p><img src="/assets/images/2023/07/gone-girl.jpg" /></p>

<p>Now, in 2023, modern programming languages are focusing only on one thing:
<br />
<em>How to satisfy all the developers in the world, that they can use only our language to solve all their problems?</em></p>

<p>The Biggest problem we have now,
that the languages we’re dealing with are the products of the majority votes.
Do we need reflection and annotations?
Most developers will say “yes”, no matter how bad is reflection.
The same with static methods.
The same with 90% of features in “modern” programming languages
such as Java, Kotlin, TypeScript, Go, Ruby, etc.</p>

<p>While languages and platforms formulate the <a href="https://h1alexbel.github.io/2023/06/25/maintainability-first-others-second.html"><strong>maintainability</strong></a> of the programs we create,
modern languages start looking uglier, uglier, and uglier.
To satisfy all the needs, modern languages inevitably start introduce
ability to write the same things in a different way, a.k.a flexibility, or <a href="https://www.yegor256.com/2017/04/11/flexibility-equates-lower-quality.html"><strong>syntactic sugar</strong></a>.</p>

<blockquote>
  <p><em>Simply put, higher quality comes from simpler languages. - Yegor Bugayenko</em></p>
</blockquote>

<p>Just look at <a href="https://openjdk.org/jeps/445"><strong>JEP 445: Unnamed Classes and Instance Main Methods</strong></a>, the Java 21 preview feature:</p>

<p>Java main method and class a.k.a entry point can be presented now in 2 ways:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Entry</span> <span class="o">{</span>
  <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
    <span class="c1">// logic</span>
  <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">void</span> <span class="nf">main</span><span class="o">()</span> <span class="o">{</span>
  <span class="c1">// logic</span>
<span class="o">}</span>
</code></pre></div></div>

<p>The same happens with all the languages.
<strong>They introduce new and new features to satisfy all the developers around the world
and boost their creators on the stock market (Google, Microsoft)</strong>.</p>

<h2 id="what-is-the-solution">What is the solution?</h2>

<p>I believe that now, we need more high-level languages with focus on specific use-cases.
It should be <strong>simple</strong>, <strong>high-level</strong>, and <strong>specific-focused</strong>.
That’s it.</p>

<p>There are some features of really new and modern programming language, based on <a href="https://www.yegor256.com/2013/12/29/proto.html"><strong>D29</strong></a>:</p>

<ol>
  <li>VSC support at language level</li>
  <li>UML and OCL support at language level</li>
  <li>CI/CD support at language level</li>
  <li>Declarative programming</li>
  <li>Distributed objects/functions and their scalability</li>
  <li>Cloud Computing</li>
  <li>Data formats e.g., XML, JSON, YAML, CSV</li>
  <li>Testing: unit, integration, end-to-end, performance</li>
  <li>Multithreading</li>
  <li>Documentation</li>
  <li>Software licenses</li>
  <li>Low-code compatibility</li>
  <li>Runtime platforms e.g., Docker, K8s</li>
  <li>Object Metadata</li>
  <li>Object metrics</li>
  <li>Component repository: e.g., Sonatype Nexus</li>
  <li>Design patterns indication</li>
  <li>Compilation into other programming languages</li>
  <li>No scalar types e.g., <code class="language-plaintext highlighter-rouge">int</code>, <code class="language-plaintext highlighter-rouge">boolean</code></li>
  <li>No data flow control e.g., <code class="language-plaintext highlighter-rouge">for</code>, <code class="language-plaintext highlighter-rouge">while</code></li>
  <li>No reflection</li>
</ol>]]></content><author><name>Aliaksei Bialiauski</name></author><category term="future" /><summary type="html"><![CDATA[I am coding in Java and TypeScript. I am creating backend applications using Java platform and a bit of Node.Js. These languages and related platforms are being created in 1995 (Java) and 2012 (TypeScript). Do we change something? 17 years are gone, more complex problems to solve, but the same level of abstraction we have in programming languages and platforms. It’s time to change our tooling.]]></summary></entry></feed>