Well something I did Today(Right, Wrong)

Yea it’s Saturday morning, woke up and checked phone, well there was no message from her side, felt a bit sad !! as I really wanna me to be remembered by her, Well met her actually to be specific started talking with her couple of days before, and it was quite fast, it started to become a routine for me, It was good talking with her, right in the morning on the way to office and also at night for an hour, It was really good even though there was nothing great there, most of the time I used to ask “what-else what else” well, something or the other we talked for some days , actually I started loving the way she speaks :) Especially some phrases , t’was really good and I wanna hear that more and more. Though each time I used to instantiate the conversation she never hesitated to talk with me, actually she permitted me to call me, when ever I feel like talking, well past few days, I really smiled even at the hectic conditions. At work am really alone, but the talks with her really made me feel good, and it was like slowly getting into me,really from the bottom of the heart, I allowed /I actually loved it. Well even though , I love to walk alone, stay alone, eat alone, sleep alone, this is what am doing right now, but when I see a pair, ya group I really wish If some one was there for me to share and have some quality time. I wished that, if she was there, then it would’ve been more good.  So I wished to tell her my feelings for her, actually I really wanna be straight  and I don’t wanna play a fake wall of a friendship and turning one day to her and ask her that will you be with me until my last breath?No I really don’t wanna do that, I just wanna convey I had  a wish , so if the constraints allow, we both can move forward !! I really wish to know her, May be I was so quick, and I couldn’t handle this distraction, I  finalized and I asked her whether I can walk along with her throughout my life. I don’t know, I may had sounded like, some usual kiddos ask for usual kiddish love stuffs, but it was a real invitation which I initiated for the first time in my life, to proceed it with real world formalities. Ah Alas as always bad lucks do love me and wanna hurt me harder, as usual it happened today morning , the response came, “I am sorry”.  Well I still don’t understand what was that “sorry for” ! Well I couldn’t ask that back too, what was that sorry for!!
Well I just want to convey my real feelings frankly and openly with her, and its her freedom as her response, can’t blame no one,  Now I really feel a pain inside now!! and even though her responses was good, I don’t  know what again am gonna speak with her! I don’t know what I did was Right or Wrong, and I never wanted to hurt her even with my looks or words!!

Springing :D => Something About Dependency Injection

I just got an understanding of what is dependency injection!! I was hearing Dependency Injection from my colleagues and all, and I was stumbled!! what actually it is?   Well now I say that’s a real piece of cake !!!.

The phrase “Dependency Injection” may sound intimidating. But as when we look closer we will realize that it’s not complex as it sounds .And by applying these DesignPattern(DependencyInjection is_a DesignPattern). to your code, then it become significantly easier to understand and easier to extent and test. Am quoting an example from a text  here through which one can easily understand what actually it is.

Consider a Knight class.


  1. package com.springaction.knights;
  2.  public class DamselRescuingKnight implements Knight {
  3.               private RescueDamselQuest quest;
  4.  public DamselRescuingKnight() {
  5.         quest = new RescueDamselQuest();
  6.    }
  7.  public void embarkOnQuest() throws QuestException {
  8.        quest.embark();
  9.    }
  10. }

In the above snippet you can see DamselResuceKnight creates it’s on quest , a RescueDamselQuest(), within the constructor (LOC – 4&5).This actually makes a DamselRescuingKnight tightly coupled to a RescueDamselQuest() and it severly limits the knight’s quest-embarking repertoire. Actually it can rescue a Damsel yea it is supposed to that, but what else it can do? Nothing but simply sit.

And also when you get familiar with testing, you will find it difficult to test such a piece of code.(unitTests). In writing test, the scenario here is you got to assert that quest’s embark(); method is called when the knight’s embarkOnQuest() is called, the code is supposed to do so, But there is no clear way to test that here, so the DamselRescuingKnight will remain untested.

Here comes the Dependency Injection(DI). With DI, objects are given their dependencies at creation time by some third party that coordinates each object in the system. Objects aren’t expected to create or obtain their dependencies – dependencies are injected into the objects that need them.

Illustrating DI with the below code snippet


Consider a class BraveKnight and see that BraveKnight is ready and flexible enough to take any Quest!!

  1. package com.springaction.knights;
  2. public class BraveKnight implements Knight {
  3.    private Quest quest;
  4. public BraveKnight (Quest quest) {
  5.    this.quest = quest;  <————-    //Here the quest is being injected
  6.  }
  7. public void embarkOnQuest() throws QuestException {
  8.   quest.embark();
  9.  }
  10. }

As in the above snippet unlike DamselRescueKnight, BraveKnight doesn’t create his own quest. Instead he is given a quest at the construction time as a constructor argument.This is a type of DI and is known as Constructor Injection.

The quest he’s give as type Quest, is an interface that all quests implement. So the BraveKnight  could embark on a RescueDamselQuest, a SlyDragonQuest , or any other Quest implementation he is given. The point here is that BraveKnight isn’t coupled to any specific implementation of Quest.It doesn’t matter to him what kind of quest he is asked to embark upon.

