twitter
    The place where CEO's meet !

Friday, July 24, 2009

Horoscope

How to learn any subject?

Know the platform (hardware/software) and the applications 

Acquire various study resources of the subject: 

  •     Internet resources
  •     Books
  •     Product help or documentation 

Study the need and history of the subject 

Identify the category of the subject among the below: 

  • Theory
  • Concept
  • Technology
  • Methodology 

Any subject contains one or more blocks of knowledge:

Block = Knowledge burst + Understanding + Implementation + Exploring/Experimenting 

Theory and concept may have single block of knowledge whereas, the rest may have multiple knowledge blocks. 

While learning a block, there may be few tough parts that one cannot understand immediately. They are called holes. As we are proceeding to study, holes increased. 

Without implementing one knowledge block, if you go to next block, you will find too many holes in it, which finally results to poor understanding on the subject. 

Take gaps between the blocks but not in between one block; other wise it leads to ambiguity of concepts. 

For every three to four months, once we have to recall the subject for not loosing it permanently.

System programming: The inside story

From the day of evolution, computing had been adopting new trends led by the corporate strategies and the industry demands. The birth of desktop computers, rapid growth of the Internet users, vertical down-fall of computer prices and development of many emerging technologies, all these reasons contributed to promote the use of computer technologies in almost every area of application. Few new trends soon harbored at the individual solutions for specific systems and manual solutions. Finally, two broad programming trends were formed namely system programming and application programming. As a result, the industry is divided into two major classifications: System software based and Application software based. However, both use some common software for their basic requirements; but these groups differ in their objectives for which, they are using computer technologies. 

Exactly, what is 'system' programming? a trend of computing used to develop software for the needs of system vendors, designers and system requirements is referred to as system programming. Contrarily, a trend of computing used to develop applications for the end-use, is known as application programming. 

As a career objective, application programming has a wide scope of opportunities and job opening s compared to system programming. But still, for the system programmers with enough depth of knowledge and hardworking nature, many bright openings and handsome positions from good MNC's are available. The common strategy for the people who choose system programming is: "If you dig, dig a gold mine!" System programming is not only an area of common interest, but a single rope mania too. Without having a perfect conception, one can't proceed in system programming much. In-fact, this is a very reason, why everybody can't become proficient in this field. 

According to many people, system programming simply refers to design of some compilers, language processors or any operating system internals. However, there exits some overwhelm about system programming scope. There are many areas of computing in the field of system programming, out of which commonly many are unseen by enthusiasts. These areas can be broadly grouped into two major fields:


Operating systems Design and Implementation :


  • Startup BIOS Routines
  • Hardware Detection Routines
  • Generic Device Driver Implementation
  • Specific Device Driver Implementation
  • System Registry and Software Configuration
  • System Tools such as Check Disk, Format, Partition Software, Administration tools.
  • CPU and process schedulers
  • File system Design and Implementation
  • Memory management, Virtual memory
  • Language processors design(Assemblers, Compilers, Linkers, Loaders and Interpreters) 
    System API Design
  • Operating System Kernel Design
  • Operating System Shell Design
  • System-calls and Internals of O/S 
    Interrupt Requests
  • Microprocessor Simulation Tools in O/S
  • Other areas of system programming: 

  • Network Programming(Socket Programming)
  • RPC (Remote Procedure Calls)
  • Graphics Programming
  • Text and Graphics editing tools
  • Data Compression
  • Cryptography and Security Systems
  • Embedded programming, RTOS
  • Programming for Programmable Peripheral Interfaces
  • Programming for industrial PLC's (Programmable Logic Controllers)
  • Network Communication Utilities Design
  • Network Protocol Design and Implementation
  • Database Systems Design and Implementation
  • Database drivers, protocols design
  • Installers, Self-Extractors and auto-run utilities
  • Wizard programming
  • IDE Design (Integrated Development Environment) 

    As you have seen, programming is having numerous areas of application for it. Though it is vast in nature, mastering few areas is not difficult provided you are having a strong determination and a perfect guidance.

