Our Approach to Code Quality in Scala

Knoldus

Code Quality. This term has become quite a rage in the industry with more and more companies devoting more time (and money) to give a better code quality to their clients.

But why ?  Following are some of the reasons

1) Ensures an easy to read code. Yes it does that. And hence the reader does not need to pull his/her hair out(quiet literally) to understand the code.

2) Makes the code maintenance an easy task.

3) Quality code is easy to reuse.

4) Testability. A well tested code does save from sins of omission and commissions and hence ensuring you have everything that is needed.

We at Knoldus pay a lot of attention to the quality of code that we write for various projects that we have. Providing good code quality to our clients is one of our primary promise.

And that we deliver !

For one of our…

View original post 294 more words

Advertisements

Time Travel in Scala: CPS in Scala (scala’s continuation).

Knoldus

Sometime before I was just roaming around in the landOfLisp  and I came across different spaceships of different guilds of Functional Programming that are going to save the earth from the unholy creatures: Bugs ! That degrade our software quality.

I was trying to map everything to Scala as it can also be written in a functional way. Then I came across a guild name Continuation. I was quite fascinated with this because it allowed us to travel time in our code.

So basically , continuations is a way to put “time travel” into our code.

In a more technical way ,

A continuation is an abstract representation of the control state of a computer program. So what it actually means is that it is a data structure that represents the computational process at a given point in the process’s execution; the created data structure can be…

View original post 530 more words

Couchbase : How to access and change the document of size more than 2.5Kb.

Knoldus

We faced a situation were we have to firstly see the data and then change it accordingly in couchbase, but the GUI of couchbase doesn’t allows us to see the data of size more than 2.5kb and forget about changing,


Screenshot from 2015-08-07 12:36:16

So there is a quick hack of how you can actually change the data without using the GUI and just by making a curl request:

If you want to see the data :

Just make this CURL request

Example:

And you’ll get a response like this :

And inside the field json you’ get your required Json,

You can easily do this just by seeing developer console.. 😉

Now the big task i.e. If you want to change the data

So for that firstly retrieve the data from above request make changes, and then make a POST request to the same url with the new Json. It will get updated.

View original post 9 more words

Couchbase : Making views via script file automatially without using GUI.

Knoldus

The problem that we faced is that we have to make views manually from the GUI of the couchbase, but it was quite a cumbersome task, so this blog is about how to make views automatically.

In this blog we’ll learn how to create a script of curl commands and just run that script for making views and the  views  will automatically get created on the couchbase server.

You do not have to make views manually now, just run a script file and it automatically gets created , so that you don’t have to make views manually on staging server and it can easily be made just by running a simple script file.

For creating a design document and views from a script file :

Firstly , you have to make a .ddoc file, the name of file should be same as that of the design document that you want…

View original post 218 more words

Creating a DSL (Domain Specific Language) using ANTLR ( Part-II) : Writing the Grammar file.

Knoldus

Earlier we discussed in our blog how to configure the ANTLR plugin for the intellij for getting started with our language.

In this post we will discuss the basics of the ANTLR  and exactly how can we get started with our main goal. What is the lexer, parser and what are their roles and many other things. So lets get started,

Antlr stands for ANother Tool for Language Recognition. The tool is able to generate compiler or interpreter for any computer language. If you need to parse languages like Java , scala, php then this is the thing that you are looking for.
Here is the list of some projects that uses ANTLR.

View original post 611 more words