Skip to main content

Posts

Showing posts from July, 2018

Test Driven Development

What is TDD? If somebody asks me to explain TDD in few words, I say TDD is a development of tests before a feature implementation. You can argue that it’s hard to test things which are not existing yet. And Kent Beck will probably give you a slap for this. So how is it possible? It can be described by following steps:     1. You read and understand requirements for a particular feature.     2. You develop a set of tests which check the feature. All of the tests are red, due to absence of the feature implementation.     3. You develop the feature until all tests become green.     4. Refactor the code. TDD requires a different way of thinking, so in order to start TDD you need to forget the way you developed code before. This process is very hard. And it is even harder if you don’t know how to write unit tests. But it’s worth it. Developing with TDD has valuable advantages:     1. You have a better understanding of a f...

Binary vs. Source Packages

Regardless of the  package manager  you’re using, you have two ways of installing programs on Linux. You either use a pre-built package, or compile it yourself. These days, the former usually wins out by default. There are, however, times when you should consider the alternative. What Are Binary Packages? Installing programs on Linux is usually quite different to installing on Windows. Rather than get the installers off a vendor’s website, the files are retrieved from a repository of programs, usually  tailored  for your operating system. Files for separate programs are stored in an  archive format . This bundles everything into a single file for easy access later. For example, Debian uses the DEB format to store their programs. These bundles are called  binary packages . Installing requires a special program to extract these files and put them onto your computer. That is to say, your package manager (e.g. APT, Yum, and so on). It also doe...

Install Java using binary distributions in Ubuntu

   Why we should use Binary Installation without using apt in U buntu? The difference is that apt installs generic binaries and manages their versions. When compiling a source package you are entirely on your own because apt cannot manage the package. However, compiling a source package and installing it yourself is useful if you need features that can be had only by compiling the package yourself. Sometimes developers will provide features that can only be used in software if a certain compiler switch is used. And sometimes specific processors can perform better if certain compile flags are used.   However, in most cases the features that can be enabled are for debugging purp oses and will never be needed even by hard core users. And the binary version that apt is configured to use is already optimized for your processor. Possible situations where you would need to compile the source yourself would be: There's a version of the software available th...

Quick swap JDK versions (aliases) in Ubuntu

THE ALIAS COMMAND The alias command makes it possible to launch any command or group of commands (inclusive of any options, arguments and redirection) by entering a pre-set string (i.e., sequence of characters). CREATING ALIASES The general syntax for the alias command varies somewhat according to the shell. In the case of the bash shell it is alias [-p] [name="value"] Aliases can be created in the .bashrc file in Ubuntu home directory. But without manipulating the .bashrc , it is the best practice to create a new file . bash _aliases in the home directory. The .bashrc is a hidden file and if you don't see a file like this in home directory , press ctrl+h to unhide all the hidden files and folders. These are hidden because they are not to be edited . But in our case we need to edit these a little bit but carefully. After creating the .bash_aliases open the .bashrc file in the home directory and check if the bellow code snippet is in t...