How to master programming?

 Learning Computer Programming is a common need for people today. You may need C, C++ or VB Programming for your academic or you may be studying any independent Computer course for your future. Even after attending classes, if you are not able to master the programming, this material really helps you. The readers of this material are assumed as beginners in Programming. 

  1. Every program contains four basic parts: 
  • Declarations, definitions 
  • Input, initialization
  • Logic/Process
  • Output, Result

Too small programs can be written only with main() without needing to define any external functions. 

Medium and large Programs can be written into multiple Functions 

If you write the Programs using Functions 

  • Isolate input/output from logic or process
  • Logic must be written few dedicated functions
  • Input/Output can be done in higher-order functions like main 


To design the functions, remember the below principles: 

  • Every Function should perform an independent process or task that can be reused in main program. 
  • The inputs of that process are taken as arguments 
  • The Outputs of that process can be the return value of the function or arguments. 
  • Try to isolate Function only for Logic apart of I/O 

Solving a Problem through programming requires these steps: 

  • Solve the inputs 
  • Solve the Logic 
  • Solve the output

These three aspects are explained below 
Inputs of a program can be taken from one of the below things, sometimes it can be few of below or all: 


  • The problem statement 
  • Case study, Assumed inputs 
  • User inputs 
  • Calculated inputs 
  • Constant values 

Before making the logic of the program, you must recall the set of language constructs and libraries that may be useful in the program. 

Output may be displayed immediately or at the end or written to any secondary media such as file. 

 


API: the inside story

 API is a popular keyword in programming. API stands for Application Programming Interface. It is commonly used for implementing any programming technology such as file handling, network socket programming or database connectivity. Though many programming languages offer API's, a generalized understanding about the API would be technologies and smooth migration between programming platforms. 

API seems to be very much similar to the built-in libraries of programming languages, comprising in-built functions to perform certain operations. However, an API differs from an ordinary library in below aspects: 

  • An API interfaces programs with any system concepts, resource or hardware programmatically whereas a programming library simply offers data manipulation through some built-in functions. 
  • The functions defined in as API commonly resemble certain operations on some resource. Hence, one must call those functions as per the order given in its life-cycle specification. In contrast, a commonly a library function may be called irrespective of order. 
  • For practicing an API in programs, one must learn the operation of its backend resource. However, for using a library, one must know the prototype specification and data type of the functions of the library. 
  • Most commonly, the implementation of an API is kept hidden by allowing concrete data types and factory functions to be used by the programmers rather than accessing the data members of those data types directly. Factory functions are useful for hiding the resource data type implementation. For example, due to a factory function fopen(), you will never know that FILE is a predefined structure. You believe that it is a natural data type. 
  • API's are commonly designed by the vender of the resource whereas libraries are shipped with programming language tools. 

An API can be characterized with below features: 

Life Cycle - since the primary interest of an API is to interface with a resource or system concept; accordingly a life-cycle specification is provided. For example, for file-I/O, we must follow the order of opening buffers, performing I/O and closing them. One cannot perform I/O without opening the buffers. Thus, programmer is restricted to follow a predefined order for the usage of API functions. 

Data types - If an API is meant for the interaction with a system resource or hardware, there must be a data type defined in that API to resemble that resource or hardware. For example, file-I/O API contains FILE data types may be C structures, Unions or C++ classes, which depends on the programming language for which API is written. 

Handles - Although resource data types are given, their variables cannot be directly used to process the resource. One solution is to use the same data type pointers as handles. For example, to send a file can be used. Sometimes, the underlying resources may not any memory or attributes to be explicitly maintained. For such resources, handles can be simple integers comprising their identification details, rather than its data type pointers. For example to handle sockets, we use an integer called socket descriptor. 

Factory Functions – A Function that creates a certain user-defined type variable’s instance and returns its handle is known as a factory function. The primary use of these factory functions is to avoid the code overheads for initializing the attributes of the data type. The handle returned by the factory functions can be captured into a program variable. For example, fopen is a factory function that returns a FILE pointer. 

Life Cycle Functions – For changing the state of the resource and to make certain standard operations on the resource, few life-cycle functions are defined in API. For example, to close the file buffer fclose(), to rewind the pointer to update or clear the buffer fflush(), etc. the Life-cycle functions may not be used for data transfer with respect to the resource, rather they may not be used to control the resource. 

