Few line for Developer’s; Must Read !!!

We are the developer who working today with different technology. Every day handling different situation; and also getting different problem where we might think that we are getting stuck after doing many search over internet; now it’s time to take help for some one else.
Is not it ??
Yes; so what we do is ask some one other developer or any of our friends Right ?
Yes;
But, still we are not finding any solution then ???
If you ask me then I have answer.
My answer is visiting any technical Forum and asks the same question there.
Who are new to .Net technology might be do not know about what is forum ??

and how it is working ?
Let me tell you;

Today we have lots of technical forum to ask the question; if you are working on .Net technology then we have specific forum for each technology. Today’s many developer are actively answering the question and what I saw one of the best technical forum for web development is Asp.net forum.
Apart from that another best one for any Microsoft technology related query is MSDN.Com.
You can ask any question/doubts there.
Don’t think that you can get answer immediately ; yes you can get the answer immediately if and only if you ask the question in appropriate manner.

So what I mean by appropriate manner?

    • Your question not so much lengthy explanation with unnecessary things; so make as much as smaller and keep it as simple.
    • Post your code if you think explanation required code stuff to understand.
    • Always choose the appropriate categories while posting the question that is most important.

So don’t be hesitated to asking your question; it’s not like that you can get your response quickly; but remember you definitely get the answer as depends upon how you explain the question. What I saw in my case maximum within four to five hour I get the response. So keep penance!!!
I am not saying that you can improve your way of asking question in one day but if you do it regularly then definitely I say you can improve a lot and you get quick response from other developers.
If you are asking question in Asp.net forum and MSDN forum then I definitely sure that you can get response to your question; in rare case you can not get; but most probably all the question get solved very quickly.

How it’s working ?
Many of us actually don’t know how the forum works; it’s not like that you are only asking question and getting response; behind the seance there are lots of stuff happen;
Basically if you are asking question in any Microsoft forum then Microsoft has it’s own moderator (moderator are the developer who have lots of experience and actively working with community and also their are various Microsoft Most Valuable Professional  (MVP))who are going to check your question whether your question related to Microsoft technology or not and also they check on which categories you are asking question. If they found any point of time your question is invalid then they can immediately remove it from forum and they send you a private message about this.
So keep in Mind this while posting question!!!
Many developer today actively contributing their valuable response in MSDN forum.
Which makes you guarantee that you get your response quickly.

If you see that many days happen you are not getting any response of your question or valid answer of your question then the best way is just open another thread and ask same question in different manner.

Last one for all; Use forum also answer the question as well; not only ask the question. So do regular visit to forum and try to read the question as you can; and on the way of reading one by one question when you feel that you can answer it just answer it by click on reply.
If you do so you are now actively work with community on a bidirectional manner.

Last but Not the List:-
We all asking the question but it’s important to keep in mind that once your question get resolved make the question mark as answer so it’s helps the community to recognize that what are the question resolved till the date. A part from that if you mark as answer then it means that you are actively engaged with that thread.

If you are belong to .Net Techies then;
Some of the best forum where you get directly in by just simple sign in:-
1) All in One as I told above i.e. is MSDN Forum
2) If specific to web technology then Asp.net Forum
3) C# Corner Forum
4) CodeProject Forum

So what we see form above that we are not alone today we have whole community with us.
If we are working on .Net technology then we have many more developer from across the country whom we can get collaborate by asking the question and get the response.
Keep asking and visiting forum.
That’s all;
Hope above information help you.
You can find my thread on MSDN forum Here

Please give me your valuable feedback and tell me if any thing i left here.

Thanks.

Happy Coading. 🙂

Patterns in Java Script

Introduction :-

In Java script we have different  types of pattern to write our code.  We all web developer write many java script code every day and we do not know how much clean and safety our code. So today in this article I am going to tell you about basic JS Patterns which helps to write an effective java script code; and we also going to see many OOPs concept while we go through the different patterns.

Background :-

Let’s starts a deep drive in to Java script patterns;

We have three types of pattern in JavaScript these are :-

  1. Function as Abstraction Pattern.(Abstraction in Java script)
  2. Function to Build Module Pattern. (Encapsulation in Java script)
  3. Function to avoid Global variable Pattern. (Anonymous function in Java script)

Let’s see one by one with live examples;

  1. Function as Abstraction Pattern:-

If you are coming from C# language or any object oriented programming language background then we probably all know about abstraction.

Let me once again quick remind!!!

Abstraction :-  Hidings the details and providing only what is necessary.

