Have you ever tried to draw a circle using code? If yes, you would have tumbled across the mid point algorithm, which defines how to determine the coordinates required to draw a circle.
I have the video explaining it here:
Or you can read through for the explanation.
To draw a circle, all you need is to draw one octant (one eighth) of the circle, because a circle is symmetrical across all axis and therefore, when you have one octant in place, you just need to mirror it in 8 ways to get the full…
Rubber Ducking or Dubber Duck debugging is the simple concept of explaining your code or your problem to a rubber duck.
Have you ever wanted to ask your question in Stack Overflow but didn’t need to post the question because you understood what is wrong while typing in the question? This is exactly what Rubber Ducking is. Well, not exactly, because you didn’t use a rubber duck, but you get the gist.
If you are stuck in a problem and cannot understand what the issue is, rubber ducking is one of the best ways to untangle yourself. The idea behind…
The main goal of your writing should be to share your knowledge. Think of all the times you’ve Googled something and it showed you the way to solve your problem in a matter of minutes. Your writing could be the key to solve someone else’s problems.
Digital footprint represents your online presence and in today’s world of technology, one’s digital footprint serves as an unofficial resume. It would tell the world about your knowledge and your interests, which often plays a major role in recruitment.
Information will stick in your mind more when you write it in your own words…
Everybody talks about the vague non technical skills a software engineer or a developer should have. Communication skills, attention to detail, creativity blah blah blah. Yes, they are important especially at the beginning of your career. But with time, you would realise that the following subjects too play a major role in your career even though you’re not prepared for them by your degree or course.
But fear not. Almost all the time, software developers are made to be passionate about learning new things, owing to the fact that the world of technology is constantly evolving. …
Today I will be talking about some tips and tricks to help you land your dream job as a software developer.
Obviously, you need to master at least one programming language. It is always best to look for job opportunities that match your proficiency. One thing to keep in mind is that the world of programming is constantly evolving and you need to keep up with it which is not very difficult thanks to the abundant resources that are available online.
Among all the topics involved with programming, data structures and algorithms are the most commonly sought…
verify is an impressive tool used in testing and there are various functionalities that would allow a developer to test method invocations.
verify(mockedObject, times(1)).someMethod(); would test if
someMethod() was called exactly 1 time.
verify(mockedObject, never()).someMethod(); would test if
someMethod() was never called.
InOrder inOrder = Mockito.inOrder(mockedObject); inOrder.verify(mockedObject).firstMethod(); inOrder.verify(mockedObject).secondMethod();
The above would verify that the
firstMethod() was called before the
verify(mockedObject, atLeast(2)).someMethod; would test if
someMethod() was called at least 2 times.
verify(mockedObject, atMost(5)).someMethod(); would test if
someMethod() was called not more than 5 times.
verifyNoMoreInteractions(mockedObject); can be used to test if none of the methods of
This post explains how to combine git commits by using git rebase and git squash.
Let’s assume that we have a couple of commits as follows that we wish to combine into one commit. You can use
git log --online to view a summary or shortened version of git log output.
Let’s assume that we have a couple of commits as follows. — oneline gives the short version of git log output. It will open up vim editor and you can type
:q to exit it without saving. …
Parameterized tests are extremely useful when you need to test a series of inputs against the same functionality. JUnit offers Parameterized class that facilitates this purpose.
As usual, let’s go through an example.
Assume you have a simple add method that takes 2 Integers and returns their sum. The Parameterized test for a such implementation would be:
The test class constructor takes 3 arguments, the first input number, the second input number and the expected output respectively.
The data() method returns an array of 5 of objects, each containing 3 Integers.
During runtime, AdderTest will be instantiated…