Posts

Coding: The difference between readability and understandability

Dienstag, 17. August 2021, 11:53 Uhr | roberto@vasquez-angel.de |

For many people the readability of a program is an important thing. While code is written to be executed by machines the readability has become more and more important over the years. For many applications processing power and memory has become cheap and is available as easy as moving a slider with a mouse. At the same time developers have become sparse and hiring them has become expensive measured both in time and money. This includes the time to find any and the hiring process. At the same time software development has become much more complex over the last decades. And while abstraction has brought us much more readable code, the complexity is now under the sheets. Hidden in sometime dozens of layers between the developer and the executions of the program at machine level.

<picture about layers now vs. 20 years ago in web development>

It is much too easy to confound the readabilty of a program with the actual understandabilty and there for the ability of the developer to work with existing code.

In this example you can almost read the code as if it was plain english. This makes it really easy to understand at first glance. While this is certainly an advantage it does not come without downsides.

Rails: Using SSL in locale development

Mittwoch, 29. Juli 2020, 12:40 Uhr | roberto@vasquez-angel.de |

  1. Generate a new certificate:
  
# Create a folder to store the certificates
mkdir config/certs
# Ignore the certificates folder to avoid accidentally commiting the certs to the repo
echo "config/certs/*" >> .gitignore
# generate the certificate:
# Be sure to set the domain name to "lvh.me". Other settings don't matter
openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout config/certs/lvh.me.key -out config/certs/lvh.me.crt
  1. Configure rails to optionally force ssl in development mode:
  
Rails.application.configure do
config.force_ssl = true if ENV.fetch('SSL', nil) == "true"
end
  1. Start the server in SSL mode:
  
SSL=true bundle exec rails s -b 'ssl://0.0.0.0:3000?key=./config/certs/lvh.me.key&cert=./config/certs/lvh.me.crt'
  1. Access the page:
  
https://lvh.me:3000/
If you get following error message in the puma logs when accessing the page with Chrome:
  
SSL error, peer: 127.0.0.1, peer cert: , #<Puma::MiniSSL::SSLError: OpenSSL error: error:141F7065:SSL routines:final_key_share:no suitable key share - 337604709>
Make sure to use puma '>= 4'.

Useful commands when developing gems

Montag, 08. Juli 2019, 09:51 Uhr | roberto@vasquez-angel.de |

Yank specific gem version from rubygems in all subfolders:

for d in ./cmor_*/ ; do (cd "$d" && gem yank ${PWD##*/} -v 0.0.16.pre); done