To understand above let’s jumps to our demo;

Note :- Here I am not going to create any project in visual studio. You can use any editor to write this simple java script function or else you directly open you browser window and open the console window in browser by pressing F12 then press CTL+L in Chrome and CTL+Shift+L in Firefox to clear the console window and pest these bellow code.

Abstraction Partern Demo :-



//Function as abstraction

var Do=function(){

console.log("Do is Called !!!");

}

var DoSomething=function(f){

console.log("Before Do function executed !!!");

try{

f();

}

catch(ex){

console.log(ex)

}

console.log("After Do function executed !!!");

}

DoSomething (Do);

//End of Abstraction


Explanation :- In the above program we have declare two variable called as Do and DoSomething .Using this two variable I declare two functions.

So, What I am doing here is hiding the details of Do Function inside DoSomething Function. While calling I am only call DoSomething function which automatically get executed Do function.

Now what is it’s advantage ?

Advantage of this pattern is if you want to execute some block of code before and after the specific JavaScript function executed then it’s much helpful.

  1. Function to Build Module Pattern:-

In this pattern we are going to understand how we do encapsulation in JavaScript while write function in JavaScript.

Note :- It’s very useful pattern while doing JavaScript program, I recommended use this pattern while writing JavaScript code.

Let’s Jump in to Demo;

//Function to Build Module
var Do= function() {  //This is Global variable

var Job1 = function() {  //This is Local varibale.

console.log("Job1 is Called !!");

};

var Job2= function() {

console.log("Job2 is called !!");

};

return {

process1:Job1,

process2: Job2

};

};

var objDo= new Do();

objDo.process1();

objDo.process2();

//End Build Module

Explanation :-

In the above program I have declare a function using Do variable. Inside this function I have again declare another two function using local variable called as Job1 and Job2. Here I declare two function you can declare as many number as your requirement.

Hence this Job1 and Job2 are local under this Do function; so we cannot access this function outside of  Do function. Job1 and Job2 are only accessible inside the Do function only. Here Do is encapsulated both Job1 and Job2 function.

Remind Oops what saying about encapsulation ??

Hence here we achieve encapsulation as well.

Well; here it’s important to understand that how I am calling Job1 and Job2.

See above what I am doing is that I am returning job1 and Job2 function from Do function.

Always remember every function in Javascript always return some value by default.

To call the function we need to create an object of Do function and using this object I can call all the function define under Do.

Let’s discuss what is the advantages of this pattern?

  • Providing security over our code.
  • More clean code.
  • Avoid duplicate code and write the code specific to our page/view.

Based on my experience:-

Last point which I say above is “Avoid duplicate code and write the code specific to our page”; this is really useful if you are working as a web developer then you might understand this point very clearly.

In my working life what I see is that many programmer write the function but while giving name we are not sure that whether the name is used by someone else or not ??So while calling it’s get confuse that why our function not get executed rather executing someone else function; that due to same name of function.

So if we follow this above pattern we never ever face this problem.

 Hence I always recommended to all of you please follow this pattern.

  1. Function to avoid Global variable.

In this pattern we are going to see how to write a Global function also we see Immediately Invoked Function (IIF).

Let’s see this in demo;


var DoMain = function() {  //This is Global variable.

var Do= function() {

var Job1= function() {  //This is Local varibale.

console.log("Job1 is Called");

};

var Job2= function() {

console.log("Job2 is called");

};

return {

Process1:Job1,

Process2: Job2

};

};

var objDo= new Do();

objDo.Process1 ();

objDo.Process2 ();

}

DoMain();

Explanation :-

If we analysis from first pattern program to this program then what I did in this is I write all the code inside one global variable called as DOMain and making it as a function.

So it’s easy to understand that I am just calling the DoMain() function and we get the same output as previous program.

So what you think nothing is new here right??

Yes….no…  🙂

Let see the new thing bellow :-

//Anonymous function or IIF function

(function(){

var DoMain= function() {  //This is Global variable.

var Do= function() {

var Job1= function() {  //This is Local varibale.

console.log("Job1 is Called");

};

var Job2= function() {

console.log("Job2 is called");

};

return {

Process1:Job1,

Process2: Job2

};

};

var objDo= new Do();

objDo.Process1 ();

objDo.Process2 ();

}

DoMain();

}()); 

Explanation :-

If we analysis above example then we see that there is no variable I deified to store the function; rather I define a self-function which is similar to the anonymous function in C# language.

