Tuesday, August 10, 2010

Introduction to Python

Python is an interpreted, high-level, general-purpose programming language. Instagram and Google uses Python in there backend. Over the years Python has grown its territory massively. 

Python can be used for

  • server to create web applications. 
  • can be used alongside software to create workflows. 
  • can connect to database systems. It can also read and modify files. 
  • can be used to handle big data and perform complex mathematics. 
  • can be used for rapid prototyping, or for production-ready software development.

You can install Python from website.

Recommend tool to use python with Visual Studio Code. You can install Python extension for ease of use. 

References
https://stackoverflow.blog/2017/09/06/incredible-growth-python/

Saturday, August 7, 2010

Do not break these User Interface Design Principles


Keep the following as a checklist next time when you're designing an interfaces

  1. Keep things clear without confusing the user
  2. Make user know what is preferred action is. Especially for new users
  3. Keep user interface interaction controls close to relevant content
  4. Keep good set of default settings
  5. Guide user on what they must do. Next
  6. Give feedback for interactions
  7. Breakdown complex actions into set of simple step by step action set


Resources
Photo credit : msdn

Tuesday, May 11, 2010

Creational design patterns

Factory

Provides an interface to create objects. Rather than creating new objects using new keyword, we ask the factory to create and return them for us. 

Factory in JavaScript : method1 (addyosmani) and method2 (carldanley)





Builder

http://www.oodesign.com/builder-pattern.html

Lazy initialization

Creation is deferred until it is first used. Useful for complex objects. 

C# : http://msdn.microsoft.com/en-us/library/dd997286%28v=vs.110%29.aspx


Object pool

Useful when cost of initializing a class instance is very high.  Therefore when requester requires an instance, he can get one of already created instance.

Prototype




Singleton 

http://stackoverflow.com/questions/327955/does-functional-programming-replace-gof-design-patterns?rq=1

Saturday, May 1, 2010

Introduction to Testing


Testing is a mechanism we use to evaluate whether the software we are developing satisfies the specified requirements. Testing is a very broad subject. Here we'll just look in to some high level overview of what it is.


Types of testing

  • Manual testing
    • Takes the role of an end user and checks for unexpected behavior 
    • There are few levels like unit testing, integration testing, system testing and user acceptance testing
    • Uses test plan, test cases or test scenarios to test
  • Automation testing
    • Also known as Test Automation
    • Testers writes scripts and use other software to do testing
    • Rerun test scenarios quickly and repeatedly
    • Use tools like Selenium, VS Test Professional, IBM Rationale function tester

Testing methods

  • Black box 
    • Without having any knowledge of interior workings of the application (UI level)
  • White box
    • Detailed investigation of internal logic
  • Grey box
    • Testing with limited knowledg

Sunday, April 4, 2010

Behavioral Design Patterns

Observer

Object (subject) maintains list of its dependencies (observers). Subject will then notify observers whenever any state change occurs in it. 

Related patterns are Publish-Subscribe pattern, mediator and singleton 
http://weblogs.asp.net/fmarguerie/events-references-garbage-collecting-memory-leaks-and-weak-delegates


Iterator



Mediator

Defines an object which encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects referring from each other explicitly.

http://www.dofactory.com/net/mediator-design-pattern  
Template method
http://www.oodesign.com/template-method-pattern.html
Null object

Strategy

Defines set of algorithms that can be used interchangeably. Basically you create an interface and derive implementations from that. Clients can couple themselves with the interface. 

http://robdodson.me/javascript-design-patterns-strategy/
http://sourcemaking.com/design_patterns/strategy

Command


Saturday, March 27, 2010

Basics in C#

C# is a multi paradigm programming language which has,

  • strong typing (error if argument pass to a function does not match expected type. See strong typing vs static typing)
  • imperative (statements which changes the state in contrast to functional programming- see diff)
  • declarative
  • functional
  • generic
  • object oriented and
  • component oriented 
program disciplines.

Data Types

Value type
Directly contain data in its own memory location
Each instance has its own copy of data
Value type can be divided into Simple, Enum, Struct and Nulllable types
http://stackoverflow.com/questions/1769306/why-are-net-value-types-sealed