Something About Hibernate

Hibernate is an Object Relational Mapping solution for Java, and it’s an open-source persistent framework.

It is a powerful, High Performance, Object Relational Persistence Query Service for any Java Application.

How Hibernate Functions:-

  • Hibernate maps Java Classes to Database Types and Java Data types to SQL data types, and thus it makes the life of a programmer easier.
  • Hibernate make use of XML configurations for mapping Java Classes to  database Objects.
  • Provides simple API for accessing Java Objects to and from the database.
  • Changes in the database can be reflected by changing the XML configuration file.
  • It Abstracts the SQL queries & helps us working with Java Objects.
  • It doesn’t require an application server to work.
  •  Can manage complex associations through Objects.
  • Ease in Data Retrieval
  • And It supports almost all RDBMS.
  • It uses existing Java API’s like JDBC ,JNDI, Java TransactionAPI. JDBC provides a rudimentary level of abstraction,and also it allows any database with a JDBC driver can be integrated with Hibernate.
  • JNDI and Java Transaction API (JTI) helps Hibernate to get integrated with J2EE application servers.

———————————————————————————————

Hibernate sits between Traditional Java objects and database server to handle all the work in persisting objects based on appropriate Object-Relational mechanisms and patterns.

A High Level Hibernate Architecture

 hibernate_high_level

Objects which gave birth in an Hibernate Application

  • Configuration Object
  • Session Factory Object
  • Session Object
  • Transaction Object
  • Query Object
  • Criteria Object

===============================================================================

  • Configuration Object

It’ the first ever object that get created in an Hibernate Application, and it’s created automatically during application initialization process. The two key components of Configuration Objects are :

  1. Database Connection => which is handled by hibernate.properties and hibernate.cfg.xml.
  2. Class Mapping Setup => This helps in creating in connection with Java Classes and DB tables.
  •  Session Factory Object

The above mentioned Configuration Object is used to create Session Factory Object which inturn configures Hibernate for the application with the supplied configuration file => which instantiates a Session Object. Session Factory Object is created during application startup.We will need one SessionFactory Object per Database and vice versa.

  • Session Object

The basic purpose of this object is to get a physical connection with the database & this object will be instantiated each time when database interaction occurs. They are not thread safe( should be destroyed/created as needed).

  • Transaction Object

This is an optional object , and Hibernate applications may choose not to use this interface.

  •   Query Object

Query Objects use SQL or Hibernate Query Language string to retrieve data from the database and create objects.

  • Criteria Object

These objects are used to create and execute object oriented criteria queries to retrieve objects.


I am still at the beginning level of Computer Science!!

And really feeling bad!! as I prepare for the Hacker Earth challenge and suddenly realizing that you are nothing !! As I fail in solving 90% of the problems I tried. With a dream to end, at least in #ThoughtWorks , and reading the book of GayleLaakman, am feeling really disappointed!! Well, its  somewhat late, now I am going to restart!! As now I fixed a target and to demolish each one as the array looks like

[c++, Algorithms, Design Patterns, CCI,].

 

And this time ,I feels much better!! and Determined, and I can now blame the ecosystem I was brought up, as a computer science student, I never learned these stuffs deeply. Well it was my responsibility to search for that path, and I didn’t and later realizing this path is the ideal one for a computer science student, Now I can see many languages becoming popular day by day, like Ruby, Python, R, GO  etc, –> This is going to be a piece of advise for the upcoming folks, complete traversing my array first and Jump to the below “Ruby Python etc…..”. As I understood, everything lies there, the rest is pretty simple and you can pick up on the way.

Well it always better to be late than never, and let me begin my traversing!! with a dream to step at amazon, google, facebook, etc…

A new experience || blogging from BlackBerry

Well just trying to write some craps!! Or in other words am simply testing the BlackBerry WordPress App! It’s really good and fast too!! UI is designed in a pretty awesome way! I found at certain options app getting a bit laggy, but in short this is a great piece of work!

image

A screen shot to show how the interface is, well for me this app is really a piece of cake ;)

That’s distracting

Today happened to see!! “the facebook profile again” its all because of the recommendation engine by #Facebook!! huh facebook knows whom I wanna see, but I shouldn’t have looked,as its really making me frustrated and more sad! and I remember that slight mistake from my part if needed can be forgiven, but now it had taken this form and it’s like this in present.I forgot about many other things to worry ;) so right now am leaving this, and I believe something good will happen!! No matter what ever be the situation I will always stand with truth and I will be truthful.and it’s like now its more than 3 or 4 years my struggle with life continues, still the hope that I can bring it, I can make it, is driving me forward, and at some instant I feel am loosing, simultaneously these kind off pop ups also adding a bit to sufferings. well still am keeping my heads up, even if inside is burning!!! Trying to be focused, learning to intake, and learning to let go!!