Resource-I/O functions – With few resources such as files, network sockets we may need to make data transfers. API provides few resource-I/O functions for this purpose. For example, fprintf() and fscanf() are used to make file-I/O. 

Transformation functions – sometimes one particular resource may be represented with multiple data types with different formats. In such case, conversion or transformation between them is possible through transformation function. For example on UNIX/LINUX Platforms time is represented by using two data types: time_t represents long format time and struct tm represents formatted time. The function localtime() converts time_t type time into the other type. 

Constants – To represent certain predefined, fixed or constrained values, few constants such as macros are defined in API's. Eg: SEEK_OFFSET, SEEK_BEG, SEEK_SET.

To make a set of specification and designs primitives for writing API's and when to take a factory function and when to take an initialization function. 

From the API user's point of view, how do you exploit the various features of an API, and use its constructs for your level best. 

  

 

 

 

 

 

 

 

 

 

 

25 points about c++ constructors

For many students including engineering and any bachelor degree in computers, C++ is an academic subject for their studies. Few people may need to attend for job interviews on C++ platforms. For all the above people this material would help to get comprehensive knowledge about C++ classes. Though I used to provide this material to my C++ students since past five years, I have decided to keep it in a global location, which is main intention behind keeping it here. 

  • Constructor is a member function of a class having its name as class name. 
  • Constructor can initialize the object (its member), and may build memory for the object members if required. 
  • Constructor is a special member function, and hence it can’t be defined with any return type. Not even void or int is allowed. 
  • Constructors can be defined with or without arguments.
  • Constructors can not be overridden.
  • Commonly constructors are defined as public or protected members.
  • In case if no constructor is explicitly defined for a class, then compiler supplies a constructor with no arguments and no code. It is commonly referred to as default constructor or implicit constructor.
  • In case if no constructor is explicitly defined for a class, then compiler supplies a constructor with no arguments and no code. It is commonly referred to as default constructor or implicit constructor.
  • Constructor acts like-cycle function for every object.
  • Constructor is automatically invoked during the creation of each object of its class. Constructors can be defined with default argument values. Such constructors are known as default argument constructors. 
    The class, whose objects are serialized or managed in object pool, must contain one constructor without any arguments. 
  • Constructors are classified into three types: • Default constructor • Copy constructor • Parameterized constructor.
  • A default constructor is either implicit or explicit constructor defined with no parameters(arguments)
  • Having a default constructor, a class can be instantiated (object can be created) implicitly or explicitly.
  • A copy constructor takes an object reference of same class type as arguments and copies the content of the passed object into created object.
  • Creating an object-clone with copy constructor differs from object assignment in one issue : Suppose the class contains one or few pointer members , and those are allocated with memory in the object that has to be copied into a new object .Assignment done as ‘new-object=old-object’ simply copies the address of those pointers from the old object to new object, without allocating memory and then performing content copy. In contrast we define a copy constructor to perform a copy after memory allocation to those pointers. 
  • Parameterized constructors are defined with one or few parameters (arguments) of any data types. There can be many parameterized constructors exist for a class, where prototypes and arguments differ.
  • A parameterized constructor defined with a single argument behaves like a type conversion routine to convert from any basic type to class type. It is automatically invoked during the assignment or explicit typecast from any type to this class.
  • Unlike ordinary member functions, constructors can not invoked directly without creating objects.
  • For the life-time of an object , its constructor is called only once i.e., when the object is created
  • Constructor can be written with code for initializing object members to their natural default values need not be mandatory with zeros.
  • If a base class contains one or few parameterized constructor without any default constructor ,then all its derived classes must define explicit constructors that call any one of its base class parameterized constructor with below syntax : 

     
     class BaseClass  
     { 
      public : 
      BaseClass(base args ......) {....} 
      // Base Class Constructor 
      ....... 
      } 
      class DerivedClass : public BaseClass  
      { 
      public : 
      DerivedClass(derived and base class .....) 
      : BaseClass(base args ......) 
      {
      ..... 
      }  
      ..... 
      }  
     

     
    Every derived class constructor implicitly or explicitly calls its base class constructor since, creating base class object is vital operation while creating derived class object. If explicitly no call is made to the base class constructor, its default constructor is called. 

     

There was an error in this gadget

Finance Tip of the Day