This type of Function basically called as Immediately invoked function (IIF) in Java script.

So while we writing this type of function then that function get executed immediately after DOM element loaded.

Note :- Basically this type of pattern used in case of developing plug in. We also see many plugin has this type pattern, if you see jquery.flowchart.Js plugin then you can get a clear picture that whole plugin developed using this pattern only.

Conclusion:-

So this all about our java script patterns and their purpose of uses.

Hope this is help full to you understanding all these patterns with simple example.

Above explanation based on my own experience and learning; so if you found anything mistake in that or any example not work then feel free to give you feedback.

Please say about what you feel about this article; which helps me to improve myself.

Thanks all.

Happy Coading.

🙂

X#(X-Sharp) another member in .Net Family.

X# is another programming language introduced by Microsoft. It’s now become another member of  .Net family like C# and F#.

Microsoft Core development team has developed this New language which run’s under dot net platform.

X# will going to lunch with new Upcoming Visual studio 2017. Visual studio 2017 going to be lunch on 7th march 2017.

For know more about VS2017RC; attend live lunch event of VS2017.

X# language has lots of new feature with the enhancement of .Net platform.

In this You will get new run time environment with some more advance features.

For know more about in details follow bellow link :-

X-Sharp Road Map.

Read More Details about X-Sharp.

Thanks for Reading.

Share your valuable comments.

To stay updated with new Technology follow me.

Powered by : #Share2Know #SuryanInfo 🙂

Reason behind Array Index starts from Zero (0)

The main objective of writing this blog is that many of us always confuse that why the array index starts from Zero(0); so in this blog I am going to tell you the main reason behind this.

I assume that you have an basic idea about what is an array, basically an array is a collection which store  homogenous type of data.

In the array if we want to access any element then we can use the array index to access an element. So when we are accessing the first element of an array then we can use index as 0 (arr[0]).

Why so ?

To understand this we need to understand how actually JIT compiler looks up an array index inside memory.

Let’s have look on bellow image:-

First Element  }-x byte
Second Element }-x byte
Third Element }-x byte
Fourth Element } -x byte
Fifth Element } -x byte

In the above figure we saw that each element occupies ‘x’ byte in the memory and the starting address of the memory location is ‘S’.

So from above we clear that the first element address will be ‘S’.

If we want to find the next element address of an array then we required to add the no of byte occupied by first element(X) to the starting address(S).

Hence in the above figure each element consumes X byte and the starting address is S so the next address will be ‘S’+ X.

Like wise third element will be at ‘S’+2*X  and so on.

Hence if we find out nth element address then the formula is derived from above is :-

Nth Element (n) :-

Address= S+(n-1)*X

Where “n-1”indicate the index of an array.

When I say I want to access the first element inside an array (i.e arr[0]) then the location of memory can be find out by;

S+(n-1)*X

Where n=1 (First element we are accessing).

Then the first element memory location is S+(1-1)*X   

                                                                          =>S+0*X=S

By using formula also we got the first element address will be S.

As I said above n-1 is our index which means the first index of an array always starts from 0.

The above formula can also be written as;

If we want to access i+1 th element where i  is the index of an array then;

Address=S+i*X  [Here i replace n-1]

If i=0 then Address is S+0*X=S

So here it’s clear that while accessing first element the index become 0 and due to it’s 0 we are getting the starting address for our first element of an array. That’s why array index always starts from 0.

Hope above explanation clear.

Any doubt or any feedback regarding this blog please post it inside comment box.

#Like#Comment#Feedback

 

C# History.

C# language comes in to the picture nearly 15 years back; and today this language is treated as one of the best programming language in developing world.Today this language is more enhanced and more feature support . It’s one of the core language of the .Net framework to develop any kind of application. We all using this still long back but we are not aware about who is the father of this language and how this language developed. So in this bellow you find history of C# language.

During the development of the .NET Framework, the class libraries were originally written using a managed code compiler system called Simple Managed C (SMC).[14][15] In January 1999, Anders Hejlsberg formed a team to build a new language at the time called Cool, which stood for “C-like Object Oriented Language”.[16] Microsoft had considered keeping the name “Cool” as the final name of the language, but chose not to do so for trademark reasons. By the time the .NET project was publicly announced at the July 2000 Professional Developers Conference, the language had been renamed C#, and the class libraries and ASP.NET runtime had been ported to C#.

You can read more about this here.

Reference :- C# History Wiki

Happy Coding.

#Share2Know&Feedback