Wednesday, December 3, 2014

Inteview vs work

Work

  1. Heavy use of DateTime, IO/Network streams
  2. Custom exceptions




Interview:

  1. Not much try catch blocks

Sunday, November 16, 2014

c# short book

  • Object initializer:
In general, it's considered good practice to have a constructor require the parameters needed in order to completely setup an object, so that it's impossible to create an object in an invalid state.
An Object Initializer lets you set properties or fields on your object afterit's been constructed, but before you can use it by anything else. For example:
MyObject myObjectInstance = new MyObject(param1, param2)
{
    MyProperty = someUsefulValue
};
  • Partial classes:
Partial classes can be very handy for implementing interfaces in C#, and keeping the interface members clearly separate from the class-members:
    Separating large class into smaller partial classes with clear separation of functionalists.
    
    

    Tuesday, October 28, 2014

    Senior Software Engineer


    1. Git
    2. design patterns
    3. Test driven development
    4. Concurrent programming
    5. Understanding of the web technologies HTTP, JavaScript, AJAX, HTML, DHTML, CS


    Autodesk
    Apple
    NetFilx
    Amazon
    Expedia

    experiment:
    box
    ServiceNow

    Saturday, October 25, 2014

    Cloud Computing

    Cloud computing encompasses any subscription-based or pay-per-use service that, in real time over the Internet, extends IT's existing capabilities.

    Cloud computing comes into focus only when you think about what IT always needs: a way to increase capacity or add capabilities on the fly without investing in new infrastructure, training new personnel, or licensing new software

    1. SaaS
    delivers a single application through the browser to thousands of customers using a multitenant architecture. On the customer side, it means no upfront investment in servers or software licensing; on the provider side, with just one app to maintain, costs are low compared to conventional hosting. 
    Eg: Salesforce

    2. PaaS
    this form of cloud computing delivers development environments as a service. You build your own applications that run on the provider's infrastructure and are delivered to your users via the Internet from the provider's servers.
    Eg: Azure

    3. IaaS
    Infrastructure as a Service is a provision model in which an organization outsources the equipment used to support operations, including storage, hardware, servers and networking components. The service provider owns the equipment and is responsible for housing, running and maintaining it. The client typically pays on a per-use basis
    Eg: Azure

     Web services in the cloud:Closely related to SaaS, Web service providers offer APIs that enable developers to exploit functionality over the Internet, 
    eg: APIs offered by Google Maps, ADP payroll processing, the U.S. Postal Service, Bloomberg, and even conventional credit card processing services.

    Thursday, October 16, 2014

    Testing types


    1. Performance testing
    2. Stress Testing
    3. Localization testing
    4. Compatibility testing
    5. UI Testing
    6. Security testing
    7. Functionality testing

    Wednesday, October 15, 2014

    OO Principles



    1. Accessor: is a method that is used to ask an object about itself. ( propery get)
    2. Mutator: public method used to modify the state of an object.(property set)
    3. Encapsulation: hiding data implementation by restricting access to accessors and mutators
    4. Abstraction: 
    5. inheritance: is a relationship
    6. polymorphism:  one name many forms.

    Interface vs abstract class


    Abstract classes are meant to be inherited from, and when one class inherits from another it means that there is a strong relationship between the 2 classes.Abstract class may provide some default implementation code.

    With an interface on the other hand, the relationship between the interface itself and the class implementing the interface is not necessarily strong

    abstract class would be more appropriate when there is a strong relationship between the abstract class and the classes that will derive from it. This is because an abstract class is very closely linked to inheritance, which implies a strong relationship.
    But, with interfaces there need not be a strong relationship between the interface and the classes that implement the interface.

    When to use abstract class and interface in Java?
    Here are some guidelines on when to use an abstract class and when to use interfaces in Java:
    1. An abstract class is good if you think you will plan on using inheritance since it provides a common base class implementation to derived classes.
    2. An abstract class is also good if you want to be able to declare non-public members. In an interface, all methods must be public.
    3. If you think you will need to add methods in the future, then an abstract class is a better choice. Because if you add new method headings to an interface, then all of the classes that already implement that interface will have to be changed to implement the new methods. That can be quite a hassle.
    4. Interfaces are a good choice when you think that the API will not change for a while.
    5. Interfaces are also good when you want to have something similar to multiple inheritance, since you can implement multiple interfaces.

    Thursday, October 9, 2014

    Agile

    1. Individuals and interactions over processes and tools 
    2. Working software over comprehensive documentation 
    3. Customer collaboration over contract negotiation 
    4. Responding to change over following a plan 
    scrum: set of sprints.
    Lean practices:  Eliminate waste.
    focus more on next than later
    focus more on what is rather than what should be

    Agile Thinking:
    Speed and flexibility
    A way of being best you can while managing change in a transparent cooperative manner.
    Scrum:
    ·         A product owner creates a prioritized wish list called a product backlog.
    ·         During sprint planning, the team pulls a small chunk from the top of that wish list, a sprint backlog, and decides how to implement those pieces.
    ·         The team has a certain amount of time — a sprint (usually two to four weeks) — to complete its work, but it meets each day to assess its progress (daily Scrum).
    ·         Along the way, the ScrumMaster keeps the team focused on its goal.
    ·         At the end of the sprint, the work should be potentially shippable: ready to hand to a customer, put on a store shelf, or show to a stakeholder.
    ·         The sprint ends with a sprint review and retrospective.
    ·         As the next sprint begins, the team chooses another chunk of the product backlog and begins working again.

    Wednesday, September 17, 2014

    Design Patterns

    General reusable solutions to common problems in software design.
    Creational:  Create objects while hiding the creation logic, rather than instantiate objects directly using new operator
    Structural: are concerned with how classes and objects are composed to form larger structures. This is all bout class and object composiiton.
    Behavioral: interaction/communication between objects.
    • Creational
      1. Singleton:  This pattern ensures that a class has only one instance. 
      2. Factory Method: In Factory pattern, we create object without exposing the creation logic
      3. Abstract Factory patterns acts a super-factory which creates other factories. This pattern is also called as Factory of factories. In Abstract Factory pattern an interface is responsible for creating a set of related objects, or dependent objects without specifying their concrete classes.
      4. Builder pattern builds a complex object by using a step by step approach. Builder interface defines the steps to build the final object. This builder is independent from the objects creation process. A class that is known as Director, controls the object creation process.
        Moreover, builder pattern describes a way to separate an object from its construction. The same construction method can create different representation of the object.
      5. Prototype pattern is used to create a duplicate object or clone of the current object to enhance performance. This pattern is used when creation of object is costly or complex.
    • Structural
      1. Adapter :  convert the interface of a class into another interface client expect Related patterns:  Repository, Strategy, Facade,  Adapter pattern:  convert the interface of a class into another interface client expect
      2. Bridge:
      3.  Adapter starts from letter 'A' - map with After and Bridge starts from letter 'B' map with Before. 
      4.  Now when its Adapter its always to deal with the situation when some implementation is already in place and but some kind of hack 
      5. or patch or connector to put in place to make it work, like the real (electric) adapter.
      6.   Where in bridge - its before hand - design should be such that interface and implementation both are independent 
      7.  so abstraction is covered at interface level but actual implementation differs based on condition or need.
    • Behavioral
    1. TemplateMethod:  Define the skeleton of an algorithm in an operation, deferring some steps toSubclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the Algorithm's Structure. 
    2. Strategy:There are common situations when classes differ only in their behavior. For this cases is a good idea to isolate the algorithms in separate classes in order to have the ability to select different algorithms at runtime. 
    3. Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

    Monday, September 15, 2014

    Sunday, September 14, 2014

    Complete Programming Language

    1. Core language -  variables, functions, loops
    2. Generics,Data structures and Collections.
    2. Threading
    3. Network reading and writing
    4. Disk IO

    Generics types allow code reuse with type safety
    List, Queue, Stack, Hashset, SortedSet LinkedList, Dictionary, SortedDictionary, SortedList

    Threadsafe : concurrent collections.
    Disk IO:

    A stream is a sequence of bytes that you can use to read from or write to a backing store.

    • Reading all the text file from disk
                File.ReadAllText(@"C:\temp\19.json"));
    • Reading large text file from Disk 
    using (var sr = new StreamReader(file))
    {
    string line;
    while ((line = sr.ReadLine()) != null)
    {
        Console.WriteLine(line);
    }
    }




    Wednesday, September 3, 2014

    OO Design Principles

    1. Single responsibility: every object should have single responsibility. ( there should be never more than a single reason to change a class)
    2. Open/Closed Principle: software should be open for extension but closed for modification.
    3. Liskov Substitution Principle: states that sub types must be substitutable for their base types.
    4. Interface segregation principle:  clients should not be forced to depend on methods they do not use
    5. Dependency Inversion Principle:  High level modules should not depend on low level modules. Both should depend on abstractions.  Abstraction should not depend on details but details should depend on abstractions.
    6. Cohesion: within class strong cohesion
    7. Coupling: low coupling.
    8. Many small classes with distinct responsibilities result in more flexible design.
    9. Use small interfaces so you don't require classes to implement more than they need.
    10. Refactor large interfaces so they inherit smaller interfaces
    11. Don't Repeat Yourself principle: Every piece of knowledge must have single unambiguous representation in the system.
    12. Repetition in logic calls for abstraction and repetition in process calls for automation.
    13. Repetition breeds errors and waste.

    An abstract function can have no functionality. You're basically saying, any child class MUST give their own version of this method, however it's too general to even try to implement in the parent class.

    A virtual function, is basically saying look, here's the functionality that may or may not be good enough for the child class. So if it is good enough, use this method, if not, then override me, and provide your own functionality.

    Training

    1. Threading:     http://www.albahari.com/threading/
    2. http://www.dotnet-tricks.com/
    3. http://www.dotnetperls.com/

    Tips

    1. Demo, Demo and Presentations
    2. Question or expand what are you are comfort at.

    Moving to Developer role

    1. Learn Design Patterns
    2. TopCoder
    3. System and oo design solutions.
    4. Learn Language well
    5. Find the problem that is well needed for the business and solve extremely well
    6. Do code reviews to learn new designs and excellent coding skills.
    7. Always ask is this shippable code - is it qualitative, easy to debug, is it scalable,  can it be multi threaded?

    Tuesday, September 2, 2014

    Interview Questions - Strings

    • Given a string, return the string with the words reversed "I am good" -> "good am I" .List test cases and if you were crunched on time and only had time to test one test case, which would you pick
    • find the substring count from a string without string functions in java? Given String str = "abcdefghcde"; String find = "cde";   Count occurrences of cde in String str
    • How to replace the space in the string with "ABC" without using extra memory.. string may contain some extra memory. str = "i am chandu" -- str contation more memory...
    • str = "iABCamABCchandu"

    My Found Bugs

    1. User exists in multiple partitions
    2. Renaming skydrive to onedrive

    C# Threading

    1. Lock
    2. Monitor.Enter and Monitor.Exit
    3. Mutex is like a C# lock, but it can work across multiple processes
    4. A semaphore is like a nightclub: it has a certain capacity, enforced by a bouncer. Once it’s full, no more people can enter, and a queue builds up outside.
    "A class is thread-safe if it behaves correctly when accessed from multiple threads, regardless of the scheduling or interleaving of the execution of those threads by the runtime environment, and with no additional synchronization or other coordination on the part of the calling code."

    A program or method is thread-safe if it has no indeterminacy in the face of any multithreading scenario.

     Assemblies can be shared among multiple applications on the machine by registering them in global Assembly cache(GAC). GAC is a machine wide a local cache of assemblies maintained by the .NET Framework. We can register the assembly to global assembly cache by using gacutil command.
    We can Navigate to the GAC directory, C:\winnt\Assembly in explore. In the tools menu select the cache properties; in the windows displayed you can set the memory limit in MB used by the GAC

    Attributes allow you to add descriptions to classes, properties, and methods at design time that can then be examined at runtime via reflection.

    Sunday, August 31, 2014

    Way of Interview

    1. "What is the hardest bug you've had to find and fix?"
    2. Give ten pages of code and figure out the design
    3. "What happens when you type http://www.google.com in a web browser address bar and press enter? You have 45 minutes, go as deep as you want with your explanation.
    4. code something from scratch in 3 hours, then explain my design and solution
    5. the best thing that they had created as a programmer
    6. I will usually ask for code samples before the interview, or look at what they have at github
    7. "what's in your feed reader" who do you follow?" and "how do you keep up to date?"
    8. Make two armies fight each other and output the result. Introduce an element of randomness".
    9. "What is your go-to language or the language that you are most proficient in?" and then "What would you change about <that language>?"
    10. Write a function that takes a function and two ints and applies it to the two ints. 
    ------------------------------------------------------------------------------------------------------------
    • "What is the hardest bug you've had to find and fix?"
    1. When skydrive brand changed to onedirve and deployed to df, page does not get displayed
    2. Multiple entries for single users in onedrive logs which cause data reporting invalid.
    • Give ten pages of code and figure out the design
    • "What happens when you type http://www.google.com in a web browser address bar and press enter? You have 45 minutes, go as deep as you want with your explanation.
    1. You enter "facebook.com" into the address bar.
    1. Browser resolves this to the numeric IP address (this can be cached by the OS or require a trip out to a DNS server).
    2. Browser issues a "HTTP/GET" request. It passes along an HttpRequest which includes metadata about the browser, user preferences (like preferred language) and any stored cookies for that domain.
    3. Facebook servers receive the request and their code begins to craft a response.
      1. Facebook will use the passed information including cookies to determine who the user is and what information to send back
    4. A HTTP Response is returned from Facebook including a status line (200 OK, etc). Headers which include content-type, etc and the HTML body.
    5. The browser receives the Response and begins to parse it for display.
      1. The HTML body will include links to CSS, JS and images. All of these will trigger additional calls back to servers to retrieve those bits
    6. The browser layout engine will start to assemble the final page for display.
      1. CSS information may alter the layout and look of the page
      2. JS and DHTML may alter the layout of the page
    7. The final page is assembled and rendered to the end user
    8. http://igoro.com/archive/what-really-happens-when-you-navigate-to-a-url/
    • code something from scratch in 3 hours, then explain my design and solution
    • the best thing that they had created as a programmer
    • I will usually ask for code samples before the interview, or look at what they have at github
    • "what's in your feed reader" who do you follow?" and "how do you keep up to date?"
    • Make two armies fight each other and output the result. Introduce an element of randomness".
    • "What is your go-to language or the language that you are most proficient in?" and then "What would you change about <that language>?"
    • Write a function that takes a function and two ints and applies it to the two ints.

    Saturday, August 30, 2014

    Interview Questions

    • Given an Array, replace each element in the Array with its Next Element(To its RHS) which is Larger than it. If no such element exists, then no need to replace. 
                    i/p: {2,12,8,6,5,1,2,10,3,2}
                    o/p:{12,12,10,10,10,2,10,10,3,2}
    • Your algorithms have become so good at predicting the market that you now know what the share price of Wooden Orange Toothpicks Inc. (WOT) will be for the next N days. Each day, you can either buy one share of WOT, sell any number of shares of WOT that you own, or not make any transaction at all. What is the maximum profit you can obtain with an optimum trading strategy?
    • Given a list of integers, your task is to write a program to output an integer-valued list of equal length such that the output element at index 'i' is the product of all input elements except for the input element at 'i'.
                     i/p: {1,2,3}
                    o/p:{6,3,2}    

    • Given a sorted array with duplicates and a number, find the range in the form of (startIndex, endIndex) of that number. 

               find_range({0 2 3 3 3 10 10}, 3) should return (2,4).
               find_range({0 2 3 3 3 10 10}, 6) should return (-1,-1).
              The array and the number of duplicates can be large.


    • There is an array of 3-tuple, in the form of (a, 1, 5). The first element in the tuple is the id, the second and third elements are both integers, and the third is always larger than or equal to the second. Assume that the array is sorted based on the second element of the tuple. Write a function that breaks each of the 3-tuple into two 2-tuples like (a, 1) and (a, 5), and sort them according to the integer.  
               E.g. given (a, 1, 5), (b, 2, 4), (c, 7, 8), output (a, 1), (b, 2), (b, 4), (a, 5), (c, 7), (c, 8).


    Problem Solving Strategies

    1. Use Look-up Dictionary
    2. Use Stack, Queue
    3. User Recursion
    4. Use Binary Operators
    5. Saving previous results ( Dynamic programming)
    6. Throw exception for invalid inputs
    7. In place for memory optimization and store results in memory for processing speed optimization.

    Friday, August 29, 2014

    Coding principles

    1. Always private unless you are absolutely sure that you need public method.
    2. Deployment components sequence. Can update in one component breaks other component?
    3. Does deployment involves down time?
    4. what if the code run millions of times?

    Thursday, August 28, 2014

    Distributed software

    1. Load Balancer:  the load balancer just forwards the requests to the backend machines, which actually "process" the requests, receives the responses from the backend machines and sends them back to the client.
    2. Caching:
    3. Cluster: A computer cluster consists of a set of loosely connected or tightly connected computers that work together so that in many respects they can be viewed as a single system.
    4. Partition:
    5. Parallelization: means attacking a problem in a way that makes it easy to add more resources for solving it
    6. Caching:caching is easy, purging the caches when updates are needed is hard.
    7. Scalable code essentially means you solve problems such that your code is able to produce the desired output if the problem scales to a problem of millions or billions.
    8. Scale out: add more computers.
      Scale up: make each computer more powerful (add more CPUs, memory, storage, worker threads, etc) Map-Reduce operations tend to work best with the scale out approach. Virtualization benefits from scale up, but only to some degree.
    Load Balancing