Evolving Architecture @ 4Developers 2017

4Developers Festival, 03.04.2017, Warsaw

Track: Application Architectures II

Location:

Hotel Sangate Airport *** 
17 Stycznia Street No. 32
02 – 148 Warsaw

Here you can find more info about this great event 🙂

Description

During development phase its very easy to cross the design boundary – we want to take care about all possibilities and potential changes that can happen in our project. On the other hand when we are under the time pressure we take shortcuts which could in the end increase cost of even simple changes. How to deal with “overdesign”? How (at the same time) don’t close for improvements and changes? When we should make crucial technical decisions and when accept technical debt? This session is about true stories, mostly about huge mistakes, but also sometimes about decisions which in the end were very successful. The session for all who don’t want to end up with project that need’s to be rewritten to add a new button. The session for all who cares.

Still not sure?

This talk is a result of last 6 years of my professional experience with more than 10 projects. And within these projects I was able to see bad things and of course … really bad things. After each of them I’d got a feeling that I will never make the same mistake again. What I’m really proud of – I kept that promise! I was making new mistakes each time 🙂 I dealt with “over-designed” systems and “under-designed”. I’ dealt  with “company frameworks” and “our own solution!”.

I would like to do retrospective about all good and bad choices that have been made in all of these projects. I really do believe that with every mistake that has been made we can be closer to deliver better software with more fun and excellence…

There is one great thing about “standard” design patterns (book by gang of four): each of them is not only a description of implementation and its name, but also description of pros&cons. This is in my opinion the most important thing about them. You have solutions with ready on plate information about their limits and possibilities. Knowing the  limits gives you much more power to deliver better and more flexible software. It’s not only about delivering solutions. It’s about providing software that can be adopted to needs, however without wasting time when it’s not necessary.

And this talk is about my vision how to find this balance in real world projects.

Afterwords

I did very similar talk a few weeks ago in Gliwice. This time it will be slightly different with lot of improvements.

Evolving Architecture @ 4Developers 2017

I3 tiling window manager – try it out!

Why choosing tiling window manager can be a good option for you and how you can get more from your operating system? Find out if it can improve your daily tasks!

Tiling window manager?

In computing, a tiling window manager is a window manager with an organization of the screen into mutually non-overlapping frames, as opposed to the more popular approach of coordinate-based stacking of overlapping objects (windows) that tries to fully emulate the desktop metaphor.

wikipedia

I have already mention i3wm in 4 top performance boosters for linux users post- you can find video showing i3wm features in general:

Here you can see a couple of my workspaces:

Some examples of tiling windows managers:

  1. i3WM
  2. Awesome
  3. DWM
  4. xmonad

Why should I consider switching to tiling WM?

Designed for keyboard use

All popular tiled WMs are designed to be operated by keyboard only (Of course you can use your mouse if you like :)). This means that every action like moving “tiles”, changing current workspace, changing current layout, resizing, going fullscreen etc. can be made by keyboard. You can work in your IDE, ask some questions on skype/slack, do some operations in terminal and get back to source code without even thinking about using a mouse.

I know that these is possible in classical window manager, however tiling WMs “push you a little” to go this way. if you feel (like I do) that its quicker to use a keyboard and want to go this way then tiling managers are probably for you.

Customizable by default

All popular tiling WMs are designed by developers for developers. This means that you can power up your window manager easily, by adding new shortcuts, modes or whole functions.

Finally… Efficient

Using classical window manager I was finding myself very often in reorganizing current desktop. Moving windows around from one screen to another, from one workspace to another. In case of single-workspace systems (like all Ms Windows) you can have a loooong list under ALT-TAB shortcut.

In tiling WM you will forget about alt-tab behaviour. Most powerful thing is that you can teach your WM to place tiles in exact manner that you like them to on particular workspaces. Basically after some time you will find out that you hardly rearrange anything on your desktop. Everything just works for you.

Why i3WM and not other tiling windows manager?