Reference type
Stores a reference o the data (object)
Can be divided into Class, Interface, Array and Delegate types

It is not exactly true that value types goes on stack and reference types goes on the heap


Notes
A variable is an association between a name and a slot of memory. Variable has a value which the content of memory slot is associated with. The size depends on the type of the variable.

Value of a reference type is always a reference or null. If it's a reference it should be compatible with type of the variable. The slot of memory associated with the variable is size of the reference (Int32 : 4 bytes).

Value of value type is always data for an instance of the type itself. The slot of memory is large enough to hold its value (struct with 2 integers). Value type cannot have null. Null means variable of a reference type does not point to anything. 

local variables are stored on stack, including reference type variables. 

http://jonskeet.uk/csharp/memory.html

Mutable vs. Immutable 

  • Mutable : can change, Immutable : Cannot change
  • A mutable string can be changed, immutable string cannot
  • Immutable type is a class or struct written so that it cannot be changed once it is created. 
    • Once a string is constructed, it cannot be changed. All the functions you can call on a string return a new string, instead of manipulating the string they are called on
  • Instances of immutable types are inherently thread-safe (No thread can modify it)
  • source , mutable structs are evil , 
  • Always make value types Mutable (Eric Lappert)

Tuesday, March 16, 2010

Structural Design Patterns

Decorator

Allows behavior to be added to an individual object either statically or dynamically, without affecting the behavior of other objects from the same class. FileReader in C# is a good example for this. Also check this article from codeproject for C#. Explore the Decorator pattern in JavaScript

Source
Example

Facade

Provides simplified interface to larger body of code such as a class library. Checkout this article by dofactory for C# and addyosmani section for JavaScript.


Source

Composite

Describes that group of objects to be treated same way. The objective is to "compose" objects into tree structures to represent part-whole hierarchies.


Proxy

It's a class acting as an interface to something else. This can be a network connecting, web service or some other resource which is expensive or impossible to duplicate


Module pattern

