<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>Patrick José Pereira - kde</title>
        <link>https://patrickelectric.work</link>
        <description>I am an Electronics Engineer that works with robotic systems, OSS and OSH.</description>
        <generator>Zola</generator>
        <language>en</language>
        <atom:link href="https://patrickelectric.work/tags/kde/rss.xml" rel="self" type="application/rss+xml"/>
        <lastBuildDate>Mon, 31 Aug 2020 13:55:39 +0000</lastBuildDate>
        <item>
            <title>How to rock: Doing the right thing</title>
            <pubDate>Mon, 31 Aug 2020 13:55:39 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2020/how-to-rock-contribution-tips/</link>
            <guid>https://patrickelectric.work/blog/2020/how-to-rock-contribution-tips/</guid>
            <description>&lt;p&gt;After a couple of years collaborating with open source&#x2F;free software projects, I started to help newcomers to contribute and push the development practices further. This post will try to itemize the most important items that can used for software collaboration.
Before starting, be sure to follow my &lt;a href=&quot;&#x2F;tags&#x2F;how-to-rock&quot;&gt;previous posts&lt;&#x2F;a&gt;, this post complements what already exists.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;Now, I&#x27;m going to throw some good practices of code development and contribution, and during this post I&#x27;ll explain why such practices can be archived without much effort:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Avoid creating multiple PRs for the same work&lt;&#x2F;strong&gt;, update the ones that are still open.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;E.g: You created a Pull Request called &quot;Feature: add button&quot;, some modifications will be necessary after the review process, and for that you&#x27;ll need to update the same branch over creating new ones. That&#x27;s necessary to help the project maintainers to see previous comments and your development history, avoid repository noise and unnecessary PRs in the project history. Creating multiple PRs will only make the maintainers confuse and unable to track old comments, suggestions and your code changes between PRs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create atomic and self-contained commits&lt;&#x2F;strong&gt;, avoid doing multiple things in the same commit.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;E.g: You have created a commit to fix the serial communication class, and inside the same commit you are doing 3 different things, removing trailing spaces, fixing a pointer validation check and a typo in the documentation of a totally different class. This can appear to be silly and bureaucratic, but there are good reasons to break this simple commit and at least 3 different commits, one for the pointer check, a second one for the typo and a third one for the trailing space.
&lt;ul&gt;
&lt;li&gt;It makes your work more clear when the maintainer does the review per commit&lt;&#x2F;li&gt;
&lt;li&gt;Makes it easier for developers to cherry-pick your work avoiding conflicts&lt;&#x2F;li&gt;
&lt;li&gt;Makes it easier to fix conflicts when doing rebases over the master branch&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;Helps developers to read the project history&lt;&#x2F;li&gt;
&lt;li&gt;Developers usually track lines history to understand the changes behind a functionality, it&#x27;s common to search with &lt;code&gt;git grep&lt;&#x2F;code&gt; history from commits or lines changes in specific commits to understand the code, function, class or a small feature.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create atomic and self-sustained PRs&lt;&#x2F;strong&gt;, avoid doing multiple things in the same PR, like different features. They may appear simple with small pieces of code&#x2F;functionality but they can escalate quickly after a review process, and if both features are somehow related or dependently, it&#x27;s recommended to break it in multiple PRs with code to maintain compatibility with current code base. A huge PR can drag developer and maintainer in a rabbit hole, making the PR to be not merged, keeping it simple is the best way to merge it and get the sweet serotonin boost.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;E.g: You have applied a PR for software notifications, and somehow you also added a URL fetch functionality to grab new software versions, etc. After the first review, the maintainer asks to create a more abstracted way to fetch api and to deal with network requirements, this will start to convolute the PR, moving the initial idea of the notification feature to an entire network REST API architecture. With that, it&#x27;s better to break the PR in two, one that only provides the notification software and interface feature and a second PR that is used for the REST API.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Do your own review&lt;&#x2F;strong&gt;, the final and probably most important tip of all. Doing you own review will train your mind and eyes to detect poor code standards or bad practices, it&#x27;ll also make your PR be merged easily and faster, since you&#x27;ll be able to catch problems before the reviewer feedback. Some reviewers may think that reviewing your own PR is a must, since we are talking about open source projects and free software, you should understand that the people that are reviewing your code are not obligated to do so, the majority are collaborating and donating their own time to help the development and maintenance of such projects, doing your own review is also sign of empathy about the project and maintainer time.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
        </item>
        <item>
            <title>How to rock: Flowing with git</title>
            <pubDate>Mon, 24 Aug 2020 13:55:39 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2020/how-to-rock-flowing-with-git/</link>
            <guid>https://patrickelectric.work/blog/2020/how-to-rock-flowing-with-git/</guid>
            <description>&lt;p&gt;Git is awesome, git rocks, git is like a super advanced car, but if you don&#x27;t read the manual, you&#x27;ll never know the features!&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;h1 id=&quot;useful-tips&quot;&gt;Useful tips&lt;&#x2F;h1&gt;
&lt;p&gt;The idea behind this section is to point some important things that I learned in the pass years while reading some great books, such as: &lt;a href=&quot;https:&#x2F;&#x2F;isbnsearch.org&#x2F;isbn&#x2F;9781783553754&quot;&gt;Mastering Git&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2&quot;&gt;Pro Git(it&#x27;s free!)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;tig&quot;&gt;Tig&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;What&#x27;s the use of having access to everything, if you can&#x27;t visualize it.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Git is really great, but what matters a great tool if the user interface is not as polished as we desire to be. &lt;strong&gt;&lt;code&gt;Tig&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is one of the greatest tools to be used with Git, is the UI that mostly programmers are missing to visualize and understand what is going on in the git repository. If you didn&#x27;t know about it, install and use it now.&lt;&#x2F;p&gt;
&lt;figure&gt;
  &lt;img src=&quot;&amp;#x2F;assets&amp;#x2F;how_to_rock&amp;#x2F;tig-all.png&quot; class=&quot;center&quot;&gt;
  &lt;figcaption&gt;
    tig --all
  &lt;&#x2F;figcaption&gt;
&lt;&#x2F;figure&gt;
&lt;p&gt;&lt;code&gt;Tig&lt;&#x2F;code&gt; also allow a bunch of useful arguments, such as &lt;code&gt;log&lt;&#x2F;code&gt;, &lt;code&gt;show&lt;&#x2F;code&gt;, &lt;code&gt;status&lt;&#x2F;code&gt;, &lt;code&gt;reflog&lt;&#x2F;code&gt;, &lt;code&gt;blame&lt;&#x2F;code&gt;, &lt;code&gt;grep&lt;&#x2F;code&gt;, &lt;code&gt;refs&lt;&#x2F;code&gt;, &lt;code&gt;stash&lt;&#x2F;code&gt; and others, we are going to talk about some of these later.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;git-commit-fixup&quot;&gt;Git commit --fixup&lt;&#x2F;h2&gt;
&lt;p&gt;Oh my, you need to fix an old commit on your PR ? That&#x27;s a great use of &lt;code&gt;fixup&lt;&#x2F;code&gt;.
You can create a commit that fixes an old commit with &lt;code&gt;git commit -a --fixup 00112233&lt;&#x2F;code&gt;, but who has time to write hashs or copying&#x2F;pasting it ?&lt;&#x2F;p&gt;
&lt;p&gt;For that, you can create a helpful git alias such as:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# git fix-old number
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Will apply a fixup in the n-old commit
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;fix-old&lt;&#x2F;span&gt;&lt;span&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;!f() { git commit --fixup=&lt;&#x2F;span&gt;&lt;span&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;git&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt; rev-parse HEAD&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;((&lt;&#x2F;span&gt;&lt;span&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;))); }; f&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With that, you can use &lt;code&gt;fit fix-old 3&lt;&#x2F;code&gt; to fix the &lt;code&gt;HEAD~3&lt;&#x2F;code&gt; commit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;git-rebase-i-interactive-rebase&quot;&gt;Git rebase -i (Interactive rebase)&lt;&#x2F;h2&gt;
&lt;p&gt;Interactive rebase is a powerful command, and much more powerful and human friend with interactive mode.&lt;&#x2F;p&gt;
&lt;figure&gt;
  &lt;img src=&quot;&amp;#x2F;assets&amp;#x2F;how_to_rock&amp;#x2F;rebase-i.png&quot; class=&quot;center&quot;&gt;
  &lt;figcaption&gt;
    git rebase -i --autosquash origin&amp;#x2F;master
  &lt;&#x2F;figcaption&gt;
&lt;&#x2F;figure&gt;
&lt;p&gt;Oh well, you can see the &lt;code&gt;autosquash&lt;&#x2F;code&gt; option there, this is something that I do to apply fixups automatically on the correct commits, neat right ?&lt;&#x2F;p&gt;
&lt;h2 id=&quot;git-reflog&quot;&gt;Git reflog&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;git reflog&lt;&#x2F;code&gt; is one of the most important commands, it provides access to everything that is tracked or was tracked by git, all commands and actions that was done in the entire history of the project can be accessed, it&#x27;s possible to checkout and see the history of development tree in any moment, before or during a rebase, the history of a branch before a terrible idea in the code, a point between a merge conflict, everything is possible to recover or to start from a previous point, if you have done any git command with tracked files, you&#x27;ll not loose it.&lt;&#x2F;p&gt;
&lt;p&gt;For an awesome experience, I recommend to use &lt;code&gt;tig&lt;&#x2F;code&gt; with &lt;code&gt;reflog&lt;&#x2F;code&gt; (&lt;code&gt;tig reflog&lt;&#x2F;code&gt;) to see a user-friendly history of &lt;code&gt;reflog&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;figure&gt;
  &lt;img src=&quot;&amp;#x2F;assets&amp;#x2F;how_to_rock&amp;#x2F;tig-reflog.png&quot; class=&quot;center&quot;&gt;
  &lt;figcaption&gt;
    checkout, rebase, reset, cherry-pick, the history is all there and you can checkout in any hash!
  &lt;&#x2F;figcaption&gt;
&lt;&#x2F;figure&gt;&lt;h2 id=&quot;git-add-checkout-stash-patch-p&quot;&gt;Git add&#x2F;checkout&#x2F;stash --patch&#x2F;-p&lt;&#x2F;h2&gt;
&lt;figure&gt;
  &lt;img src=&quot;&amp;#x2F;assets&amp;#x2F;how_to_rock&amp;#x2F;add-p.png&quot; class=&quot;center&quot;&gt;
  &lt;figcaption&gt;
    git add -p, add only what you need
  &lt;&#x2F;figcaption&gt;
