All about final, finally and finalizer

final is a keyword used as an modifier for variable,class and method.

  1. final variable : Value of variable can not be modified.
  2. final method : Method cannot be overridden
  3. final class : Class cannot be extended.
finally



finalizer
Advertisements
Posted in java | Leave a comment

Numbers and Statics

Background :

Math class round method does the same thing it rounds the floating number to nearest integer. Only variance is an parameter of round method. So creating a 10 k instance of Math Class seems like a waste of good heap space. So Math class constructor is marked as private. These methods never use instance variable values.

The Keyword static lets a method run without any instance of the class.

# A static method means behavior not dependent on an instance variable.

# Abstract : Impossible to instantiate an abstract class

# Non -abstract class can be restricted from instantiating by marking a constructor  “private”.

# Static methods can’t use non-static methods or variables.

# Juz b/c it is legal doesn’t mean it is good :

             Duck d =new Duck()
            String[] s={};
            d.main(s);

# Static  Variable : 1 per Class
#Instance Variable : 1 per Instance
# Static variable value is the same for ALL instance of the class

Initializing a static variable :
# Static variable in a class are initialized before any object of that class can be created.
# Static variables in a class are initialized before any static method of the class runs.

class Alphabet{
static int abc =0;
}
Alphabet.abc;

Problem Statement : I want to write a class of which only one instance can be created.


Declaring but not initializing the static variable means static variable will get the default value for that variable type .ex int =0

Static final variables are constants 

public static final double PI   :Error no initialization.
public static final double PI=3.14;

non-static final variables

class Bob{

final int length=3;
final int breadth;

Bob(){
       breadth=5;  Error you can’t change breadth
}}


Why static method cannot access non static variables

public class StaticTest {

    private int count=0;
    public static void main(String args[]) throws IOException {
        count++; //compiler error: non-static variable count cannot be referenced from a static context
    }
 }


         

Posted in java | Leave a comment

Git Basic Commands

Here comes the basic git commands which i have been using in my day to day project :
1.Cloning the repo :Receives a version of every file for the history of the project data that the server has.  
git clone tlrepo@code.ttldev:TracsWebFunctionalTests 

2.Checkout :Checks out files, checks out commits, and checks out branches. git checkout git checkout mastergit checkout TravelEssentials.cs 

3. Status :What have you changed but not yet staged? And what have you staged that you are about to commit?
git status

4. Add To begin tracking new files, to stage files, and to resolve merge-conflicted files.
git add AddAnotherJourney.cs.

5.Diff :Exact lines added and removed
git diff (To see what is still unstaged)
git diff –staged  (To see what you’ve staged that will go into your next commit)


6. git clean
git clean –f (Removes untracked files)

7. To delete the last commit before push
git reset –soft HEAD~1 ( delete the commit but it will leave all your changed files) 

8.



/c/ttl/TracsWebFunctionalTests(4.15)
$ git commit
On branch 4.15
Your branch is up-to-date with ‘origin/4.15’.

Changes not staged for commit:
        modified:   TracsFunctionalTest/Tests/AmendJourney/AmendJourneyTest.cs

Untracked files:
        Class2.cs

no changes added to commit

/c/ttl/TracsWebFunctionalTests(4.15)
$ git clean
fatal: clean.requireForce defaults to true and neither -i, -n nor -f given; refused

/c/ttl/TracsWebFunctionalTests(4.15)
$ git clean-f
git: ‘clean-f’ is not a git command. See ‘git –help’.

/c/ttl/TracsWebFunctionalTests(4.15)
$ git clean –f
Removing Class2.cs

/c/ttl/TracsWebFunctionalTests(4.15)
$ git commit
On branch 4.15
Your branch is up-to-date with ‘origin/4.15’.

Changes not staged for commit:
        modified:   TracsFunctionalTest/Tests/AmendJourney/AmendJourneyTest.cs


9. git log
      git log -p –word–diff
      git log –stat

      git log –pretty=format:”%h – %an, %ar : %s”

Option Description
-p Show the patch introduced with each commit.
--word-diff Show the patch in a word diff format.
--stat Show statistics for files modified in each commit.
--shortstat Display only the changed/insertions/deletions line from the –stat command.
--name-only Show the list of files modified after the commit information.
--name-status Show the list of files affected with added/modified/deleted information as well.
--abbrev-commit Show only the first few characters of the SHA-1 checksum instead of all 40.
--relative-date Display the date in a relative format (for example, “2 weeks ago”) instead of using the full date format.
--graph Display an ASCII graph of the branch and merge history beside the log output.
--pretty Show commits in an alternate format. Options include oneline, short, full, fuller, and format (where you specify your own format).
--oneline A convenience option short for --pretty=oneline --abbrev-commit.





Posted in GIT, Learning | Leave a comment

()rigin of Tea : Why tea keeps you awake and fresh.

