Monday, September 20, 2010

Loosely coupled and highly cohesive

  1. Coupling
    1. among classes
    2. among subsystems, modules
    3. related classes knowing the internal details of each other
    4. when one is changed, other has to be changed
    5. makes the system difficult to understand
    6. no possibility of reuse of the entwined code
  2. Cohesion
    1. inside the class, among the class attributes and behavior
    2. well defined roles for the classes within the system
    3. the data is closely related with the functions which the class is providing
  3.  

  4. Law of Demeter (more specific case of "low coupling", LoD)
    1. motto is "only talk to your immediate friends"
    2. each unit should have only limited knowledge about other units "closely" related to the current unit (method/function "f")
    3. in context of OOD, closely related
      1. are the functions of the class in which unit (function "f") exists
      2. other argument classes of unit (function "f")
      3. functions of immediate part classes (computed and stored) of class of unit (function "f")
        1. computed classes are the classes that are the return type of functions of this class
        2. stored classes are the classes of the data members of this class

Tuesday, September 14, 2010

Overview Of SIP Operation I

  1. basic functions of SIP (HTTP like request/response transaction model)

    1. Location of an endpoint
    2. signal of a desire to communicate
    3. negotiation of session parameters for the session
    4. teardown of session once established
  2. Request handling in SIP is often classified as either INVITE or non-INVITE (an ACK is only sent in response to a response for an INVITE request,INVITE/200/ACK)
  3. SIP messages are text-encoded
INVITE message example, with header fields (minimum required set)
  1. INVITE sip:bob@biloxi.com SIP/2.0
  2. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds
  3. Max-Forwards: 70
  4. To: Bob <sip:bob@biloxi.com>
  5. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  6. Call-ID: a84b4c76e66710@pc33.atlanta.com
  7. CSeq: 314159 INVITE
  8. Contact: <sip:alice@pc33.atlanta.com>
  9. Content-Type: application/sdp
  10. Content-Length: 142

Pointers to pointers, and arrays and strings II

  1. (*ptoStruct).member; is same as ptoStruct->member
  2. char name[40] = “mithun”, allocate 40 bytes on static memory block, and occupy the first 7 bytes (6 + ‘\0’), and “name” is a array constant, un modifiable lvalue
  3. char name[] = “mithun” , count number of chars, allocate memory for count+1 on static memory block, and “name” is a array constant un modifiable lvalue
  4. char* name = “mithun” ,  allocate the memory for number of characters + 1 for nul, and also 4 bytes for the pointer variable “name”, and “name” is a variable
  5. in the array notation name is the address of the first element i.e. &name[0], and will always point to the same location (a constant).

SIP Overview

  1. An application layer control protocol (works with both IPv4 and IPv6), that can

    1. establish modify and terminate multimedia sessions (conferences), such as IP telephony calls
    2. invite participants to existing sessions (like multicast conferences)
    3. existing sessions can be modified by adding/removing media from an existing session
    4. transparently supports name mapping and redirection services (support to personal mobility)
    5. a single externally visible ID can be maintained regardless of the network location (SIP URI)

Monday, September 13, 2010

Symptoms of Problems in Design, and Design Principles to follow

Symptoms
  • difficult to change
  • every change cascades changes in other dependent modules
  • software break in many places, with every change
  •  inability to reuse from other projects or from the same project
  • design preserving changes are harder than hacks
Causes

  • changing requirements
  • improper dependencies between the modules

Thursday, September 9, 2010

UNIX process

UNIX process

process is a running instance of a program,identified with "pid"

process consist of
  • allocated system resources
  • a section of memory
  • security attributes (like its owner and set of permissions)
  • the process state(running,blocked,waiting)
  • process can also be called as execution context of a running program in the current time slice, which is given by the OS as part of scheduling the processes running in the CPU
  • process can also be defined in terms of data structure which stores the information about the process
  • new process is created by "fork" command in Unix
  • program is an executable file in binary format that can be read by the CPU, and process is a program in action (execution)
process control system provides services for
  • process scheduling, giving cpu time(divided into time slice) to each process, context switch(when time slice ends or the process waiting for a resource) from one process to other when execution context changes
  • context is the contents of the CPU register and the program counter
  • when context switch occur
  • when scheduling multiple tasks(from one process or thread to another), handling the hardware interrupt,user and kernel mode switching

Unix File System

Unix filesystem
  1. Unix has only files (directory,special file or device file) and processes
  2. Tree like structure (hierarchy)
  3. root node topmost (only one root)
  4. all data in files is a stream of bytes, for the kernel
  5. files dynamically grow
Internal View
  1. made up of blocks (eg 512 or 1024 bytes blocks)
  2. block 0 is boot block (used for booting)
  3. block 1 is super block (store info about file system, like type,free and used space)
  4. then comes the i-list blocks (contains the i-node blocks for all the files in the system)
  5. then comes the data block (storing the actual data)