Skip to main content

Posts

Showing posts from 2006

Lets learn C

The C Journey

Lesson One : Introduction
C is everywhere, though .net, java, python is taking the world by storm. It is still one of the fundamental language to learn beginning programming. Though some may argue the case to be otherwise, but this is the way which worked best for me.

Lets get to the heart of the matter. Every C program begins with a main() function. main() is the entry point for a C program.

Let's write our first program, which is a hello world.


#include stdio.h
/* This program prints "Hello World" on the console. */
void main()
{
printf("Hello World\n");
}


The above program highlights many important features of C. Note the include file "stdio.h". The printf() function is located in this header file. You can treat stdio.h as a library containing many input/output functions. Later on we will see how to write our own such library.

Compile this program in your favorite editor and run it. You will be greeted with a "Hello World"…

Build your own Forms Authentication

The authentication ticked is created with the FormsAuthenticationTicket class. Its constructor accepts the following parameters:

version : The version of the authentication ticket[this value will be one]
name : The user name associated with the authentication ticket
issueDate : The date that the authentication ticket was issued
expiration : The date that the authentication ticket should expire
isPersistent: A boolean value indicating whether to allow the ticket to persist
after the user closes the browser
userData : A string value of any data that you would like to store. For eg.,
say your email ID.

Add an asp.net form, with a button 'Create Ticket'. On click on this button invoke the 'Login' method.

void Login(Object s, EventArgs e)
{
if (txtUsername.Text == "xxx" && txtPassword.Text == "xxx")
{
FormsAuthenticationTicket objTicket;
HttpCookie objCookie;
objTicket = new FormsAuthen…

Tech.Ed 2006...

My first tech.ed 2006 experience was not as expected, but still gain some understanding about the future trends in ms software innovation...
My favorite topics were LINQ, DLINQ as of now...

Yukon Rocks !!!

Yukon/SQL Server 2005 Rocks.

Features include CLR Programming, Custom types, User defined aggregates,
Notification services, Integration services etc....


Need to dig more deeply....

Object Primer - Cohesion

Tip : An object should be highly cohesive.

Cohesion is a measure of how much an item say for eg. a class or method, makes sense.
Objects with low cohesion are more likely to be changed.

A method is highly cohesive if it does one thing and only one thing.

Object Primer - Coupling

Object coupling describes the degree of interrelationships among the objects that make up a system. The more any one object knows about any other object in the system, the tighter the coupling is between those objects.

In other words, coupling is a measure of how two items, such as classes or methods, are interrelated. When one class depends on another class the are said to be coupled. When one class interacts with another class, but does not know have any knowledge of the implementation details of the other class they are said to be loosely coupled. When one class relies on the implementation of another class, they are said to be tighly coupled.


Point: Always try for loose coupling among objects. This can be achieved by programming to a common interface(super type).

Lessons from Head First Design Pattern - 1

OO Basics
---------------------------
- Abstraction
- Encapsulation
- Polymorphism
- Inheritance


OO Principles
---------------------------
- Encapsulate what varies
- Favor composition over inheritance
- Program to interface, not implementations.
- Strive for loosely coupled designs between objects that interact
- Classes should be open for extension but closed for modification.
- Depend on abstractions. Do not depend on concrete classes.

OO Patterns
---------------------------
Strategy - Defines a family of algorithms, encapsulate each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

Observer - Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Decorator - Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.

Factory Method - Define an interface for crea…

Something different than routine..

Just tired of doing the same stuff...its time for a change..

Currently working on beta project called "SkyFramework" in my free time....
Its something similar to "Ruby On Rails", but "SkyFramework" would be for .net...

Its still in its initial desing...but some test code is already on the move..