I did try awesome for some time. However I found myself in situation when I did not extend my current desktop environment, because awesome is using LUA scripts for all configurations. Back then I did not know lua so every change was a little bit difficult for me. Especially that awesome was my first tiling window manager. I broke a simple rule: one change at a time 🙂 If you know lua well then you can try awesome, in other case I would suggest you to try i3 – it use very simple configuration files.

My i3

Configuration files

You can find all my configuration files related to i3 here. Download it, change and use it however you like.

Basic keyboard layout

Keyboard layer when used Mod key
Keyboard layer when used Shift+Mod key

What I’ve changed:

  • jkl;  to hjkl for moving around and moving tiles
  • Mod1  to Mod4  ( Mod4  is windows key)

Workspaces

Biggest value from using i3 is automation. You can tell your WM to which workspace every window should go. Back then I used to name my workspaces directly, however after some time I found that I don’t need “names” on my screen as I already know what is where.

Take a look on my current configuration as it is self-explanatory ( $tagX  == workspace X):

As you can see I simply define where i3WM should put particular application. Magic 🙂

Achieving this kind of result is very simple. To find how assign command should look like for your application you have to find its selector. Most often used is class  selector. For finding what you have to put within it you can use xprop  application:

After typing  xprop (probably you will have to install it) you have to “click” on application (by mouse). Then you will receive all data as in above example. This line:

keeps information about class. So If I would like to have pcmanfm always appear on workspace 5 then I will add this line to my config file:

And that’s it!

How I have things organised?

At the moment I use up to 7 workspaces:

  1. Work – main window. I used to have here my current IDE, file managers, and all other applications as this is my “default” workspace to work with. Usually I use here tabbed layout.
  2. Browser – only browsers are usually here. This one also use tabbed layout.
  3. Shell – terminals 🙂 Split layout of course 😉
  4. Conversations – Skype, sometimes qtox or thunderbird when I remember that I still have this one 😉 Usually tabbed layout
  5. Slack – Slack only..
  6. Special – This one is empty. Sometimes I run specific application and when I want to have it on a side it goes manually to workspace 6
  7. Music – Spotify, Vlc. Music in general.

Thanks to automatic arrangement all my applications go directly to workspace that is prepared for them in my mind. So if I want to search for something in the internet then I go to workspace 2. If I need to do something in terminal I go to workspace 3, when I need to ask some of my colleagues about something I go to 4 for skype and 5 for slack. Everything is always there for me as it should be.

Modes

Another great feature in i3wm is possibility to create “modes”. Mode is an extension where you can put more commands under one shortcut. My modes are:

  • resize_window – default mode that you will have out of the box under  $mod+r then you can change size of currently selected tile using arrows or jkl; .
  • exit – mode where I can choose one of:
    • lock
    • shutdown
    • logout
    • reboot
    • hibernate
  • office – mode where i can select one of libreoffice application
  • browser – running one of selected browser
  • ide – as you can guess- it helps me to select IDE:
  • quick – I think of it as “quick access”. For example:
    • postman
    • skype
    • slack
    • spotify
  • screen – this one helps me to prepare my workspace at particular places. Back then it was used to change from single notebook display to multiple displays. Currently it change configuration from notebook display to external one as I don’t use more than one monitor anymore (yes!)

Example mode configuration looks like this:

At first you set how it should look after invoking, then you describe your mode, after this you have to create shortcut to particular mode. Now When I use  $mod+p I will see at the bottom of my screen something like this:

So I can choose from one of above browsers. Please note that after command there is operation to go back to “default” mode. One can create “nested” modes. It’s possible to create mode that will be for example used only during development and change totally all shortcuts and behaviour, however I never get that far 😉

Other configurations?

In my configs repo you can also find a few other things:

  • own shortcuts – which are very easy to add
  • autostart applications
  • i3bar configuration
  • i3gaps configuration
  • color changes

Tips & Trics