It’s a tea time… Evening tea over a weekend. $imple thought clicked ma mind what was the origin of tea?
There is an ancient story on how the tea leaves came into existence. 
One of the greatest Zen master Bodhidharma was teaching meditation to his disciples. 
Many Zen monks were just beginners and not fully centered into meditation and needed constant attention from the Master. 
Over a period of time, Bodhidharma observed that many beginners in meditation either fell asleep during meditation or they became zombie.
Seeing this hopeless progress of meditators, Bodhidharma plucked his eye-lids and threw them into the earth and 
after few days a beautiful plant grew out from the eye-lids of Bodhidharma. 
The leaves of this plant used to make tea. That is why tea keeps you awake and fresh.
Even today, the Japanese have a tea ceremony which is like a meditation practice as they prepare, 
serve and drink the tea very reverently, aesthetically and meditatively.
Posted in http://schemas.google.com/blogger/2008/kind#post | Leave a comment

|)on’t |et mind forget wat heart $ays

It was a little weird when this thought came to my mind. What do we mean by “Mind forgetting what the heart wanted”. How can someone let that happen?

I spoke to a few people, from an 18 year old who just started her career to a 59 year old who is all set to retire, about what is driving or drove them? The heart or the mind? 99% of them, apologetically, said that the mind did eventually take over the heart.

Let me give you a few examples of the mind taking over the heart:
A young and a very smart engineer settling for a small time software company than pursuing a PHD that she really wanted to do
A talented runner settling to be a small time office clerk, than being an internationally renowned runner

I was still not convinced. I spoke to and read about some of the greatest in the business. Entrepreneurs, industrialists, artists, sports person, and students.

There is one common thread to their success – Passion, an unwavering obsession to an idea or belief.

The passion comes from heart and provides the necessary fuel to drive the mind. It looked ridiculously simple to me until I spoke to a few others who were equally talented but could not make it to the list of successful individuals. As you can assume, the discussion was not easy. 90% of the people I spoke to acknowledged one simple fact that “growth killed them”. In other words, mind’s drive to grow sacrificing the basic purpose or passion.

Posted in life | Leave a comment

Birthday with all wishes on Call and SMS

This is the only birthday which i remember so far that the wishes were more from technology aspect whether mobile phones call or sms or chat on gtalk.
               A thought came to ma mind if no technology would have happened at this point and me myself staying alone in Bangalore would have not received a single wish or what … I am the person who always say technology takes you far from people in some aspect.  As child spending his leisure hours on playing video games or browsing Facebook. But now i realized technology make people connected too.
                       I was rilli very happy to receive all the wishes but some how i missed the hug and tilak which my mom always put on my birthday. I felt someone should be here who can not only wish me online. Need a offline wishes. I missed dad asking me what you want on this birthday. Am too old  to receive a gift or i missed something in my day to day life.
                              Am missing the joy of my childhood dat’s true….
Posted in Uncategorized | Tagged | 1 Comment

10 principles that will be helpful for agile testers:

Provide continuous feedback – In any agile team feedback plays a central role: The most concrete way to measure the positive progress on an agile project is the acceptance criteria. With meaningful feedback, tests also help in identifying issues & capturing decisions on appropriate future direction.

Deliver value to the customer – based on the customer needs agile testing is done. The acceptance tests are performed as a “reality check” for the scope of the project. These tests also help us, in understanding what exactly it means to realize a customer needs.

Enable face-to-face communication – Communication plays a very important role. Without proper communication no team can work well. Most often testers will be the one who bridge the gap between programmers & customers like BAs, product owners etc. The tester is the only person who can bring these people together. He is also the one who derives a common language between the two parties.

Have courage – It is a core value in XP (Extreme Programming) and one of the larger challenges of agile is sustaining in a fast paced iterative environment, where every two weeks the quality software has to be shipped. For this challenge one has to have lots of courage. We need to understand those iterations which afford opportunities to learn how to fail & adapt.

Keep it simple – Ensuring that software meets the customer requirements by using simpler approaches. Agile testers might need to push back to the business side of the team against an insistence – overly elaborate features. Testers’ team can help the customers understand how to deliver value incrementally. Testers must also learn an appropriate balance of iterative testing–just enough to provide the right confidence in delivering software.

Practice continuous improvement – Using iterations as a key element is done to allow learning to take place. Testers should partake in retrospectives. Testers should always learn continually more about testing practices, tools, and the system itself in order to treat their career as a profession.

Respond to change – Agile testing must be continually re-tested as it’s dramatically different in that there are some “cutoff points”; in which things keep changing & also requires automation. Customers keep changing their minds from iteration to iteration where the agile tester learns to cope with their changes & correspondingly learns how to incrementally flesh out necessary testing specifications.

Self organize – Agile teams have the capability to act as a tester & know how to shift the focus as needed from time to time.

For example: It may be prudent for programmers to turn their attention toward helping verify a “done” but not “done done” feature.

Focus on people – In non-agile software development teams, testers are often at the bottom of the totem pole. Work always thrown at them & their available piece of time is continually squished & also programmers often look upon them as lesser. Everyone in agile team shares the responsibility for ensuring that they are building quality products and key in bringing their testing expertise to the team.

Enjoy – For agile tester, the ability to help drive the process and be a true, equal contributor to a team can be extremely gratifying.

Posted in Uncategorized | Leave a comment