See (http://en.wikipedia.org/wiki/Module_pattern)


Resources

http://en.wikipedia.org/wiki/Software_design_pattern

Tuesday, February 2, 2010

Web Services with ASP.NET

Web services provide infrastructure to create distributed computing applications. Simply web services resides in a web server and enables clients to invoke its methods. In .NET, clients can communicate with web services using proxies. Usually HTTP handlers are used to implement web services.
Source : developer.mulesoft.com
You can generate the proxy class using WSDL.exe if you have the web service description which conforms to WSDL. When you use this tool a single proxy class is generated. 

See creating an XML web service proxy (MSDN)
How to generate web service out of WSDL (SO)

WSDL (Web Service Definition Language)
Describes the web service

SOAP
It is a programmable application logic accessible via standard Web protocols. SOAP (Simple Object Access Protocol) is one example. SOAP uses XML for data description and HTTP for transport. 

SOAP message consists of,
  • SOAP envelop
  • SOAP headers
  • SOAP body
RESTful Web Services
RESTful web services does not contain any contract or WSDL file. It is simple to implement and supports different data formats (JSON, XML etc.)

Serialization in Web Services
Web Services use XMLSerialization for serializing response. 
https://msdn.microsoft.com/en-us/library/564k8ys4(v=vs.110).aspx

Resources

Tuesday, December 22, 2009

Object Oriented Concepts Every Dummy Must Know

Abstraction
  • Abstraction is Only showing what is necessary and encapsulating (hiding) unnecessary parts. 
    • If you take a car you interact with it using abstractions 
      • you use gas pedal, steering wheel which hides internal details
  • It is keeping a clear separation between abstract properties of a data type and the concrete details of its implementation. 
  • It is not presenting the details but only show the parts which are necessary.  
  • Hiding implementation 
To abstract properties we can use private modifier. Abstraction is hiding implementation details using abstract classes and interfaces.


Encapsulation : 
  • Hiding state/data. Information hiding mechanism
  • It is the opposite of Abstraction.  
http://stackoverflow.com/questions/24626/abstraction-vs-information-hiding-vs-encapsulation
https://www.google.com/search?q=encapsulation+vs+abstraction&ie=utf-8&oe=utf-8
http://stackoverflow.com/questions/742341/difference-between-abstraction-and-encapsulation

Composition : Combining simple types to make a complex type (Car composed of Wheels, Body etc.). An object of a composite type "has an" object of a simple type.


Aggregation : (See composition vs aggregation - adobe)

Is a form of object composition.

Inheritance : When an object or class based on another object or class. 

Inheritance is "is a" relationship while, composition is "has a" relationship

Articles

  • inheritance defined statically at compile time.
  • object composition defined dynamically at run time, through objects acquiring references to other objects
  • inheritance : reuse by subclassing : white box reuse (internals of parent are visible)
  • composition : well defined interfaces: black box reuse (no internal objects are visible)



updated: 2014

Saturday, July 11, 2009

SOLID Principles

SOLID is acronym used for 5 design principles for object oriented programming. Below we'll look at what they are

Single Responsibility principle

Every class should have only one responsibility. This responsibility should be totally encapsulated by the class.


Open/Closed principle

Software entities should be open for extension, but closed for modification. This is valuable when it comes to production environments where changes to existing code may require code reviews, unit tests etc. which ensures the quality of the product. In design, inheritance is used to achieve open/closed principle. 

see wikipedia, OODesign, Objectmentor,

Liskov Substitution principle

Derived types must be completely substitutable for their base types.

see OODesign,

Interface segregation principle 

Client should not be forced to depend upon interfaces that they don't use

Dependency Inversion principle

High-level modules should not depend on low-level modules.


Wednesday, July 1, 2009

Exception handling basics

Exceptions happens when a member cannot successfully do what it's designed to do. Exceptions can be generated by CLR, 3rd party library or by user code using throw keyword.


A catch block can specify type of exception to catch. This is called exception filter. The exception type should derive from Exception. In general do not specify Exception as the exception filter.

Inside the catch block you can either return a value or throw an exception depending on the situation you're in. (When to throw an exception). Difference between throw and throw ex.

A finally block enables you to clean up actions that are performed in try block. A finally block always runs, regardless of exception is happen. Note that sometimes finally block will throw exceptions as well.


Exceptions contains a property called StackTrace. It contains names of the methods in current call stack, together with file name and line number where exception was thrown for each method. You can use Environment.StackTrace to get stack trace information when no exception is being thrown.

Sometimes you shouldn't throw exceptions. See cost of exceptions and this (SO)

Some common exceptions in .NET

NotImplementedException (msdn)
See Why does NotImplementedException exists - SO

Handling business logic in exceptions
http://stackoverflow.com/questions/5378005/when-is-it-ok-to-use-exception-handling-for-business-logic
http://programmers.stackexchange.com/questions/15570/representing-business-rules-with-exceptions

Exceptions you should not throw (SO)
Since they doesn't give any meaningful information when writing your own code you should not throw,

  • Exception
  • SystemException
  • NullReferenceException and IndexOutOfRangeException are fine





ResourcesUnhandled Exception Processing In The CLR

Tuesday, June 16, 2009

Saturday, February 28, 2009

Database concepts


Following are scenarios for Availability

Log Shipping
Automatically send transaction log backups from primary database on the primary server to secondary database on a secondary server. Good for disaster recovery.

Replication
Almost same as log shipping.

Mirroring
failover technique

Failover clustering
advanced database mirroring

MSDN - Log shipping


Resources

http://msdn.microsoft.com/en-us/library/bb404102.aspx
http://msdn.microsoft.com/en-us/library/aa0416cz(v=vs.110).aspx
http://stackoverflow.com/questions/659489/pessimistic-versus-optimistic-concurrency-locking-versus-feedback
http://stackoverflow.com/questions/13432489/concurrent-updates-handling-in-asp-net-or-sql-server-2008
Powered by Blogger.


Software Architect at Surge Global/ Certified Scrum Master

Experienced in Product Design, Software Engineering, Team management and Practicing Agile methodologies.

Search This Blog

Facebook