Here are a few very useful in my opinion tips and trics that you may want to reuse:

  • Change moving around shortcuts from jkl;  to hjkl . Especially if you are using vim 🙂
  • Add  exec --no-startup-id nitrogen --restore  somewhere near end of config file. It will restore your desktop wallpaper. It’s really useful if you are using multiple displays or change from notebook to external one 🙂
  • Add these two lines to your shortcut configuration:

    After installing scrot you will be available to take screenshots (printscr for full desktop, shift+printscreen and then select desktop part using mouse to take partial screenshot).
  • I found that access to simple calendar can be really useful:

    This is how it looks like:

Afterwords

There is still a lot to say about i3WM. Definitely I will  write more about this great window manager in future. Leave a comment below!

I3 tiling window manager – try it out!

My top 4 performance boosters for linux system users

Here are a few of my favourite Linux “performance boosters”. If you think about starting using Linux OS every day (or you are use it already) at your work then this list can help you to boost your performance. List consists of only very general things – this means I didn’t put on it any specific (like git or mvn) tools which can be helpful only in particular cases. Try it out! I’m quite sure you will not be disappointed.

1. VIM

Yup- VIM. I couldn’t start this list in any other way. Could I? 🙂 Vim is not only a standalone tool. It’s more like text-editing approach. This approach can be used within many other tools (IntelliJ, Eclipse, Browsers (there are plugins!), Sublime, Kate, Visual Studio :)). Also I did try neovim, but probably my knowledge is far too small to use anything than standard vim functions. I’m aware that learning curve is shallow, but every little step further makes you much more efficient during text processing (efficient text processing is quite important during programming :))

2. ZSH instead of bash

I still remember that moment when I moved from bash to ZSH and it was really big step forward in my day-to-day performance. ZHS together with oh-my-zsh its a whole new level of possibilities to improve how you do every day tasks. For instance completions – git, gradlemvn, httpie, npm, docker, kubectl are fantastic. It’s already there and work out-of-the box, so in almost no-time you can boost how you manage things from CLI.

You can select option by using tab key. Of course it’s not only about completions 🙂 There is a lot more (possibility to auto syntax highlighting, great path expansion, path replacement or even spelling correction).

3. I3 tiling WM

In computing, a tiling window manager is a window manager with an organization of the screen into mutually non-overlapping frames, as opposed to the more popular approach of coordinate-based stacking of overlapping objects (windows) that tries to fully emulate the desktop metaphor.

— Wikipedia: https://en.wikipedia.org/wiki/Tiling_window_manager

My experience with tiling WMs started with Awesome, however it was a little bit difficult (as you need to learn lua scripts, and back then my knowledge of lua wasn’t too good). Along with my habits (Before I used gnome, kde, lxde and openbox mostly) this was bad choice (learning lua scripts and change perspective from windows to tiles). I3 on the other hand it’s quite simple to extend and adopt to tiles without swearing 🙂 This one deserves its own post (soon!).

Why using i3 boost productivity? First of all – distraction free. Tiles really helps to keep on screen only things that you really need at the moment. With possibility to auto-assigning particular applications to selected workspace you can provide yourself workspace which help you to be more productive. On top of that there is possibility to create your own modes. Watch screencast of i3 window manager:

TIP: Change default switch focus bindings to more vim-like approach:

4. Z plugin for ZSH

I’ve already mentioned ZSH. However, this one deserves its own place in my top 5, because its very simple, yet very powerful. Z is a plugin that helps you to move around within directories- it tries to remember most recent and most often used directories and help you moving to them using just part of its name. Since I have discovered it I barely use  cd command! Imagine that I work on completable future examples for blog. I can use command like this for that:

Is there more?

YES! There is a lot of small tools which can help you with your performance. However most of them are very case specific (like wrk2httpie or retrospective) so their usefulness is strongly related to particular use case.

Afterwords

Do you have any beloved tools? If so, please share them in comments!

My top 4 performance boosters for linux system users