&lt;&#x2F;figure&gt;
&lt;p&gt;The &lt;code&gt;--patch&lt;&#x2F;code&gt; argument is a great feature, you can use it with &lt;code&gt;add&lt;&#x2F;code&gt;, &lt;code&gt;checkout&lt;&#x2F;code&gt;, &lt;code&gt;stash&lt;&#x2F;code&gt; and others, it allows your to select what you need in your commit,
it helps to avoid adding unnecessary stuff in your commit and only adding what is needed for an atomic patch.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;git-stash&quot;&gt;Git stash&lt;&#x2F;h2&gt;
&lt;p&gt;Sometimes we want to remove everything that we are working on, a bunch of uncommitted or unstaged code around your project, but at the same time, we are a big afraid to remove and loose all this code. The answer for your problems is git stash, git will get everything that is not staged.&lt;&#x2F;p&gt;
&lt;p&gt;To visualize what was stashed, you can run &lt;code&gt;git stash show stash@{0} --all&lt;&#x2F;code&gt; where &lt;code&gt;0&lt;&#x2F;code&gt; can be the nth stash. You can also visualize it with &lt;code&gt;tig stash&lt;&#x2F;code&gt;;&lt;&#x2F;p&gt;
&lt;p&gt;If you want to apply any stashed code, you can do it with &lt;code&gt;git stash apply stash@{0}&lt;&#x2F;code&gt;, again, where &lt;code&gt;0&lt;&#x2F;code&gt; can be the nth stash.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;git-cherry-pick&quot;&gt;Git cherry-pick&lt;&#x2F;h2&gt;
&lt;p&gt;If you want to test some commits or apply in different branches for any reason, &lt;code&gt;git cherry-pick&lt;&#x2F;code&gt; is here for you, with it you can just copy a commit or a range of commits to apply over a specific branch.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;knowing-the-basic-how-the-flow-works&quot;&gt;Knowing the basic (How the flow works)&lt;&#x2F;h1&gt;
&lt;blockquote&gt;
&lt;p&gt;This part was the first section of this post, but since I went really deep about how git works, it&#x27;s now in the end as a bonus section.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;An alternative title could be: &#x27;Introduction to Git flow&#x27;, I hope that you understand what kind of introduction I&#x27;m talking about :)&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Well, if you thought about &#x27;the flow&#x27; as related to branches, I can&#x27;t blame you. First we need to go to the basics, before branches, before anything else.&lt;&#x2F;p&gt;
&lt;p&gt;First we need to create the foundation (&lt;code&gt;git init&lt;&#x2F;code&gt;) for our building (our project&#x2F;source code).&lt;&#x2F;p&gt;
&lt;p&gt;What init will do ? You may ask, well, it creates a folder with a bunch of cool things inside.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;fish&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-fish &quot;&gt;&lt;code class=&quot;language-fish&quot; data-lang=&quot;fish&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;&#x2F;tmp&#x2F;echo &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;master&lt;&#x2F;span&gt;&lt;span&gt;): tree &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;-a
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;.
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;└── &lt;&#x2F;span&gt;&lt;span&gt;.git &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Folder where git will store all necessary information to work
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;branches &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Deprecated, only exist for compatibility
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;config &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Folder for specific configuration files (~&#x2F;.gitconfig friends)
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;description &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Used for GitWeb
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;HEAD &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# A file that has the reference of the current branch (ref&#x2F;heads&#x2F;master)
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;hooks &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Git hook files (comes with bunch of free examples by default), soon we&amp;#39;ll talk more about it
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── applypatch-msg.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── commit-msg.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── fsmonitor-watchman.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── post-update.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── pre-applypatch.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── pre-commit.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── pre-merge-commit.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── prepare-commit-msg.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── pre-push.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── pre-rebase.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── pre-receive.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;└── update.sample
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;index &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Store information related to folders, files and submodules (it&amp;#39;ll be populated after you add the first file)
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;info &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Store information related to a gitignore, gitattributes and etc, we&amp;#39;re not going to talk about it
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;└── exclude
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;objects &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# All our references will be here, soon we are going to see how and what
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── info &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Bunch of internal things that are stored, not going to talk about it
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;└── pack &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Store compressed files, not going to talk about it
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;└── &lt;&#x2F;span&gt;&lt;span&gt;refs &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# All friend references are here, branches, remotes, tags, stags
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;heads &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Local branches
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;remotes &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Remote repositories (it&amp;#39;ll be populated after you add the first remote)
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;└── origin &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Remote name
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│       &lt;&#x2F;span&gt;&lt;span&gt;└── master &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Has the hash of the remote master branch
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;└── &lt;&#x2F;span&gt;&lt;span&gt;tags &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Store all tags of your project
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;I have added some stuff that are not populated from a fresh &lt;code&gt;git init&lt;&#x2F;code&gt; for educational reasons, for more information, check &lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;gitrepository-layout&quot;&gt;gitrepository-layout&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Ok, looks complicated right ? It may, but it&#x27;s not. If you are not aware, &lt;code&gt;git&lt;&#x2F;code&gt; description is: &quot;the stupid content tracker&quot;,
I believe that may be a weird thing to describe our magical tool with such words, I prefer to say: &quot;the &lt;em&gt;simple&lt;&#x2F;em&gt; content tracker&quot;, and will explain why.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;create-and-add-a-file&quot;&gt;Create and add a file&lt;&#x2F;h2&gt;
&lt;p&gt;Let&#x27;s populate our repository and create a simple commit:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Create a file: &lt;code&gt;touch README.md&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Let put something inside to make it more funny.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cat README.md&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;txt&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-txt &quot;&gt;&lt;code class=&quot;language-txt&quot; data-lang=&quot;txt&quot;&gt;&lt;span&gt;Hello!
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Now our working directory is not empty, we have something there! But sadly, not tracked by git, we can change that.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add this files to be tracked by git, or indexed: &lt;code&gt;git add README.md&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Wait a minute, we did something with git right ? Let&#x27;s see what changed:&lt;pre data-lang=&quot;fish&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-fish &quot;&gt;&lt;code class=&quot;language-fish&quot; data-lang=&quot;fish&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;.git
&lt;&#x2F;span&gt;&lt;span style=&quot;background-color:#bf616a;color:#2b303b;&quot;&gt;|&lt;&#x2F;span&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;...
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;index &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# It&amp;#39;s populated now
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;objects &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Wow we have some crazy file and folder inside
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;10
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;│   └── ddd6d257e01349d514541981aeecea6b2e741d
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── info
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;└── pack
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;└── &lt;&#x2F;span&gt;&lt;span&gt;refs
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;heads
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;└── &lt;&#x2F;span&gt;&lt;span&gt;tags
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;index&quot;&gt;Index&lt;&#x2F;h2&gt;
&lt;p&gt;This file is just a binary glob with a bunch of basic information about the files and paths that git is tracking.&lt;&#x2F;p&gt;
&lt;p&gt;What is important for us now, index will have the following content:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A header for git internal usage.&lt;&#x2F;li&gt;
&lt;li&gt;The number of indexes (hashes) available.&lt;&#x2F;li&gt;
&lt;li&gt;A list of hashes that contain:
&lt;ol&gt;
&lt;li&gt;The filename&lt;&#x2F;li&gt;
&lt;li&gt;The path&lt;&#x2F;li&gt;
&lt;li&gt;The time that the file was changed&lt;&#x2F;li&gt;
&lt;li&gt;Type of the file (can be a folder, or a virtual file and etc)&lt;&#x2F;li&gt;
&lt;li&gt;The permission of such file (&lt;a href=&quot;https:&#x2F;&#x2F;wiki.archlinux.org&#x2F;index.php&#x2F;File_permissions_and_attributes_&quot;&gt;linux permission&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;File size&lt;&#x2F;li&gt;
&lt;li&gt;And finally, &lt;strong&gt;our hash (sha1)&lt;&#x2F;strong&gt; [10ddd6d257e01349d514541981aeecea6b2e741d]&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Wait, don&#x27;t you believe me ? Check it here:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span&gt; index | &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;hx
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x000000:&lt;&#x2F;span&gt;&lt;span&gt; 0x44 0x49 0x52 0x43 0x00 0x00 0x00 0x02 0x00 0x00 DIRC......
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x00000a:&lt;&#x2F;span&gt;&lt;span&gt; 0x00 0x01 0x5f 0x41 0x44 0x35 0x1b 0xd6 0x67 0x47 .._AD5..gG
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x000014:&lt;&#x2F;span&gt;&lt;span&gt; 0x5f 0x41 0x44 0x35 0x1b 0xd6 0x67 0x47 0x00 0x00 _AD5..gG..
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x00001e:&lt;&#x2F;span&gt;&lt;span&gt; 0x00 0x2f 0x00 0x09 0xb1 0x41 0x00 0x00 0x81 0xa4 .&#x2F;...A....
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x000028:&lt;&#x2F;span&gt;&lt;span&gt; 0x00 0x00 0x03 0xe8 0x00 0x00 0x03 0xe8 0x00 0x00 ..........
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x000032:&lt;&#x2F;span&gt;&lt;span&gt; 0x00 0x07 0x10 0xdd 0xd6 0xd2 0x57 0xe0 0x13 0x49 ......W..I
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x00003c:&lt;&#x2F;span&gt;&lt;span&gt; 0xd5 0x14 0x54 0x19 0x81 0xae 0xec 0xea 0x6b 0x2e ..T.....k.
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x000046:&lt;&#x2F;span&gt;&lt;span&gt; 0x74 0x1d 0x00 0x09 0x52 0x45 0x41 0x44 0x4d 0x45 t...README
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x000050:&lt;&#x2F;span&gt;&lt;span&gt; 0x2e 0x6d 0x64 0x00 0x87 0x87 0x7d 0xde 0xf5 0x59 .md...}&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;..Y
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x00005a:&lt;&#x2F;span&gt;&lt;span&gt; 0x22 0x0a 0x7d 0x9c 0x48 0xce 0xde 0x29 0x94 0x60 &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;.}.H..).`
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;0x000064:&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt; 0x17 0x2c 0xf3 0xcc                               .,..
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;   &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;bytes:&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt; 104
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Check &lt;code&gt;0x000032&lt;&#x2F;code&gt; until &lt;code&gt;0x000046&lt;&#x2F;code&gt;, you&#x27;ll see our sha1 value &lt;strong&gt;10ddd6d257e01349d514541981aeecea6b2e741d&lt;&#x2F;strong&gt; (&lt;em&gt;0x10 0xdd 0xd6 0xd2&lt;&#x2F;em&gt;) and after that our file &lt;strong&gt;README.md&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If you want to learn how it works and what is inside, check &lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;index-format&quot;&gt;here&lt;&#x2F;a&gt; for more information,
and &lt;a href=&quot;https:&#x2F;&#x2F;mincong.io&#x2F;2018&#x2F;04&#x2F;28&#x2F;git-index&#x2F;&quot;&gt;here&lt;&#x2F;a&gt; for an awesome adventure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;objects&quot;&gt;Objects&lt;&#x2F;h2&gt;
&lt;p&gt;Ok, now that we know that &lt;em&gt;index&lt;&#x2F;em&gt; is pointing to this hash, let&#x27;s check the objects folder.
As I said before, &lt;strong&gt;objects&lt;&#x2F;strong&gt; folder will store all the references that exist, it should be our yellow pages. First, let&#x27;s understand how to read it.
There is a folder called &lt;strong&gt;10&lt;&#x2F;strong&gt;, and after that a file that has the name of &lt;strong&gt;ddd6d257e01349d514541981aeecea6b2e741d&lt;&#x2F;strong&gt;, if you put both together you are going to end up with our hash that we found in the &lt;em&gt;index&lt;&#x2F;em&gt; file.&lt;&#x2F;p&gt;
&lt;p&gt;Just for our curiosity, this hash is calculated based in the following format &lt;code&gt;{TYPE} {SIZE}{NULL_CHAR}{CONTENT}&lt;&#x2F;code&gt;, the type will tell git if the hash points to a tree or a blob, the tree can have multiple blobs (like a folder), and a blob is a file. In our case, the string that defines this hash is the following:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;python&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-python &quot;&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;import &lt;&#x2F;span&gt;&lt;span&gt;hashlib
&lt;&#x2F;span&gt;&lt;span&gt;hashlib.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;sha1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;blob 7&lt;&#x2F;span&gt;&lt;span style=&quot;color:#96b5b4;&quot;&gt;\0&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;Hello!&lt;&#x2F;span&gt;&lt;span style=&quot;color:#96b5b4;&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;).&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;hexdigest&lt;&#x2F;span&gt;&lt;span&gt;()
&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;10ddd6d257e01349d514541981aeecea6b2e741d&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For more information, &lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2&#x2F;Git-Internals-Git-Objects&quot;&gt;check Git Internals Git Objects&lt;&#x2F;a&gt;, it&#x27;s a great friday night reading.&lt;&#x2F;p&gt;
&lt;p&gt;Ok! Now we are ready to commit!&lt;&#x2F;p&gt;
&lt;p&gt;Hey, wait, what is inside of this files object files ?
Oh my, ok, for now, this is where the git magic happens, it&#x27;s a binary object that contains information about the diff, don&#x27;t bother about it, but if you are really willing to know, &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gitster&#x2F;git&#x2F;blob&#x2F;master&#x2F;Documentation&#x2F;technical&#x2F;pack-format.txt&quot;&gt;check it here&lt;&#x2F;a&gt; (Please open an issue if you know a better and friendly reference).&lt;&#x2F;p&gt;
&lt;p&gt;Back to the commit!&lt;&#x2F;p&gt;
&lt;h2 id=&quot;commit&quot;&gt;Commit&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;git commit -sm &quot;First commit&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre data-lang=&quot;fish&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-fish &quot;&gt;&lt;code class=&quot;language-fish&quot; data-lang=&quot;fish&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;.git
&lt;&#x2F;span&gt;&lt;span style=&quot;background-color:#bf616a;color:#2b303b;&quot;&gt;|&lt;&#x2F;span&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;...
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;index &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# It&amp;#39;s populated now
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;objects &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;# Wow we have some crazy file and folder inside
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;08
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;│   └── f87015745258743015340c5466fe69c94f7587
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;10
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;│   └── ddd6d257e01349d514541981aeecea6b2e741d
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── 1d
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;│   └── 12099363e995c9fc3e1d2cc68b74b8e10c361a
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;├── info
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;│   &lt;&#x2F;span&gt;&lt;span&gt;└── pack
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;└── &lt;&#x2F;span&gt;&lt;span&gt;refs
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;├── &lt;&#x2F;span&gt;&lt;span&gt;heads
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;└── &lt;&#x2F;span&gt;&lt;span&gt;tags
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Ok, we have finished our first commit and now we have two more objects, let&#x27;s check what is inside of each one:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; git cat-file&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; -p&lt;&#x2F;span&gt;&lt;span&gt; 1d12099363e995c9fc3e1d2cc68b74b8e10c361a
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;tree&lt;&#x2F;span&gt;&lt;span&gt; 08f87015745258743015340c5466fe69c94f7587
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;author&lt;&#x2F;span&gt;&lt;span&gt; Patrick José Pereira &amp;lt;myemail&amp;gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1598117804&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; -0300
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;committer&lt;&#x2F;span&gt;&lt;span&gt; Patrick José Pereira &amp;lt;myemail&amp;gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1598117804&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; -0300
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;First&lt;&#x2F;span&gt;&lt;span&gt; commit
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; git cat-file&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; -p&lt;&#x2F;span&gt;&lt;span&gt; 08f87015745258743015340c5466fe69c94f7587
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;100644&lt;&#x2F;span&gt;&lt;span&gt; blob 10ddd6d257e01349d514541981aeecea6b2e741d    README.md
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; git cat-file&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; -p&lt;&#x2F;span&gt;&lt;span&gt; 10ddd6d257e01349d514541981aeecea6b2e741d
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Hello!
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you can see, we have a commit object: &lt;strong&gt;1d12099363e995c9fc3e1d2cc68b74b8e10c361a&lt;&#x2F;strong&gt;, that points to the tree &lt;strong&gt;08f87015745258743015340c5466fe69c94f7587&lt;&#x2F;strong&gt;,
this tree has a single file on it, our old friendly &lt;strong&gt;README.md&lt;&#x2F;strong&gt;, and this same tree says that this blob has the hash &lt;strong&gt;10ddd6d257e01349d514541981aeecea6b2e741d&lt;&#x2F;strong&gt;, and this hash contains the content of &lt;strong&gt;README.md&lt;&#x2F;strong&gt;. Simple Right ?!&lt;&#x2F;p&gt;
&lt;p&gt;As I said, a tree can contain multiple blobs, or more trees, like in the following example:&lt;&#x2F;p&gt;
&lt;figure&gt;
  &lt;img src=&quot;&amp;#x2F;assets&amp;#x2F;how_to_rock&amp;#x2F;git&amp;#x2F;data-model-2.png&quot; class=&quot;center&quot;&gt;
  &lt;figcaption&gt;
    &amp;quot;Git Internals Git Objects&amp;quot; from Git SCM is licensed under CC BY 3.0
  &lt;&#x2F;figcaption&gt;
&lt;&#x2F;figure&gt;
&lt;p&gt;And after some more commits, we end up with multiple commits, that each commit has a tree, and each tree points to more trees or more blobs!&lt;&#x2F;p&gt;
&lt;figure&gt;
  &lt;img src=&quot;&amp;#x2F;assets&amp;#x2F;how_to_rock&amp;#x2F;git&amp;#x2F;data-model-3.png&quot; class=&quot;center&quot;&gt;
  &lt;figcaption&gt;
    &amp;quot;Git Internals Git Objects&amp;quot; from Git SCM is licensed under CC BY 3.0
  &lt;&#x2F;figcaption&gt;
&lt;&#x2F;figure&gt;&lt;h2 id=&quot;wrap-up-git-commit-logic-and-git-internals&quot;&gt;Wrap up git commit logic and git internals&lt;&#x2F;h2&gt;
&lt;p&gt;Git, as a &lt;em&gt;simple content tracker&lt;&#x2F;em&gt;, uses a simple logic to manage all the files, as you saw, git works with the filesystem as a dictionary, where the filenames define the key and the content of such files are the content of this dictionary key, you can think about it as a content-addressable filesystem.&lt;&#x2F;p&gt;
&lt;p&gt;Since we have finished talking about git manages our commits, files and everything else, let us finish this deep introductory part with how the commit and the object creation works.&lt;&#x2F;p&gt;
&lt;figure&gt;
  &lt;img src=&quot;&amp;#x2F;assets&amp;#x2F;how_to_rock&amp;#x2F;git&amp;#x2F;reset-workflow.png&quot; class=&quot;center&quot;&gt;
  &lt;figcaption&gt;
    &amp;quot;Reset workflow&amp;quot; from Git SCM is licensed under CC BY 3.0
  &lt;&#x2F;figcaption&gt;
&lt;&#x2F;figure&gt;
&lt;p&gt;The previous is a good simple example of how a commit works, first we have a untracked file in our working directory, we stage this file (&lt;code&gt;git add&lt;&#x2F;code&gt;) and after that we commit this file (&lt;code&gt;git commit&lt;&#x2F;code&gt;) the commit does update the &lt;em&gt;HEAD&lt;&#x2F;em&gt; (the hash where we are right now). And doing a checkout to a different hash (or &lt;em&gt;HEAD&lt;&#x2F;em&gt;) will result in a change of the working directory to match what was commited.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;cool-extensions-to-have&quot;&gt;Cool extensions to have:&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;dandavison&#x2F;delta&quot;&gt;delta&lt;&#x2F;a&gt;: A syntax-highlighting pager for git, diff, and grep output&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;tummychow&#x2F;git-absorb&quot;&gt;git-absorb&lt;&#x2F;a&gt;: &lt;code&gt;git commit --fixup&lt;&#x2F;code&gt;, but automatic&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;references&quot;&gt;References&lt;&#x2F;h1&gt;
&lt;p&gt;Check the official Git SCM &lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;&quot;&gt;website&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;git&#x2F;git-scm.com&quot;&gt;repository&lt;&#x2F;a&gt; for images and guidance.&#x27;&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>QML Online - Qt 5.15, Kirigami, Breeze and more!</title>
            <pubDate>Mon, 10 Aug 2020 19:20:39 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2020/qmlonline-qt515-kirigami-and-more/</link>
            <guid>https://patrickelectric.work/blog/2020/qmlonline-qt515-kirigami-and-more/</guid>
            <description>&lt;p&gt;I&#x27;m happy to announce that &lt;a href=&quot;https:&#x2F;&#x2F;qmlonline.kde.org&quot;&gt;QML Online &lt;&#x2F;a&gt; is now running with the last version of Qt (5.15) and with an &lt;a href=&quot;https:&#x2F;&#x2F;qmlonline.kde.org&#x2F;?code=PTAEDECcHsFsC5QGsCWkUHMCGsXFlgM4AuAppMKQB44AOANqYcISrA6dXY86+4wGEAFlmIBBWrQB0AR1j0AUMABUC0MtCgAygAUAIgA0AtOBSDotAJ7oMQ4gBVqxRACYADAEYA7KACyWSABjaD8A4hQAO1AAHgJIYgABJAATUiloSAwAPjVVdU1dQyMAGRRA0gjCUiMASVSI8IAzFHJEYoBxHWKjFyk3IwyjelFyXOAFBTZaDOJQAEViOYBXMqRQXoA2SfYZ+cWVwKQpYqxLaCXiQlAPKRdt6fi95dWpAWgGmHor3pdQInm5gI7lNdhkMFIUmlUDYcCh1lIPB4-lcANJoTCwiZomG4KQSBhlUQod4AdUiyWgAHdQABvNSaUAoZKIGDQYgTBmgEBCUhYVKQRDYjG4+zQaD0ABCAXx9EJ4XeAAlefzaQBfemaEDgGoGXwAUUQtHIIloV2IPNAqUaWCW9Fm9GgGDKoEaGVAGGgkQwoEpTKYgUgnCihCE53oyVAACNSKBA80IqQI0tTcRAzgNT6-VoA0HEL7kubQFlQMF6EtYBEyQWhPkAMwZ2gwI3xSyMhol8XlytM82C9HYXEAVQiKEuUgw6GSw9H+Q89c5jYs5GIrcis1dbPISswdkQ-nNUhgSwiyQAFEKBygpNOxxOmTf8r0AKwASg5DIwDsjWHoekgWEpVpQAvWEpHaL8fz-ADyFpDNOWCBoKmIGoyFgKQpllQJRyrXsOzLCscKEOCGXCYhGEQAAiYRRFAfEKOIzRSMYGoEMopB3gAN3IQgiXeejOU5WBoGSH9EFTJZSAYy1-0AyAAHkjQiRBrS+SSBIZFBCF8ColjEyAJPfdSsECeVKkQABtKTORA3ExBM4kojpdTnJIpxKIAJTFWBCH4lznLKd4ADkcFISiOJaSkhk04gjACypfL80BVQAGishkbKvOzTNgxL1LIKhnFAKj3mIYzLgS3LNDi4LYFCorSowIwjQsRgKpclK0s0DK8Xs94csq1yCsorReSCIQ2ty6qQsoqoAkCcbOqSqSAF0M3VeCSqcKDZL7HErzkrjIGGSxtpgpz-OZDtEIK07ICkkBzVIVtAiwKJUkUiM+se0BaCwDAY1lJAY3NGi3WjS1SHjRNLTQUgTPoVseUDKTE3+xAFikLBJEw3iIikY7zmIPRYd6qIAF4yb2KR3J3BxoGKSHZgAfiphnGmIPVkn+0B0eIanac5-6pKEkT6EQABCVk+fzUhs0DCopPeXxhJ-aiIn+y7khk8gFIqUBKfFkWfykkQT0YAA1TSUEjci-mxuUHLJE8qX1ynjytSJoZZlSqh5u2CRe0ynYpSlTxfKQENTcVCEt1gbck+7gCRmNfuSZIvVANxkVAWUSFHUhvJzsU1mjYgyEgTNzUJ7OLGmKoI2IEJXtbNkkauqPFBcxvaB0Pl0-VxA3CkyM2Ub2Be7Tr1B6kxh2Yn-uMGnlybDseep8zwyBMjpCUILxA3nwiITjOC5+sStMKQiBGfqbZdV3bDCymwnshBZMU+dLLtCMWwhfqwgeN6VTmICXobwPjijPgNY+hMpDNHoPQQiekDIDQZN+Q4E5zgnkQO5OGpV1aMEgSgzQr15oZEILAswYsfoBCQotFypYMi7WFFeewPJapSCEDuWUthiAHwyHQ5yFhjKjksIPKQAAOARmh1RSOoZPAB3UbzkLvFOEc7JZHbwaLvBAoAD5dmgafc6RCNKXSYqQAx7JjGcl-sIhR-ZQJKPHJOG8m9jGeUpBYwhVjNA2P-ovYC9ihxqOUc4tRsiXI4JMq9T8MYjHeOcgwgUAS9pSFYQXNInDbDcLsImRwBU+F3XiX5f86cliEDzC-cJk1+BP2IIg5JzDrzBPQghLQKAABeTApC1VKbAKpiVH5YWINuHhiBBnP2rP0gS60ikMj0RWTxcTZkMmAUCY4WBoz0C8cszkFiKHwPqeJNSOz6HikYQ0y8qS2EZK4bTXJTgClTMqvlQqFEUR6D1BNZZMyTmaFWb0E4mztm-L2XAhBL8kHHN+VvM5STuppPYZkoQ2SyDJDybw2FTzcqugaFIaYa42mdKYZcxxOLiDaVTGUchZK8WegaISmMGg3ASKxYlF5lEADEkJECQnSJkL5syfmCqmUK4x-z1lAqWfE0FlDDn6ShbMxJxLQIIpuVku5aKHmYpOeyoq-hIixi8i6N07y9QdlgLAY8IjkqgFbjBVkhcaE52itDGivKwTAAdT5VlPp-y0GVqkRA6KpAkgyMkEkfqRWyNFc5GRlVuojV+v+RuFcpWJRlQciFoAjmLTjblcVctxT0EtqQakaa-IZvBdWSFsjK0jN3Nm+VtboolrLVMkWpAqFPiHkU1IjBsBkGVbiKUrBAilBINo4FxjhibMojobifUKKgAANSgA7b+UQWAfVVCTaIDIsdra2x9gqopgYqiQC4loP+pBwAZBYu8ZSP4qhRuMTG9SebEoJtILulNU7nKVrlcgoheyCBUDYOWethUPAgHGcM0gtNc2LW6iOso47kKoT-epGdnbKLtCPLQEsP56ACpcnFSiL14FGBIGEEjzkd0BD3ZAA98dH2qUQ-GwJV4UNjuipO8tLlsNUIoiNE8tEy7GSELVBotH1JkaKgQMwRhRClXmlJ4gMmBL0eTfuq2LGXRPpPbGqSQqP3UP+loFTRwrQ2jtPM7s1a8Jf0qQuP6stLPoTUSgH8vc0agHMvNV6CYvhvB2AmBoNqAsYtC0hVaGYQvTDC7MctTJEABYiEFwg8X3i0JcgmgMRaNmMB87ExaZjKJqwyxpsqDlyEKaUhc0CWUHKYYEnFKQERppFVmmNDTnJdXCdGvNDTb6BJoKQBg922DcHRIIfx5yJDQyQGpZQw0NCGgaNhUOlh1ypBjYmyeR5lURucg3OXdGIDUliklAEFrnIeS0zfmyWB78tzwZ4bI1OC8ttNNHOQwgBB4FXtsRgWR7jFlTIW2Q-ZVCk05fib49eijmn-aI0DvxUyQCBTkvYA0jIEKgEIMmB4swDWNwgZGC4jcogGoWKAJ8CIPBTPFaKcUEpKd9Tmygutb2G05pOSAAgQNGSzEIDIJYNCfWwfqfd97Jzur3scj6zkkOlsRyQuQGo9XYfrehZofMuEke-Zae8Blf2Af0G0r0pXDIZcNv10RXXBPzhBDqhRBCzQMBLEDL13Kx2iHvAEJhIGl0pZ4tcxZ4yRxjrcTxWUoQp4qgIWSMfcgWXEsvgANwvvieKkLI8JTQCoLd3KAGs1852dzh7jagPLPXRZCipglvqZtQNpPFEW+sLQMkCiq0il+-fexkvLaIrF6qpdNLGW0MaK94GLRJ5qCuFkXX0AtYe1EL7aQAddVkNEFQ7xjDnO-KCc5RVztRUV1ruEp2vQm6pnzThkgQrdVy-ePv4cRMqXTaT+ihHGfO959F4UxtipBUBTJaaMbMZHoGZTJnrkCXrXq3qQAK6sbPqvqD4D6cimZp5ITAopYlgiBRYJZw7qR5afAzpFauYtZlZFQcqmpVakxXCH6cizyFTdRNYc5TJtYda1SUQUiBDlhISRCug+55RuRFSn5bJCHQAiFLTGJ1bfbsGK5FJcGdYUTdZDZTL9YjRzQLRoFHaLTVbvDkLbwFTi70CKHlJ+ayJsGkyj4CT9aeRwDaCkBlxejerKEIQ1Su7u6YBe6kAyHWScY9TZRMG5RaEuHhDqzXABEMj95+Q2EhE+rhGuFREuAxHSLRqpTGIJHNahGiFDRFRaAiCBgRiW5ebpF45BSqF8ECENBUbFH+FTI5EcE6piEURlFYDRHZ7eLNFKE7L9YdHrAVFxG5ZBGKF2FdxtGDG1jDHRqLS965R7ZHhYKgCRJ4IxJ2Eq7LbwKraz6WJEJKoNYig7ZLGYLJCHa+6LSnZAS54lSfB2G26FTXGQCQYfZ9yI5BGOIo6A5-xeiyKnGTarHTb4IlZFKHHwonGR77bnHarxJfo-puh5F+RrEzagm65bHQ67HEG-LglBGqrPb8GZawnQrhRxy2yRboqa60AXCYz2RcS3qEk+ojG5RbETG5QsFYm4osHW6aAryFTa58x8k8nZoWCcl8zdxMndEDTMmaCaLoZ7yrFUjg5FLM5OCmCdoRhIkuSl4OYv6zJ4EUlOBUkXA+oAkrF8YynTIY7ABY445jL46E6SC7Ck5XZRjs7U5RC0706IhM4XYs6SjulsnqSV6jLV6GbeIC5YBC4zii7i7IwnJS5ZqPE+ry745akskRCkKq7lCIRIFa5rb7HQr27faOJxSm5SDfEW6JgoDljCmPEVKTKO6EDO7lCUQehGAJgFQVGYFSn6H6GLRoatp2EGlf6dqEBT7GKHThAUYWLEyBikxtDD6lpSAF5lxwCiiii0DT6QB7Ga4gGL5yFX5UKr6yIb5b6IB8ZTL1lHFXiOIqIPgaAAAsUydmypOyVAJZzS95YSJyGJU5hI9AAg6uSSApUg-5FGQFuZPq4qgKZ+6ZbKYh66N+pUoAAApOsKACzBRAAFLQBCBRB6DQD+F+w4V4VRAyikDfjljdmxHQUXawVbLwV+QDFMA8TcxLqrpIW34nKWk9l6GXHtRrSbzYHtjJaXSJ7vDJ6nCp5wBEE67OTdTFZUGji2wDYpEYDuGLFQnLGXQokgl2G4kpL4lmkwkOiFICXYovZJLM5XZSipqyLXmh7PGvFip+m2WBlMUhm85NpFKRnRki5i4S7KE1JDLS486FlWKpktE7IYk5nlya5ik+rFk3k-ZjhlkdJdKVllG1knLXn27botneHvAe5+GzFFIB5B4f6GpPa-TmbubR6q7TC0BhxZ78WJQjYmYKCqhAA&quot;&gt;initial Kirigami integration with breeze icons&lt;&#x2F;a&gt;!&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;qmlonline_kirigami_qt515&#x2F;banner.jpg&quot; alt=&quot;image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There is also a couple of updates for quality of life, like:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;HTML fixes&#x2F;corrections&lt;&#x2F;li&gt;
&lt;li&gt;Better integration with Firefox&lt;&#x2F;li&gt;
&lt;li&gt;New Qt version information label&lt;&#x2F;li&gt;
&lt;li&gt;Support for &lt;code&gt;QtQuick.XmlListModel&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;But sadly, with new features we do have new bugs! As I said before, the Kirigami integration is an initial version, there are some know bugs with it, like:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;OverlayDrawer has a transparent background (the issue appears to be common in low performance environments)&lt;&#x2F;li&gt;
&lt;li&gt;Kirigami version is a bit old (v5.70), newer versions need Qt future feature for QFuture and friends&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;what-is-next&quot;&gt;What is next&lt;&#x2F;h1&gt;
&lt;p&gt;I&#x27;ll be working closer with Kirigami to fix these bugs, and the new feature of multiple instances of QML Online on the same webpage will be in hold for now.&lt;&#x2F;p&gt;
&lt;p&gt;As a reminder, please be free to send &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;webapps&#x2F;qmlonline&#x2F;-&#x2F;merge_requests&quot;&gt;Merge Requests&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;webapps&#x2F;qmlonline&#x2F;-&#x2F;issues&#x2F;new&quot;&gt;feature requests, opinions and issues&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;thanks&quot;&gt;Thanks&lt;&#x2F;h1&gt;
&lt;p&gt;I would like to thank all users of QML Online, and the people that are sending kind works about how it&#x27;s improving their workflow and how useful the tool is! That really helps to move the project forward.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>How to rock: First tips</title>
            <pubDate>Sat, 08 Aug 2020 08:28:00 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2020/how-to-rock-first-tips/</link>
            <guid>https://patrickelectric.work/blog/2020/how-to-rock-first-tips/</guid>
            <description>&lt;p&gt;After working for some time collaborating with open source&#x2F;free software projects, I started to help newcomers to contribute and push the development further with good practices.&lt;&#x2F;p&gt;
&lt;p&gt;This post will try to itemize some important tips that can be used for software collaboration and personal projects, hopefully it&#x27;ll help you to have a solid ground of good practices and advices for your contributions in a project. It contains information abut good code practices, a simple guide of helpful API design, code organization, comments, naming variables, development flow and self-criticism. Please enjoy, and any feedback (including critics) is much appreciated!&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;h1 id=&quot;code-practices&quot;&gt;Code practices&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Encapsulate magic variables&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;cpp&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-cpp &quot;&gt;&lt;code class=&quot;language-cpp&quot; data-lang=&quot;cpp&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; First version
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;start_communication&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;232&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Reviewer: What is the meaning of 0 ? What is 1 ? Why 232 ?
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Second version
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;enum class &lt;&#x2F;span&gt;&lt;span&gt;Messages {
&lt;&#x2F;span&gt;&lt;span&gt;      ...
&lt;&#x2F;span&gt;&lt;span&gt;      RequestStatus = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;232&lt;&#x2F;span&gt;&lt;span&gt;,
&lt;&#x2F;span&gt;&lt;span&gt;  }
&lt;&#x2F;span&gt;&lt;span&gt;  ...
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span&gt;uint8_t vid = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span&gt;uint8_t cid = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;start_communication&lt;&#x2F;span&gt;&lt;span&gt;(vid, cid, Messages::RequestStatus);
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Reviewer: What is vid ? What is cid ?
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F;Final version
&lt;&#x2F;span&gt;&lt;span&gt;  ...
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span&gt;uint8_t vehicle_id = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span&gt;uint8_t component_id = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;start_communication&lt;&#x2F;span&gt;&lt;span&gt;(vehicle_id, component_id, Messages::RequestStatus);
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you can see, the final version makes everything more readable, we know that we are starting the communication with a vehicle that has an id of 0 and the vehicle probably contains a component with id 1, and while calling this function we are also requesting the status. Much better than 0, 1 and 232 right ?
Doing this will help the reviewers and future developers to understand what is the meaning of such numbers.
It&#x27;s also necessary to avoid variables that contains only single letters or really short abbreviations, is much harder to understand this: $$C^2 = A^2 + B^2$$
over this: $$hypotenuse^2 = catheti_1^2 + catheti_2^2$$&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Avoid multiple arguments&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;cpp&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-cpp &quot;&gt;&lt;code class=&quot;language-cpp&quot; data-lang=&quot;cpp&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; First version
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;auto&lt;&#x2F;span&gt;&lt;span&gt; vehicle = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;new &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Vehicle&lt;&#x2F;span&gt;&lt;span&gt;(
&lt;&#x2F;span&gt;&lt;span&gt;    VehicleType::Car,
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,
&lt;&#x2F;span&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;},
&lt;&#x2F;span&gt;&lt;span&gt;    Fuel::Electric,
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1.2&lt;&#x2F;span&gt;&lt;span&gt;,
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;613
&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Reviewer: What is the meaning of all this values ?
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F;           How can we make it better ?
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Second version
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;auto&lt;&#x2F;span&gt;&lt;span&gt; vehicle = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;new &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Vehicle&lt;&#x2F;span&gt;&lt;span&gt;(VehicleType::Car)
&lt;&#x2F;span&gt;&lt;span&gt;vehicle-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setNumberOfTires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;vehicle-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setTirePressure&lt;&#x2F;span&gt;&lt;span&gt;({&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;});
&lt;&#x2F;span&gt;&lt;span&gt;vehicle-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setFuel&lt;&#x2F;span&gt;&lt;span&gt;(Fuel::Electric);
&lt;&#x2F;span&gt;&lt;span&gt;vehicle-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setWeightInTons&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1.2&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;vehicle-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setAutonomyInKm&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;613&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; It&amp;#39;s also possible to use aggregate initialization in C++20
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; and user-defined literals from C++11
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;auto&lt;&#x2F;span&gt;&lt;span&gt; vehicle = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;new &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Vehicle&lt;&#x2F;span&gt;&lt;span&gt;({
&lt;&#x2F;span&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;type &lt;&#x2F;span&gt;&lt;span&gt;= VehicleType::Car,
&lt;&#x2F;span&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;numberOfTires &lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,
&lt;&#x2F;span&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;tirePressure &lt;&#x2F;span&gt;&lt;span&gt;= {&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;_psi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;31&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;_psi&lt;&#x2F;span&gt;&lt;span&gt;},
&lt;&#x2F;span&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;fuel &lt;&#x2F;span&gt;&lt;span&gt;= Fuel::Electric,
&lt;&#x2F;span&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;weight &lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1.2&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;_tn&lt;&#x2F;span&gt;&lt;span&gt;,
&lt;&#x2F;span&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;autonomy &lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;613&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;_km&lt;&#x2F;span&gt;&lt;span&gt;,
&lt;&#x2F;span&gt;&lt;span&gt;});
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Both second and C++20&#x2F;C++11 alternatives are valid for a better readability of the code, to choose between both alternatives will depend of how are you going to design your API, probably if you are more familiar with the Qt API, the second version appears to be the most common, the C++20&#x2F;C++11 alternative appears to be a bit more verbose but can be useful to avoid multiple function calls and helpful when dealing with a simpler code base.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Encapsulate code when necessary&lt;&#x2F;strong&gt;, try to break functions in a more readable and explanatory way:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;cpp&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-cpp &quot;&gt;&lt;code class=&quot;language-cpp&quot; data-lang=&quot;cpp&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Original version
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;void &lt;&#x2F;span&gt;&lt;span&gt;Serial::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;start_serial_communication&lt;&#x2F;span&gt;&lt;span&gt;() {
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Check if we are open to talk
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;if &lt;&#x2F;span&gt;&lt;span&gt;(!_port || _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;register&lt;&#x2F;span&gt;&lt;span&gt;() != &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;0xb0001&lt;&#x2F;span&gt;&lt;span&gt;) {
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#96b5b4;&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;Serial port is not open!&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;    }
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Send a 10ms serial break signal
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;set_break_enabled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;msleep&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;set_break_enabled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;usleep&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Send intercalated binary for detection
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;write&lt;&#x2F;span&gt;&lt;span&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;);
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;flush&lt;&#x2F;span&gt;&lt;span&gt;();
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Send start AT command
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;write&lt;&#x2F;span&gt;&lt;span&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;AT+start&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Reviewer: Try to make it more readable encapsulating
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F;            some functionalities
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Second version
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;bool &lt;&#x2F;span&gt;&lt;span&gt;Serial::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;is_port_open&lt;&#x2F;span&gt;&lt;span&gt;() {
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;return &lt;&#x2F;span&gt;&lt;span&gt;!_port || _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;register&lt;&#x2F;span&gt;&lt;span&gt;() != &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;0xb0001&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;void &lt;&#x2F;span&gt;&lt;span&gt;Serial::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;force_baudrate_detection&lt;&#x2F;span&gt;&lt;span&gt;() {
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Send a 10ms serial break signal
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;set_break_enabled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;msleep&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;set_break_enabled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;usleep&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Send intercalated binary for detection
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;write&lt;&#x2F;span&gt;&lt;span&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;);
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;flush&lt;&#x2F;span&gt;&lt;span&gt;();
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;void &lt;&#x2F;span&gt;&lt;span&gt;Serial::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;send_message&lt;&#x2F;span&gt;&lt;span&gt;(Message &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;message_type&lt;&#x2F;span&gt;&lt;span&gt;) {
&lt;&#x2F;span&gt;&lt;span&gt;    _port-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;write&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;messageFromType&lt;&#x2F;span&gt;&lt;span&gt;(message_type));
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;void &lt;&#x2F;span&gt;&lt;span&gt;Serial::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;start_serial_communication&lt;&#x2F;span&gt;&lt;span&gt;() {
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;if &lt;&#x2F;span&gt;&lt;span&gt;(!&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;is_port_open&lt;&#x2F;span&gt;&lt;span&gt;()) {
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#96b5b4;&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;Serial port is not open!&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;    }
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;force_baudrate_detection&lt;&#x2F;span&gt;&lt;span&gt;();
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;send_message&lt;&#x2F;span&gt;&lt;span&gt;(Message::Start)
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you can see, the reason behind each block of code is clear now, and with that, the comments are also not necessary anymore, the code is friendly and readable enough that&#x27;s possible to understand it without any comments, the function name does the job for free.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Avoid comments&lt;&#x2F;strong&gt;, that&#x27;s a clickbait, comments are really necessary, but they may be unnecessary when you are doing something that&#x27;s really straightforward, and sometimes when something isn&#x27;t, it&#x27;s better to encapsulate it.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;cpp&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-cpp &quot;&gt;&lt;code class=&quot;language-cpp&quot; data-lang=&quot;cpp&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Original version
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;void &lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;blink_routine&lt;&#x2F;span&gt;&lt;span&gt;() {
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Use the LED builtin
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const int&lt;&#x2F;span&gt;&lt;span&gt; led_builtin = LED_BUILTIN;
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Configure ping to output
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setPinAsOutput&lt;&#x2F;span&gt;&lt;span&gt;(led_builtin);
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Loop forever
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;while&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;) {
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Turn the LED on
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;turnPinOn&lt;&#x2F;span&gt;&lt;span&gt;(led_builtin);
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Wait for a second
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;wait_seconds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Turn the LED off
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;turnPinOff&lt;&#x2F;span&gt;&lt;span&gt;(led_builtin);
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Wait for a second
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;wait_seconds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;        }
&lt;&#x2F;span&gt;&lt;span&gt;    }
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Before checking the final version, let me talk more about it:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For each line of code you&#x27;ll have a comment (like a parrot that repeat what we say), and the worst thing about these comments is that the content is exactly what you can read from the code! You can think that this kind of comment is dead code, something that has the same meaning as the code, but it does not run, resulting in a duplicated amount of lines to maintain. If you forget to update each comment for each line of code, you&#x27;ll have a comment that does not match with the code, and this will be pretty confuse for someone that&#x27;s reading it.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;One of the most important skills about writing comments, is to know when not to write it!&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A comment should bring a value to the code, if you can remove the comment and the code can be understandable by a newcomer, the comment is not important.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;cpp&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-cpp &quot;&gt;&lt;code class=&quot;language-cpp&quot; data-lang=&quot;cpp&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Final version
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;void &lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;blink_routine&lt;&#x2F;span&gt;&lt;span&gt;() {
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const int&lt;&#x2F;span&gt;&lt;span&gt; led_builtin = LED_BUILTIN;
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setPinAsOutput&lt;&#x2F;span&gt;&lt;span&gt;(led_builtin);
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;while&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;) {
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;turnPinOn&lt;&#x2F;span&gt;&lt;span&gt;(led_builtin);
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;wait_seconds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;turnPinOff&lt;&#x2F;span&gt;&lt;span&gt;(led_builtin);
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;wait_seconds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;        }
&lt;&#x2F;span&gt;&lt;span&gt;    }
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;There is a good video about this subject by &lt;a href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=NLebZ3XT92E&quot;&gt;Walter E. Brown in cppcon 2017, &quot;Whitespace ≤ Comments ＜＜ Code&quot;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;And to finish, you should not avoid comments, you should understand when comments are necessary, like this:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;cpp&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-cpp &quot;&gt;&lt;code class=&quot;language-cpp&quot; data-lang=&quot;cpp&quot;&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; From ArduPilot - GPIO_RPI
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;void &lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;set_gpio_mode_alt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;int &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;pin&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;int &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;alternative&lt;&#x2F;span&gt;&lt;span&gt;) {
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; **Moved content from cpp for this example**
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span&gt;uint8_t pins_per_register = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Calculates the position of the 3 bit mask in the 32 bits register
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span&gt;uint8_t tree_bits_position_in_register = (pin%pins_per_register)*&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;** Creates a mask to enable the alternative function based in the following logic:
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    *
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    * | Alternative Function | 3 bits value |
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    * |:--------------------:|:------------:|
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    * |      Function 0      |     0b100    |
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    * |      Function 1      |     0b101    |
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    * |      Function 2      |     0b110    |
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    * |      Function 3      |     0b111    |
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    * |      Function 4      |     0b011    |
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    * |      Function 5      |     0b010    |
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;    *&#x2F;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span&gt;uint8_t alternative_value =
&lt;&#x2F;span&gt;&lt;span&gt;        (alternative &amp;lt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;4 &lt;&#x2F;span&gt;&lt;span&gt;? (alternative + &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;) : (alternative == &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;4 &lt;&#x2F;span&gt;&lt;span&gt;? &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;3 &lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;));
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; 0b00&amp;#39;000&amp;#39;000&amp;#39;000&amp;#39;000&amp;#39;000&amp;#39;000&amp;#39;ALT&amp;#39;000&amp;#39;000&amp;#39;000 enables alternative for the 4th pin
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span&gt;uint32_t mask_with_alt = static_cast&amp;lt;uint32_t&amp;gt;(alternative_value) &amp;lt;&amp;lt; tree_bits_position_in_register;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span&gt;uint32_t mask = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;0b111 &lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&amp;lt; tree_bits_position_in_register;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; Clear all bits in our position and apply our mask with alt values
&lt;&#x2F;span&gt;&lt;span&gt;    uint32_t register_value = _gpio[pin &#x2F; pins_per_register];
&lt;&#x2F;span&gt;&lt;span&gt;    register_value &amp;amp;= ~mask;
&lt;&#x2F;span&gt;&lt;span&gt;    _gpio[pin &#x2F; pins_per_register] = register_value | mask_with_alt;
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Mostly of the lines in this code can be impossible to understand without access or reading the datasheet directly,
the comments are here to understand what is going on and why, otherwise anyone that&#x27;ll touch this code will need to do a reverse engineer to understand it.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;development-flow&quot;&gt;Development flow&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Avoid creating multiple Pull Requests (PRs)&lt;&#x2F;strong&gt;, update the ones that are still open.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;E.g: You created a Pull Request called &quot;Add button feature&quot;, some modifications will be necessary after the review process, and for that you&#x27;ll need to update the same branch over creating new ones. That&#x27;s necessary to help the project maintainers to see previous comments and the development history. Creating multiple PRs will only make the maintainers confuse and unable to track old comments, suggestions and your code changes between PRs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create atomic and self-contained commits&lt;&#x2F;strong&gt;, avoid doing multiple tasks in the same commit.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;E.g: You created a commit to fix the serial communication class, and inside the same commit you are doing 3 different tasks, removing trailing spaces, fixing a pointer validation check and a typo in the documentation of a different class. This appear to be silly and bureaucratic, but there are good reasons to break this simple commit and at least 3 different commits, one for the pointer check, a second one for the typo and a third one for the trailing space.&lt;&#x2F;p&gt;
&lt;p&gt;Developers usually track lines history to understand the changes behind a functionality, it&#x27;s common to search with grep history from commits or line changes in specific commits to understand the history of a library, function, class, or a small feature, if the commits start to be polluted with unnecessary changes, this development practice will be almost impossible to be done, since a bunch of unrelated lines will me changed between commits and this technic will be unable to help the dear developer. &lt;code&gt;git blame&lt;&#x2F;code&gt; will also be of little help.&lt;&#x2F;p&gt;
&lt;p&gt;The example was also really simple, but you can imagine what happens if you change different parts of the code, for unrelated things, and a bug appears, technics such as &lt;code&gt;git bisect&lt;&#x2F;code&gt; will still work, but the result will be much harder to understand and to find which line is the one that created such bug.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create atomic and self-sustained PRs&lt;&#x2F;strong&gt;, avoid doing multiple things in the same PR, like different features. They may appear simple with small pieces of code&#x2F;functionality but they can escalate quickly after a review process, and if both features are somehow related or dependently, it&#x27;s recommended to break it in multiple PRs with code to maintain compatibility with current code base.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;E.g: You have applied a PR for software notifications, and somehow you also added a URL fetch functionality to grab new software versions from the server. After the first review, the maintainer asks to create a more abstracted way to fetch data from a REST API and to deal with network requirements, this will start to convolute the PR, moving the initial idea of the notification feature to an entire network REST API architecture. With that, it&#x27;s better to break the PR in two, one that only provides the notification and a second PR that is used for the REST API related code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Do your own review&lt;&#x2F;strong&gt;, the final and probably most important tip of all, doing that will train your mind and eyes to detect poor code standards or bad practices, it&#x27;ll also make your PR be merged easily and faster, since you&#x27;ll be able to catch problems before the reviewer feedback. Some reviewers may think that reviewing your own PR is a must, since we are talking about open source projects and free software, you should understand that the people that are reviewing your code are not obligated to do so, the majority are collaborating and donating their own time to help the development and maintenance of such projects, doing your own review is a sign of empathy about the project and maintainer time.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;final-comment&quot;&gt;Final comment&lt;&#x2F;h1&gt;
&lt;p&gt;This is the first post of a series that I&#x27;m planning to do. Hope that some of these points may help you in your journey.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=MBRoCdtZOYg&quot;&gt;CppCon 2019: Kate Gregory “Naming is Hard: Let&#x27;s Do Better”&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=n0Ak6xtVXno&quot;&gt;CppCon 2018: Kate Gregory “Simplicity: Not Just For Beginners”&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=kYVxGyido9g&quot;&gt;CppCon 2018: Kate Gregory “What Do We Mean When We Say Nothing At All?”&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YWiAUUblD34&quot;&gt;CppCon 2017: Lars Knoll “Qt as a C++ Framework: History, Present State and Future”&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=XkDEzfpdcSg&quot;&gt;CppCon 2017: Kate Gregory “10 Core Guidelines You Need to Start Using Now”&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=NLebZ3XT92E&quot;&gt;Cppcon 2017: Walter E. Brown “Whitespace ≤ Comments ＜＜ Code”&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wiki.qt.io&#x2F;API_Design_Principles&quot;&gt;API Design Principles - TQtC&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;doc.qt.io&#x2F;archives&#x2F;qq&#x2F;qq13-apis.html&quot;&gt;Designing Qt-Style C++ APIs - Matthias Ettrich&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;people.mpi-inf.mpg.de&#x2F;~jblanche&#x2F;api-design.pdf&quot;&gt;The Little Manual of API Design - Jasmin Blanchette&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
        </item>
        <item>
            <title>QML Online - Can be everywhere!</title>
            <pubDate>Mon, 03 Aug 2020 18:59:39 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2020/qmlonline-can-be-everywhere/</link>
            <guid>https://patrickelectric.work/blog/2020/qmlonline-can-be-everywhere/</guid>
            <description>&lt;p&gt;A new feature of QML Online is already available, allows it to run in any site&#x2F;blog with minimal js&#x2F;html code!&lt;&#x2F;p&gt;
&lt;p&gt;Hopefully, our experience with QML examples, tutorials and documentation should change in the near future.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;Ff you don&#x27;t know what &lt;a href=&quot;https:&#x2F;&#x2F;qmlonline.kde.org&#x2F;&quot;&gt;QML Online&lt;&#x2F;a&gt; is, please take a look in my previous posts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;..&#x2F;qmlonline-first-version&quot;&gt;QML Online - First version&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;..&#x2F;qmlonline-a-new-home&quot;&gt;QML Online - QML Online - A new home!&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;what-are-we-talking-about&quot;&gt;What are we talking about ?&lt;&#x2F;h1&gt;
&lt;p&gt;QML Online now can be used in any blog or website without much work, like this:&lt;&#x2F;p&gt;
&lt;script type=&quot;text&#x2F;javascript&quot; src=&quot;https:&#x2F;&#x2F;qmlonline.kde.org&#x2F;qtloader.js&quot;&gt;&lt;&#x2F;script&gt;
&lt;script type=&quot;text&#x2F;javascript&quot; src=&quot;https:&#x2F;&#x2F;qmlonline.kde.org&#x2F;qml.js&quot;&gt;&lt;&#x2F;script&gt;
```js
import QtQuick 2.7
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.12

Rectangle {
    color: &quot;#179AF3&quot;
    anchors.fill: parent

     ColumnLayout{
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        CheckBox {
            checked: true
            text: &quot;Check this!&quot;
        }
        CheckBox {
            text: &quot;Or this!&quot;
        }
    }

    Text {
        text: &quot;KDE&quot;
        font.pixelSize: 80
        font.bold: true
        color: &quot;#82CB38&quot;
        anchors.centerIn: parent
        RotationAnimator on rotation {
            running: true
            loops: Animation.Infinite
            from: 0
            to: 360
            duration: 1500
        }
    }
}
```

&lt;!--
&lt;script type=&quot;text&#x2F;javascript&quot; src=&quot;https:&#x2F;&#x2F;qmlonline.kde.org&#x2F;qtloader.js&quot;&gt;&lt;&#x2F;script&gt;
&lt;script type=&quot;text&#x2F;javascript&quot; src=&quot;https:&#x2F;&#x2F;qmlonline.kde.org&#x2F;qml.js&quot;&gt;&lt;&#x2F;script&gt;
--&gt;

&lt;div id=&quot;qmlonline&quot;&gt;&lt;&#x2F;div&gt;

&lt;script type=&#x27;text&#x2F;javascript&#x27;&gt;
    const qmlonline = new QmlOnline(&quot;qmlonline&quot;)
    qmlonline.registerCall({
        qmlMessage: function(msg) {
            console.log(`qml message: ${msg}`)
        },
        qmlError: function(data) {
            console.log(`qml message: ${JSON.stringify(msg)}`)
        },
        posInit: function() {
            qmlonline.setCode(`import QtQuick 2.7
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.12

Rectangle {
    color: &quot;#179AF3&quot;
    anchors.fill: parent

     ColumnLayout{
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        CheckBox {
            checked: true
            text: &quot;Check this!&quot;
        }
        CheckBox {
            text: &quot;Or this!&quot;
        }
    }

    Text {
        text: &quot;KDE&quot;
        font.pixelSize: 80
        font.bold: true
        color: &quot;#82CB38&quot;
        anchors.centerIn: parent
        RotationAnimator on rotation {
            running: true
            loops: Animation.Infinite
            from: 0
            to: 360
            duration: 1500
        }
    }
}`)
        },
    })
    qmlonline.init()
&lt;&#x2F;script&gt;
&lt;p&gt;And how can this new feature be used ?&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s quite simple, check this minimal HTML example:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;html&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-html &quot;&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;html&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;head&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;title&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;Qml Online minimal example&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;title&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;head&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;script &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;=&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;text&#x2F;javascript&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;src&lt;&#x2F;span&gt;&lt;span&gt;=&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;https:&#x2F;&#x2F;qmlonline.kde.org&#x2F;qtloader.js&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;&amp;gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;script&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;script &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;=&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;text&#x2F;javascript&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;src&lt;&#x2F;span&gt;&lt;span&gt;=&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;https:&#x2F;&#x2F;qmlonline.kde.org&#x2F;qml.js&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;&amp;gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;script&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;div &lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;=&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;qmlonline&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;&amp;gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;script &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;=&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;text&#x2F;qml&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;    import QtQuick 2.7
&lt;&#x2F;span&gt;&lt;span&gt;    import QtQuick.Controls 2.3
&lt;&#x2F;span&gt;&lt;span&gt;    Rectangle {
&lt;&#x2F;span&gt;&lt;span&gt;        color: &amp;quot;#179AF3&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;        anchors.fill: parent
&lt;&#x2F;span&gt;&lt;span&gt;        Text {
&lt;&#x2F;span&gt;&lt;span&gt;            text: &amp;quot;KDE&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;            font.pixelSize: 80
&lt;&#x2F;span&gt;&lt;span&gt;            font.bold: true
&lt;&#x2F;span&gt;&lt;span&gt;            color: &amp;quot;#82CB38&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;            anchors.centerIn: parent
&lt;&#x2F;span&gt;&lt;span&gt;            RotationAnimator on rotation {
&lt;&#x2F;span&gt;&lt;span&gt;                running: true
&lt;&#x2F;span&gt;&lt;span&gt;                loops: Animation.Infinite
&lt;&#x2F;span&gt;&lt;span&gt;                from: 0
&lt;&#x2F;span&gt;&lt;span&gt;                to: 360
&lt;&#x2F;span&gt;&lt;span&gt;                duration: 1500
&lt;&#x2F;span&gt;&lt;span&gt;            }
&lt;&#x2F;span&gt;&lt;span&gt;        }
&lt;&#x2F;span&gt;&lt;span&gt;    }
&lt;&#x2F;span&gt;&lt;span&gt;    &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;script&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;script &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;=&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;text&#x2F;javascript&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;qml &lt;&#x2F;span&gt;&lt;span&gt;= new &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;QmlOnline&lt;&#x2F;span&gt;&lt;span&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;qmlonline&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;)
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;qml&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;registerCall&lt;&#x2F;span&gt;&lt;span&gt;({
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;qmlMessage&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(msg) {
&lt;&#x2F;span&gt;&lt;span&gt;                console.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#96b5b4;&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(`&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;qml message: &lt;&#x2F;span&gt;&lt;span&gt;${&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;}`)
&lt;&#x2F;span&gt;&lt;span&gt;            },
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;qmlError&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(data) {
&lt;&#x2F;span&gt;&lt;span&gt;                console.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#96b5b4;&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(`&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;qml error: &lt;&#x2F;span&gt;&lt;span&gt;${JSON.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#96b5b4;&quot;&gt;stringify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)}`)
&lt;&#x2F;span&gt;&lt;span&gt;            },
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;posInit&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;() {
&lt;&#x2F;span&gt;&lt;span&gt;                &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;qml&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ebcb8b;&quot;&gt;Array&lt;&#x2F;span&gt;&lt;span&gt;.prototype.slice.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;apply&lt;&#x2F;span&gt;&lt;span&gt;(document.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;getElementsByTagName&lt;&#x2F;span&gt;&lt;span&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;script&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;)).&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;find&lt;&#x2F;span&gt;&lt;span&gt;(e &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;=&amp;gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.type == &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;text&#x2F;qml&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;).text)
&lt;&#x2F;span&gt;&lt;span&gt;            },
&lt;&#x2F;span&gt;&lt;span&gt;        })
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;qml&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;init&lt;&#x2F;span&gt;&lt;span&gt;()
&lt;&#x2F;span&gt;&lt;span&gt;    &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;script&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;html&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you can see, there is three steps, include both &lt;code&gt;qtloader.js&lt;&#x2F;code&gt; and &lt;code&gt;qml.js&lt;&#x2F;code&gt;, add a &lt;code&gt;div&lt;&#x2F;code&gt; DOM and create a &lt;code&gt;QmlOnline&lt;&#x2F;code&gt; object.
Since I&#x27;m not a web expert, probably there is a better way to organize this approach for the user and bugs may exist.
Be free to create &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;webapps&#x2F;qmlonline&#x2F;-&#x2F;merge_requests&quot;&gt;Merge Requests&lt;&#x2F;a&gt;, or get in touch with &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;webapps&#x2F;qmlonline&#x2F;-&#x2F;issues&#x2F;new&quot;&gt;feature requests and issues&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;what-is-next&quot;&gt;What is next ?&lt;&#x2F;h1&gt;
&lt;p&gt;From my planned objectives, sharing QML Online as library to be available for any website was one of the final points, the only one that&#x27;s still missing is the Kirigami support, that&#x27;s still in progress and hopefully will be finished until the end of the year (if everything goes fine).&lt;&#x2F;p&gt;
&lt;p&gt;There is also a small bug, where &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;webapps&#x2F;qmlonline&#x2F;-&#x2F;issues&#x2F;3&quot;&gt;it&#x27;s not possible to use multiple QML Online instances on the same webpage&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>QML Online - A new home!</title>
            <pubDate>Tue, 16 Jun 2020 13:55:39 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2020/qmlonline-a-new-home/</link>
            <guid>https://patrickelectric.work/blog/2020/qmlonline-a-new-home/</guid>
            <description>&lt;p&gt;A quick update, QML Online now has a new home!&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Website: &lt;a href=&quot;http:&#x2F;&#x2F;qmlonline.kde.org&#x2F;&quot;&gt;qmlonline.kde.org&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Repository: &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;webapps&#x2F;qmlonline&quot;&gt;invent.kde.org&#x2F;webapps&#x2F;qmlonline&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;h1 id=&quot;what-is-next&quot;&gt;What is next&lt;&#x2F;h1&gt;
&lt;p&gt;Now that the project is under KDE organization, I&#x27;ll start with the planned new capabilities, such as the Kirigami support and the html element to help with online documentation of qml snippets.&lt;&#x2F;p&gt;
&lt;p&gt;And to finish this quick update, be invited to help with the project and send &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;webapps&#x2F;qmlonline&#x2F;-&#x2F;merge_requests&quot;&gt;Merge Requests&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;webapps&#x2F;qmlonline&#x2F;-&#x2F;issues&#x2F;new&quot;&gt;feature requests and opinions&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;konqi.png&quot; alt=&quot;image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>QML Online - First stable version!</title>
            <pubDate>Wed, 20 May 2020 00:00:00 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2020/qmlonline-first-version/</link>
            <guid>https://patrickelectric.work/blog/2020/qmlonline-first-version/</guid>
            <description>&lt;p&gt;Finally, after working since October and learning a bunch about &lt;a href=&quot;https:&#x2F;&#x2F;webassembly.org&#x2F;&quot;&gt;WebAssembly&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Cascading_Style_Sheets&quot;&gt;CSS&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wikipedia.org&#x2F;wiki&#x2F;HTML&quot;&gt;HTML&lt;&#x2F;a&gt; (sad, right ?) and &lt;a href=&quot;https:&#x2F;&#x2F;emscripten.org&#x2F;&quot;&gt;emscripten&lt;&#x2F;a&gt;, I can happily announce a stable version of &lt;a href=&quot;https:&#x2F;&#x2F;patrickelectric.work&#x2F;qmlonline&#x2F;&quot;&gt;qmlonline&lt;&#x2F;a&gt;!
In this post, I&#x27;m going to show the idea behind the project and some code that may help you with your future adventures.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;h1 id=&quot;the-initial-steps&quot;&gt;The initial steps&lt;&#x2F;h1&gt;
&lt;p&gt;Everything starts with &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;patrickelectric&#x2F;qhot&quot;&gt;QHot&lt;&#x2F;a&gt;, that I describe as &lt;em&gt;&quot;Hot reload for nested QML files&quot;&lt;&#x2F;em&gt;, a useful tool for anyone that likes to prototype UI elements or ideas with a real-time feedback of what you are typing in QML. I noticed that compiling the project or recalling qml&#x2F;qmlscene tools just to test and check my ideas was pretty annoying and time-consuming, the desire to have something like &lt;a href=&quot;https:&#x2F;&#x2F;godbolt.org&#x2F;&quot;&gt;godbolt&lt;&#x2F;a&gt; or &lt;a href=&quot;http:&#x2F;&#x2F;quick-bench.com&#x2F;&quot;&gt;quick-bench&lt;&#x2F;a&gt; started growing. My objective was something that was closer to these tools but for QML development, and that is how &lt;strong&gt;QHot&lt;&#x2F;strong&gt; was born.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;patrickelectric&#x2F;qhot&#x2F;master&#x2F;doc&#x2F;example.gif&quot; alt=&quot;image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With QHot working, I started to add some small features in the command line interface to have mostly of the functionalities that exist in qml&#x2F;qmlscene, at least the most important ones for my use.&lt;&#x2F;p&gt;
&lt;p&gt;After some days, the idea of &lt;strong&gt;QHot&lt;&#x2F;strong&gt; working in the browser via webassembly started to grow, and with that, the initial work that would result in &lt;strong&gt;qmlonline&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;journey&quot;&gt;Journey&lt;&#x2F;h1&gt;
&lt;p&gt;After some tweaks around &lt;strong&gt;QHot&lt;&#x2F;strong&gt;, it was possible to have the first version of qmlonline working.
The initial version was entirely made with QML, without HTML components, the editor was a &lt;a href=&quot;https:&#x2F;&#x2F;doc.qt.io&#x2F;qt-5&#x2F;qml-qtquick-textedit.html&quot;&gt;TextEdit&lt;&#x2F;a&gt; with a fancy &lt;a href=&quot;https:&#x2F;&#x2F;doc.qt.io&#x2F;qt-5&#x2F;qsyntaxhighlighter.html&quot;&gt;QSyntaxHighlighter&lt;&#x2F;a&gt;. The text inside the &lt;strong&gt;TextEdit&lt;&#x2F;strong&gt; was used to create a new component with &lt;a href=&quot;https:&#x2F;&#x2F;doc.qt.io&#x2F;qt-5&#x2F;qml-qtqml-qt.html#createQmlObject-method&quot;&gt;Qt.createQmlObject&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;qmlonline-first-version&#x2F;full-qml.png&quot; alt=&quot;image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With the initial version working, I started to move the interface to HTML, this was necessary to have a better shortcut handling system and a better integration with the browser for user inputs.&lt;&#x2F;p&gt;
&lt;p&gt;The code evolved from a simple &lt;strong&gt;TextEdit&lt;&#x2F;strong&gt; with some controls to a full HTML interface, for that, functions had to be imlpemented to help with the webassembly code to be accessible from the webpage.&lt;&#x2F;p&gt;
&lt;p&gt;From the beginning, I had an initial singleton class called &lt;strong&gt;Util&lt;&#x2F;strong&gt; that was conceived to be some kind of helper class for the QML code. This same class was used to create the interface between the JS and the webassembly via emscripten.&lt;&#x2F;p&gt;
&lt;p&gt;In general, two functions were created, &lt;code&gt;std::string Util::codeEMS() const&lt;&#x2F;code&gt; that returns the code that is being used in the QML to render the user component, and &lt;code&gt;void Util::setCodeEMS(const std::string&amp;amp; code)&lt;&#x2F;code&gt; that sets the code that should be rendered.
To access both functions and the class, &lt;a href=&quot;https:&#x2F;&#x2F;emscripten.org&#x2F;docs&#x2F;porting&#x2F;connecting_cpp_and_javascript&#x2F;embind.html&quot;&gt;EMSCRIPTEN_BINDINGS&lt;&#x2F;a&gt; were used.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;cpp&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-cpp &quot;&gt;&lt;code class=&quot;language-cpp&quot; data-lang=&quot;cpp&quot;&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;#include &lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;emscripten&#x2F;bind.h&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;EMSCRIPTEN_BINDINGS&lt;&#x2F;span&gt;&lt;span&gt;(util) {
&lt;&#x2F;span&gt;&lt;span&gt;    emscripten::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;class_&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;Util&amp;gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;Util&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;)
&lt;&#x2F;span&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;, &amp;amp;Util::codeEMS)
&lt;&#x2F;span&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;setCode&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;, &amp;amp;Util::setCodeEMS);
&lt;&#x2F;span&gt;&lt;span&gt;    emscripten::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;, &amp;amp;Util::self, emscripten::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;allow_raw_pointers&lt;&#x2F;span&gt;&lt;span&gt;());
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;That&#x27;s probably the most important piece of code to do the integration between the C++ and JS.&lt;&#x2F;p&gt;
&lt;p&gt;And for the QML, well, you can check all QML here:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;js&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-js &quot;&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span&gt;...
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;import &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Util&lt;&#x2F;span&gt;&lt;span&gt; 1.0
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;ApplicationWindow &lt;&#x2F;span&gt;&lt;span&gt;{
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;window
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;title&lt;&#x2F;span&gt;&lt;span&gt;: &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;qmlonline&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;visible&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;true
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Connections&lt;&#x2F;span&gt;&lt;span&gt; {
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;target&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Util
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;onCodeChanged&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;userParentItem&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Util&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;    }
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Item &lt;&#x2F;span&gt;&lt;span&gt;{
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;userParentItem
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;anchors&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;fill&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;parent
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;property var userItem&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;null
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;function create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;textComponent&lt;&#x2F;span&gt;&lt;span&gt;) {
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;userItem&lt;&#x2F;span&gt;&lt;span&gt;) {
&lt;&#x2F;span&gt;&lt;span&gt;                &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;userItem&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;destroy&lt;&#x2F;span&gt;&lt;span&gt;()
&lt;&#x2F;span&gt;&lt;span&gt;            }
&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;userItem&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Qt&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;createQmlObject&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;textComponent&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;userParentItem&lt;&#x2F;span&gt;&lt;span&gt;, &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;userItem&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;)
&lt;&#x2F;span&gt;&lt;span&gt;        }
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Component&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;onCompleted&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;userParentItem&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Util&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;    }
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Oh, &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;patrickelectric&#x2F;qmlonline&#x2F;blob&#x2F;71342f68f5f99dcf9c2b69051b63ea2e83010ca8&#x2F;src&#x2F;util.cpp&quot;&gt;you can check the source code here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To build the project, I changed my approach a couple of times.
For the first test version, I did my development based in the official documents for &lt;a href=&quot;https:&#x2F;&#x2F;doc.qt.io&#x2F;qt-5&#x2F;wasm.html&quot;&gt;Qt webassembly&lt;&#x2F;a&gt;. But, compiling Qt for each machine that I use was a bit of a pain, so I started to use a docker available from this &lt;a href=&quot;https:&#x2F;&#x2F;www.qt.io&#x2F;blog&#x2F;2019&#x2F;03&#x2F;05&#x2F;using-docker-test-qt-webassembly&quot;&gt;Qt blog post&lt;&#x2F;a&gt;.
And everything was great until newer versions of Qt and emscript were released, and after some time searching, I found this great &lt;a href=&quot;https:&#x2F;&#x2F;hub.docker.com&#x2F;r&#x2F;madmanfred&#x2F;qt-webassembly&#x2F;tags&quot;&gt;repository&#x2F;developer&lt;&#x2F;a&gt; with a couple of Qt containers for webassembly and different emscript versions.&lt;&#x2F;p&gt;
&lt;p&gt;And after building the project, you can always test it with &lt;code&gt;python3 -m http.server&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;where-i-am&quot;&gt;Where I am&lt;&#x2F;h1&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;qmlonline-first-version&#x2F;final-version.gif&quot; alt=&quot;image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As you can see from the gif, the basic functionality is still the same from the original version, that was full QML.&lt;&#x2F;p&gt;
&lt;p&gt;The user experience has improved, the interface is now much smoother compared to the full QML version. Qt webassembly is great, but from my tests, the performance was not good and the browser&#x2F;system integration needs improvement to have the same functionality as a normal webpage or application.&lt;&#x2F;p&gt;
&lt;p&gt;Again, remember to check &lt;a href=&quot;https:&#x2F;&#x2F;patrickelectric.work&#x2F;qmlonline&#x2F;&quot;&gt;qmlonline&lt;&#x2F;a&gt; in your browser :)&lt;&#x2F;p&gt;
&lt;p&gt;If you have good QML examples and wish to add those, contact me via email, or create an issue in the &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;patrickelectric&#x2F;qmlonline&quot;&gt;repository&lt;&#x2F;a&gt;, or send a PR, &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;patrickelectric&#x2F;qmlonline&#x2F;tree&#x2F;gh-pages&#x2F;qml&#x2F;examples&quot;&gt;it&#x27;s really simple&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;what-i-m-working-on&quot;&gt;What I&#x27;m working on&lt;&#x2F;h1&gt;
&lt;p&gt;There is a couple of things that I&#x27;m still working to improve qmlonline:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Kirigami support&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ajaxorg&#x2F;ace&#x2F;pulls?q=author%3Apatrickelectric+&quot;&gt;Better ace editor integration with QML&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A qmlonline element to integrate with websites like Qt&#x2F;KDE website documents&lt;&#x2F;li&gt;
&lt;li&gt;Start to move qmlonline to be a KDE project&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Any feature request will be much welcome!&lt;&#x2F;p&gt;
&lt;h1 id=&quot;thanks&quot;&gt;Thanks!&lt;&#x2F;h1&gt;
&lt;p&gt;Special thanks to Arthur Turrini, everybody in &lt;a href=&quot;https:&#x2F;&#x2F;t.me&#x2F;qtbrasil&quot;&gt;Qt Brasil telegram channel&lt;&#x2F;a&gt; and the KDE members, the project would not be possible without the help and inspiration provided by the developers.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>QT3D, Lines and AtCore</title>
            <pubDate>Sun, 02 Jul 2017 00:00:00 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2017/qt3d-lines-atcore/</link>
            <guid>https://patrickelectric.work/blog/2017/qt3d-lines-atcore/</guid>
            <description>&lt;p&gt;After some time working with Qt3D, now Atelier project is one step closer to have a 3D viewer from the GCode and a realtime draw of printer work.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;QT3DLines&#x2F;atcore.gif&quot; alt=&quot;3D draw with lines&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To know how Qt3D works, you can take a look in this &lt;a href=&quot;https:&#x2F;&#x2F;doc.qt.io&#x2F;qt-5&#x2F;qt3d-overview.html&quot;&gt;overview&lt;&#x2F;a&gt;. Where, working with 3D lines was a bit problematic, but I hope to help someone with this job.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;rendering&quot;&gt;Rendering&lt;&#x2F;h1&gt;
&lt;p&gt;To render, we need our mesh and the material. This simple cube have something more than 1300 lines, and if you are thinking about it, you can can handle big models like this &lt;a href=&quot;https:&#x2F;&#x2F;www.thingiverse.com&#x2F;thing:51415&quot;&gt;Dragon Head&lt;&#x2F;a&gt; with around 706000 lines in 60fps.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;QT3DLines&#x2F;dragon.png&quot; alt=&quot;dragon&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mesh&quot;&gt;Mesh&lt;&#x2F;h3&gt;
&lt;p&gt;It&#x27;s done with a C++ code, where a 4D vector is used to perform the buffer population, the 4D is because a 3D printer have 4 dimensions in a actuation space, (X, Y, Z and E) where E is the extruder that move the filament to perform the extrusion.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;cpp&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-cpp &quot;&gt;&lt;code class=&quot;language-cpp&quot; data-lang=&quot;cpp&quot;&gt;&lt;span&gt;LineMeshGeometry::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;LineMeshGeometry&lt;&#x2F;span&gt;&lt;span&gt;(QList&amp;lt;QVector4D&amp;gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;vertices&lt;&#x2F;span&gt;&lt;span&gt;, Qt3DCore::QNode *&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;) :
&lt;&#x2F;span&gt;&lt;span&gt;    Qt3DRender::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;QGeometry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;    , &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;_positionAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;new &lt;&#x2F;span&gt;&lt;span&gt;Qt3DRender::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;QAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;))
&lt;&#x2F;span&gt;&lt;span&gt;    , &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;_vertexBuffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;new &lt;&#x2F;span&gt;&lt;span&gt;Qt3DRender::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;QBuffer&lt;&#x2F;span&gt;&lt;span&gt;(Qt3DRender::QBuffer::VertexBuffer, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;))
&lt;&#x2F;span&gt;&lt;span&gt;{
&lt;&#x2F;span&gt;&lt;span&gt;    QByteArray vertexBufferData;
&lt;&#x2F;span&gt;&lt;span&gt;    vertexBufferData.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;resize&lt;&#x2F;span&gt;&lt;span&gt;(vertices.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;size&lt;&#x2F;span&gt;&lt;span&gt;() * &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;3 &lt;&#x2F;span&gt;&lt;span&gt;* sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;float&lt;&#x2F;span&gt;&lt;span&gt;));
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;float &lt;&#x2F;span&gt;&lt;span&gt;*rawVertexArray = reinterpret_cast&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;float &lt;&#x2F;span&gt;&lt;span&gt;*&amp;gt;(vertexBufferData.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;());
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; idx = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;for &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;const auto &lt;&#x2F;span&gt;&lt;span&gt;&amp;amp;v : vertices) {
&lt;&#x2F;span&gt;&lt;span&gt;        rawVertexArray[idx++] = v.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;();
&lt;&#x2F;span&gt;&lt;span&gt;        rawVertexArray[idx++] = v.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;();
&lt;&#x2F;span&gt;&lt;span&gt;        rawVertexArray[idx++] = v.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;z&lt;&#x2F;span&gt;&lt;span&gt;();
&lt;&#x2F;span&gt;&lt;span&gt;        _vertices.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(v.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;toVector3D&lt;&#x2F;span&gt;&lt;span&gt;());
&lt;&#x2F;span&gt;&lt;span&gt;    }
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    _vertexBuffer-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setData&lt;&#x2F;span&gt;&lt;span&gt;(vertexBufferData);
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    _positionAttribute-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setAttributeType&lt;&#x2F;span&gt;&lt;span&gt;(Qt3DRender::QAttribute::VertexAttribute);
&lt;&#x2F;span&gt;&lt;span&gt;    _positionAttribute-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setBuffer&lt;&#x2F;span&gt;&lt;span&gt;(_vertexBuffer);
&lt;&#x2F;span&gt;&lt;span&gt;    _positionAttribute-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setDataType&lt;&#x2F;span&gt;&lt;span&gt;(Qt3DRender::QAttribute::Float);
&lt;&#x2F;span&gt;&lt;span&gt;    _positionAttribute-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setDataSize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    _positionAttribute-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setName&lt;&#x2F;span&gt;&lt;span&gt;(Qt3DRender::QAttribute::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;defaultPositionAttributeName&lt;&#x2F;span&gt;&lt;span&gt;());
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;addAttribute&lt;&#x2F;span&gt;&lt;span&gt;(_positionAttribute);
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;int &lt;&#x2F;span&gt;&lt;span&gt;LineMeshGeometry::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;vertexCount&lt;&#x2F;span&gt;&lt;span&gt;()
&lt;&#x2F;span&gt;&lt;span&gt;{
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt; _vertices.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;size&lt;&#x2F;span&gt;&lt;span&gt;();
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With this done, it&#x27;s possible to easy populate it with a simple class.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;cpp&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-cpp &quot;&gt;&lt;code class=&quot;language-cpp&quot; data-lang=&quot;cpp&quot;&gt;&lt;span&gt;LineMesh::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;LineMesh&lt;&#x2F;span&gt;&lt;span&gt;(Qt3DCore::QNode *&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;) :
&lt;&#x2F;span&gt;&lt;span&gt;    Qt3DRender::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;QGeometryRenderer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;    , &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;_lineMeshGeo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;nullptr&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;{
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setInstanceCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setIndexOffset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setFirstInstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; This will allow the line visualization
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setPrimitiveType&lt;&#x2F;span&gt;&lt;span&gt;(Qt3DRender::QGeometryRenderer::LineStrip);
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;&#x2F;&#x2F; This will be visualized in qml
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;qRegisterMetaType&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;QList&amp;lt;QVector4D&amp;gt; &amp;gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;QList&amp;lt;QVector4D&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;auto&lt;&#x2F;span&gt;&lt;span&gt; gcode = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;new &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;GcodeTo3D&lt;&#x2F;span&gt;&lt;span&gt;();
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(gcode, &amp;amp;GcodeTo3D::posFinished, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;, &amp;amp;LineMesh::posUpdate);
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;void &lt;&#x2F;span&gt;&lt;span&gt;LineMesh::&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8fa1b3;&quot;&gt;posUpdate&lt;&#x2F;span&gt;&lt;span&gt;(QList&amp;lt;QVector4D&amp;gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;{
&lt;&#x2F;span&gt;&lt;span&gt;    _vertices = pos;
&lt;&#x2F;span&gt;&lt;span&gt;    _lineMeshGeo = &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;new &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;LineMeshGeometry&lt;&#x2F;span&gt;&lt;span&gt;(_vertices, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;);
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setVertexCount&lt;&#x2F;span&gt;&lt;span&gt;(_lineMeshGeo-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;vertexCount&lt;&#x2F;span&gt;&lt;span&gt;());
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;setGeometry&lt;&#x2F;span&gt;&lt;span&gt;(_lineMeshGeo);
&lt;&#x2F;span&gt;&lt;span&gt;    emit &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;finished&lt;&#x2F;span&gt;&lt;span&gt;();
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;material-and-entity&quot;&gt;Material and Entity&lt;&#x2F;h3&gt;
&lt;p&gt;The material used in the first GIF was &lt;a href=&quot;https:&#x2F;&#x2F;doc.qt.io&#x2F;qt-5&#x2F;qml-qt3d-extras-phongmaterial.html&quot;&gt;PhongMaterial&lt;&#x2F;a&gt;, this is simple done with:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;qml&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-qml &quot;&gt;&lt;code class=&quot;language-qml&quot; data-lang=&quot;qml&quot;&gt;&lt;span&gt;PhongMaterial {
&lt;&#x2F;span&gt;&lt;span&gt;  id: lineMaterial
&lt;&#x2F;span&gt;&lt;span&gt;  ambient: &amp;quot;darkGreen&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And in the end, the creation of an Entity.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;qml&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-qml &quot;&gt;&lt;code class=&quot;language-qml&quot; data-lang=&quot;qml&quot;&gt;&lt;span&gt;LineMesh {
&lt;&#x2F;span&gt;&lt;span&gt;  id: lineMesh
&lt;&#x2F;span&gt;&lt;span&gt;  enabled: true
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;pre data-lang=&quot;qml&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-qml &quot;&gt;&lt;code class=&quot;language-qml&quot; data-lang=&quot;qml&quot;&gt;&lt;span&gt;Entity {
&lt;&#x2F;span&gt;&lt;span&gt;  id: lineEntity
&lt;&#x2F;span&gt;&lt;span&gt;  components: [ lineMesh, lineMaterial ]
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the next week we plan to finish our simple 3D viwer and add it in AtCore test GUI.\
For more info about &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;kde&#x2F;atcore&quot;&gt;AtCore and Atelier click here !&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;QT3DLines&#x2F;cube2.png&quot; alt=&quot;Cube 2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>LaKademy 2017</title>
            <pubDate>Sun, 14 May 2017 00:00:00 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2017/lakademy2017/</link>
            <guid>https://patrickelectric.work/blog/2017/lakademy2017/</guid>
            <description>&lt;p&gt;It was my first participation in a KDE sprint event, the famous LaKademy (Latin-America Akademy) in Brazil, Minas Gerais - Belo Horizonte. A great experience to talk, share and learn a bit more about KDE, coffee and software development.&lt;&#x2F;p&gt;
&lt;p&gt;Next I&#x27;ll talk about some points of what I have done during the event.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;h1 id=&quot;first-day&quot;&gt;First day:&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;AtCore:
&lt;ul&gt;
&lt;li&gt;Some bug corrections of the new AtCore test client, moving from QWidgets to QDockWidget.&lt;&#x2F;li&gt;
&lt;li&gt;Some patchs review.&lt;&#x2F;li&gt;
&lt;li&gt;.gitignore updates to remove .patch and .diff from project.&lt;&#x2F;li&gt;
&lt;li&gt;Update some tasks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;KDevelop:
&lt;ul&gt;
&lt;li&gt;Solving compilation errors from &lt;code&gt;kdesrc-build --include-dependencies kdevelop&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;syntax-highlighting:
&lt;ul&gt;
&lt;li&gt;Add Arduino extensions (.ino, .pde).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Bug correction in breeze-icons, but one was already in review.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;second-day&quot;&gt;Second day:&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;babe-qt:
&lt;ul&gt;
&lt;li&gt;Code corrections and refactory.&lt;&#x2F;li&gt;
&lt;li&gt;Restore functionality of CMakeLists.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;KDevelop:
&lt;ul&gt;
&lt;li&gt;Solve some compile corrections.&lt;&#x2F;li&gt;
&lt;li&gt;Attempt to solve more compile problems with --include-dependencies.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Atcore:
&lt;ul&gt;
&lt;li&gt;Adjustments in GUI.&lt;&#x2F;li&gt;
&lt;li&gt;Update in 3D visualizer of Gcode for 3D printers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;third-day&quot;&gt;Third day:&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;KDE
&lt;ul&gt;
&lt;li&gt;Development of a docker to help the use and development of KDE applications with the help of &lt;code&gt;kdesrc-build&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;Tested with AtCore, Cantor, GCompris and Kate. (&lt;a href=&quot;https:&#x2F;&#x2F;hub.docker.com&#x2F;r&#x2F;patrickelectric&#x2F;kde&#x2F;&quot;&gt;Link&lt;&#x2F;a&gt;)
&lt;ul&gt;
&lt;li&gt;It was only possible with the help of Jedi.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;LaKademy&#x2F;docker.jpg&quot; alt=&quot;Jedi&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h1 id=&quot;last-day&quot;&gt;Last day:&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;KDE
&lt;ul&gt;
&lt;li&gt;Finalization of kde&#x27;s docker.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;KDevelop
&lt;ul&gt;
&lt;li&gt;Start to work in copy-paste functionality in KDevelop popup.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It was a event completely different of what I thought, a great experience for any developer. Maybe, next time, I can see you in LaKademy 2018 ;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;LaKademy&#x2F;lakademy2017.jpg&quot; alt=&quot;LaKademy2017&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>[GSoC] KDev-Embedded, OpenOCD and avrdude</title>
            <pubDate>Wed, 01 Feb 2017 00:00:00 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2017/kdev-embedded-openocd-and-avrdude/</link>
            <guid>https://patrickelectric.work/blog/2017/kdev-embedded-openocd-and-avrdude/</guid>
            <description>&lt;p&gt;KDev-Embedded  now have OpenOCD integration and a new interface to use avrdude in launcher.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;sudar&#x2F;Arduino-Makefile&quot;&gt;Arduino-Makefile&lt;&#x2F;a&gt;, it&#x27;s possible to use a makefile to perform compilation of Arduino projects. In the video one the the examples are used to shows how it is possible to use the new avrdude launcher to execute the upload process.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;video width=&quot;640&quot; height=&quot;360&quot; controls&gt;
  	&lt;source src=&quot;&#x2F;assets&#x2F;kdev_embedded_openocd&#x2F;arduino1.mp4&quot; type=&quot;video&#x2F;mp4&quot;&gt;
&lt;&#x2F;video&gt;
&lt;p&gt;In the avrdude new interface was added more KComboBox to create a more generic and configurable interface helping advanced users.&lt;&#x2F;p&gt;
&lt;p&gt;The OpenOCD support can upload the binary to an embedded plataform and launch the OpenOCD server to perform upload and debugging with GDB. The graphic interface still in development for further improvements.&lt;&#x2F;p&gt;
&lt;video width=&quot;640&quot; height=&quot;360&quot; controls&gt;
  	&lt;source src=&quot;&#x2F;assets&#x2F;kdev_embedded_openocd&#x2F;lm4f2321.mp4&quot; type=&quot;video&#x2F;mp4&quot;&gt;
&lt;&#x2F;video&gt;
&lt;p&gt;In the next steps, we are aiming the OpenOCD interface to be more friendly with basic and advanced users, and a new integration with DFU or other tool for embedded systems.&lt;&#x2F;p&gt;
&lt;p&gt;Best regards,&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>[GSoC] KDev-Embedded, workflow integration</title>
            <pubDate>Mon, 30 Jan 2017 00:00:00 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2017/kdev-embedded-workflow-integration/</link>
            <guid>https://patrickelectric.work/blog/2017/kdev-embedded-workflow-integration/</guid>
            <description>&lt;p&gt;After some work in the plugin development, now the project have a strong focus in a better integration with KDevelop workflow. Until now the Board Configuration window have some simple features to perform the upload process for beginner users, it&#x27;s called by the &lt;em&gt;&lt;strong&gt;embedded&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; submenu in the KDevelop toolbar.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Welcome message&lt;&#x2F;figcaption&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;kdev_embedded_workflow&#x2F;arduinowindow063.png&quot; alt=&quot;arduinowindow063&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Error message&lt;&#x2F;figcaption&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;kdev_embedded_workflow&#x2F;arduinowindow064.png&quot; alt=&quot;arduinowindow064&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Success message&lt;&#x2F;figcaption&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;kdev_embedded_workflow&#x2F;arduinowindow065.png&quot; alt=&quot;arduinowindow065&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The problem is that the Board Configuration window don&#x27;t follow the integrated workflow of KDevelop, and that&#x27;s what are we doing right now, turning the &lt;strong&gt;KDev-Embedded&lt;&#x2F;strong&gt; an integrated plugin helping programmers that already know how to use the software and how to perform what they want. That&#x27;s the idea behind the &lt;strong&gt;Embedded Launcher&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;figcaption class=&quot;wp-caption-text&quot;&gt;KDev-Embedded Embedded Launcher&lt;&#x2F;figcaption&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;kdev_embedded_workflow&#x2F;launch_config70.png&quot; alt=&quot;launch_config70&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The Embedded Launcher try to help beginners and advanced users with presets and a Board menu, until now the preset ComboBox is disabled until we finish the ARM support and the Board menu configure some others features like MCU, Interface baud rate and Arguments, but the user is free to perform modifications in this fields thanks to KComboBox. After the launcher configuration finished the user can save and execute it to perform  the upload process that shows in KDevelop output.&lt;&#x2F;p&gt;
&lt;figcaption class=&quot;wp-caption-text&quot;&gt;KDevelop output showing the programmer feedback&lt;&#x2F;figcaption&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;kdev_embedded_workflow&#x2F;Selection_074.png&quot; alt=&quot;selection074&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The plugin still in development, supporting  Arduino board and being tested only on some boards like Arduino Nano and Mini. In the next week we&#x27;ll start the ARM support.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>[GSoC] KDev-Embedded, The alpha version is coming !</title>
            <pubDate>Sun, 29 Jan 2017 00:00:00 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2017/kdev-embedded-the-alpha-version-is-coming/</link>
            <guid>https://patrickelectric.work/blog/2017/kdev-embedded-the-alpha-version-is-coming/</guid>
            <description>&lt;p&gt;The GSoC plan to dominate the world of embedded system developments is near to have his first version !&lt;&#x2F;p&gt;
&lt;p&gt;Today one of the most important steps was performed, the first upload to a microController. The code was a blink compiled with a makefile and uploaded with the KDev-Embedded plugin to an AVR microController (Arduino Nano board).&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;assets&#x2F;kdev_embedded_the_alpha&#x2F;Selection_024.png&quot; alt=&quot;upload&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With the Arduino&#x27;s support done, the plugin will have the first release version and the start of next step (ARM processors).&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>[GSoC] KDev-Embedded, Debugging and programming embedded systems</title>
            <pubDate>Sat, 28 Jan 2017 00:00:00 +0000</pubDate>
            <link>https://patrickelectric.work/blog/2017/kdev-embedded-debugging-and-programming-embedded-systems/</link>
            <guid>https://patrickelectric.work/blog/2017/kdev-embedded-debugging-and-programming-embedded-systems/</guid>
            <description>&lt;p&gt;The actual embedded system word depends on closed-source IDEs and libraries, with high monetary value and deprecated functionalities. Programmers that would like to use ARM based boards without paying for an IDE will have problems setting up such development ambient and synchronized toolkits.&lt;&#x2F;p&gt;
&lt;p&gt;The main idea of this project is to provide a plugin integrated with KDevelop to help the debugging and programming process of embedded systems like AVR, ARM and x86 based boards.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;Since 2011, starting with my electronic engineering graduation the contact with embedded system begun with PIC and ATMEL uC. In 2012 I was accepted in the ROBOTA (competition D&amp;amp;R team) and the ProVANT (Project and Development of UAV in the tilt-rotor configuration), both project working with hardware and software integration.&lt;&#x2F;p&gt;
&lt;p&gt;The development on ProVANT project showed how difficult can be to program an embedded system without using closed source software, It&#x27;s hard to find a descent IDE to develop in such area, ever harder to do it with open-source programs and tools.&lt;&#x2F;p&gt;
&lt;p&gt;But after some time I discovered &lt;a href=&quot;http:&#x2F;&#x2F;openocd.org&#x2F;&quot;&gt;OpenOCD&lt;&#x2F;a&gt; and &lt;em&gt;arm-none-eabi&lt;&#x2F;em&gt; to do my job. But it was such a pain first time to understand and use everything together but after some time everything start to progress.&lt;&#x2F;p&gt;
&lt;p&gt;Now I am at Intel doing my internship to finish my electronic engineering graduation and working on KDevelop for GSOC 2016 project to turn KDevelop into a native system to debug and program embedded systems.&lt;&#x2F;p&gt;
&lt;p&gt;Until now the plugin developed can download and install the Arduino toolkit. This part was strongly based on &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;mupuf&#x2F;arduide&quot;&gt;ArduIDE&lt;&#x2F;a&gt; project for which I have contributed by updating the Arduino supported version and some corrections of the code, with a great help of Mupuf. Also a window in development to configure that board and interface to program.&lt;&#x2F;p&gt;
&lt;p&gt;The GSOC submission can be found &lt;a href=&quot;http:&#x2F;&#x2F;patrickjp.com&#x2F;wp-content&#x2F;uploads&#x2F;2016&#x2F;04&#x2F;gsoc.pdf&quot;&gt;here&lt;&#x2F;a&gt; for download.&lt;&#x2F;p&gt;
&lt;p&gt;TLDR: The focus of the project is a versatile plugin that can be used for both first travel and experienced programmers in the word of embedded systems !&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;ll try to update the blog as the project progress.&lt;&#x2F;p&gt;
</description>
        </item>
    </channel>
</rss>