Notice

YouTube.com/BESTTravelers - Visit and SUBSCRIBE to our travel related YouTube Channel named "BEST Travelers"
Showing posts with label Information Technology. Show all posts
Showing posts with label Information Technology. Show all posts

Sunday, March 24, 2013

Aegir

Aegir is a distributed instance management system, that allows authorized users to administer multiple Drupal sites across one or more servers, through a Drupal based administration front end. It is designed to help solve many of the common problems that administrators come across when providing mass hosting solutions, by providing the basis for turn-key deployment and management of Drupal sites and related services.

Friday, March 8, 2013

শতাব্দীর বিস্ময় ইন্টারনেটের যোগাযোগ

১৯৬৯ সালের গ্রীষ্মকাল। বিশ্ববাসী তখনো জানে না ইতিহাসের দিনপঞ্জিতে কি বৈপ্লবিক পরিবর্তন হতে যাচ্ছে। নীরবে-নিভৃতে কাজ করে চলেছেন গুটিকয়েক কম্পিউটার বিজ্ঞানী। লক্ষ্য একটাই_ যুক্তরাষ্ট্রের বিভিন্ন প্রান্তে কর্মব্যস্ত বিজ্ঞানীদের মধ্যে পারস্পরিক ভাববিনিময়ের পথ সুগম করার জন্য একটি কম্পিউটার নেটওয়ার্ক প্রতিষ্ঠা করা।এই নেটওয়ার্ক প্রতিষ্ঠার মধ্য দিয়েই ভিত্তি রচিত হলো শতাব্দীর বিস্ময় ইন্টারনেটের যোগাযোগ। প্রযুক্তিতে সৃষ্টি হলো নতুন দিগন্ত।

তখন কোনো মানসম্মত অপারেটিং সিস্টেম ছিল না। কম্পিউটারগুলো পরস্পরের সঙ্গে তথ্য বিনিময় করতে পারত না। এক কম্পিউটার থেকে অন্য কম্পিউটারে ডাটা সরবরাহের সবচেয়ে সুবিধাজনক পথ ছিল একটি থেকে ম্যাগনেটিক টেপ বা পাঞ্চ কার্ড নিয়ে অন্যটির মধ্যে ঢোকানো। এই প্রতিকূলতা কম্পিউটার বিশারদদের চিন্তিত করে তুলল। এর মধ্যে ছিলেন জে সি আর লিকলিডার ও রবার্ট টেইলর। অন্য সহকর্মীদের মতো তারাও ভাবতে বসলেন কিভাবে কম্পিউটারগুলোর মধ্যে নেটওয়ার্ক সংযোগ স্থাপনের মাধ্যমে এগুলো আরও কার্যকরভাবে ব্যবহার করা যায়।

আরপা নামে একটি প্রতিষ্ঠান এ প্রজেক্টে অর্থের জোগান দেয়। টেইলর ১৯৬৬ সালের ফেব্রুয়ারি মাসে আরপা ডিরেক্টরের অফিসে টাকার জন্য ধরনা দিতে যাওয়ার দিনটিকে আজো স্পষ্টভাবে স্মরণ করতে পারেন। ডিরেক্টরের সঙ্গে তার কথা হয় ১৫/২০ মিনিট। সঙ্গে সঙ্গেই তিনি এই আইডিয়া লুফে নেন, কালবিলম্ব না করে ব্যবস্থা করে দেন এক মিলিয়ন ডলারের। বিজ্ঞানীরা কাজটা গ্রহণ করেছিলেন তীব্র অনুরাগের সঙ্গে। খুব গুরুত্বপূর্ণ একটি ঘটনার জন্ম দিতে যাচ্ছেন এই অনুভূতি তাদের আচ্ছন্ন করে রেখেছিল।

১৯৬৮ সালে লিকলিডার ও টেইলর একটি গবেষণাপত্র প্রকাশ করে জানালেন, কম্পিউটার তথ্য আদান-প্রদানের একটি চমৎকার মাধ্যম হিসেবে ব্যবহৃত হতে পারে। তারা একটি নেটওয়ার্ক তৈরির কাজে আত্মনিয়োগ করলেন, যা সৃষ্টি করবে বৈজ্ঞানিকদের নতুন একটি সংঘ, যারা ভৌগোলিক দিক দিয়ে বিচ্ছিন্ন হয়ে প্রযুক্তিগতভাবে একই সুতায় গাঁথা। প্রাথমিক পরিকল্পনা ছিল চারটি সাইটের মধ্যে সংযোগ স্থাপন; ক্যালিফোর্নিয়া বিশ্ববিদ্যালয়, সান্তা বারবারা বিশ্ববিদ্যালয়, স্ট্যানফোর্ড রিসার্চ ইনস্টিটিউট ও ইউটাই বিশ্ববিদ্যালয়। গ্রাজুয়েট স্টুডেন্ট ভিন্ট সার্ফ, স্টিভ ক্রকার, জন পস্টেলসহ আরও অনেকের ওপর দায়িত্ব পড়েছিল প্রয়োজনীয় সফটওয়্যার ও হার্ডওয়্যার নির্মাণের। তাদের কাজ ছিল নেটওয়ার্ক সাইটগুলোর মধ্যে ডাটা সঞ্চালন করা_ প্রয়োজনীয় তথ্য যাতে নিশ্চিতভাবে সঠিক গন্তব্যে পৌছতে পারে সেদিকে খেয়াল রাখা।

২১ নভেম্বর এলো সেই শুভক্ষণটি। দীর্ঘদিন কঠোর পরিশ্রমের পর অবশেষে গবেষকরা প্রস্তুত হলেন প্রথম আনুষ্ঠানিক ডেমনেস্ট্রেশনের জন্য। একটি কম্পিউটারের সঙ্গে সংযোগ স্থাপিত হলো শত শত মাইল দূরে অবস্থিত স্ট্যানফোর্ড রিসার্চ ইনস্টিটিউটের ডগ এঞ্জেলসবার্টস ল্যাবে রাখা আরেকটি কম্পিউটারের। দুঃখের বিষয়, ওই ঐতিহাসিক মুহূর্তটি ক্যামেরাবন্দী করে রাখার জন্য সেদিন সেখানে কোনো আলোকচিত্রী ছিলেন না।

Wednesday, January 25, 2012

Difference between Hub, Switch, Router, Gateway & Bridge

I always confuse with the terms Hub, Switch & Router. Previously I have cleared the differences after searching in the Internet. After few days, again I forgot the differences. I am not involved in network related works. So this can be the reason behind forgetting the differences again & again. Thus this time I have decided to write it down in my blog so that I can find it anytime.

Hub:
A hub is typically the least expensive, least intelligent, and least complicated of the three. Its job is very simple - anything that comes in one port is sent out to the others.

Switch :
A switch does essentially what a hub does, but more efficiently. By paying attention to the traffic that comes across it, it can "learn" where particular addresses are.

Initially, a switch knows nothing and simply sends on incoming messages to all ports. Even accepting that first message, however, the switch has learned something - it knows on which connection the sender of the message is located. Thus, when machine "A" responds to the message, the switches only need to send that message out to the one connection.

Switches learn the location of the devices that they are connected to almost instantaneously. The net result is that most network traffic only goes where it needs to rather than to every port. On busy networks, this can make the network significantly faster.

Router:
Router is the smartest and most complicated of the bunch. Routers come in all shapes and sizes.A simple way to think of a router is as a computer that can be programmed to understand, possibly manipulate, and route the data that it's being asked to handle. Many routers today are, in fact, little computers dedicated to the task of routing network traffic.

Gateway:
A combination of hardware and software to link two different types of networks. This usually involves converting different protocols. For example, a gateway could be used to convert a TCP/IP packet to a NetWare IPX packet.

Bridge:
A combination of hardware and software to link two similar networks. It often connects LANs that use the same protocol, such as Ethernet. A bridge examines each data packet on a LAN and forwards any data packets addressed to a connected LAN. Bridges are faster than routers because they connect networks that are using the same protocol.

Thursday, November 17, 2011

Why SMS limited to 160 characters?

GSM mobile has a character limit of 256. But network system need 96 characters to send a SMS (Short Message Service). So amount of space available for users is 256-96 = 160. This is why, we can send 160 characters in a SMS and rest of the characters is used by Network System.

Friday, October 7, 2011

Read Bangla Sentence Properly in Websites

During reading a Bangla blog using Mozilla Firefox, I noticed that Bangla sentence was not displaying properly. Thus I was failing to read it smoothly. I have faced this problem many times earlier also.

This was happening because of not having proper font. Use 'Siyam Rupali' font for mozilla to solve the problem. Please follow following steps,
  1. Download 'Siyam Rupali' font from this link, http://www.fonts2u.com/siyam-rupali.font
  2. Paste the 'Siyam Rupali' font in this location, "C:\WINDOWS\Fonts"
  3. Open Mozilla Firefox.
  4. Go to "Tools-> Options->Content"
  5. Select "Siyam Rupali" as Default Font under Fonts & Colors.
  6. Click OK to finish.

Thursday, October 6, 2011

Know more about Hidden Camera

প্রথমেই বলে রাখি গোপন ক্যামেরায় এখন আধুনিক প্রযুক্তি ব্যবহার করা হয়। ফলে আপনার পাশের মানুষটির কলম বা হাতঘড়িতেও থাকতে পারে গোপন ক্যামেরা। বলে রাখা ভাল: বিভ্রান্ত হবেন না। সঠিক তথ্য জানুন:
  • মোবাইল ফোন ব্যবহার করে ক্যামেরা সনাক্তকরন যায় কি? সহজ উত্তর হলো না। মোবাইল ফোনে যে প্রযুক্তি ব্যবহার করা হয় এবং গোপন ক্যামেরার প্রযুক্তি ভিন্ন। ফলে গোপন ক্যামেরা থাকলে মোবাইল নেটোর্য়াক জ্যাম হবার কোন কারন নেই। গোপন ক্যামেরা বসানো যায়গায় আপনি ভালভাবেই মোবাইলে কথা বলতে পারবেন এটি নিশ্চিত ১০০%। সাধারনতভাবে মোবাইল ফোনে GSM-900 এবং GSM-1800 সিগনাল ব্যবহৃত হয়। অন্যদিকে গোপন ক্যামেরাতে ২.৫ গিগা হার্জের এফ সিগনাল ব্যবহার করা হয়, যা মোবাইল সিগনালের চেয়ে ভিন্ন। আর যদি তার দিয়ে (সেটা অপটিক্যাল ফাইবার বে যেকোন ধরনের তার হোক না কেন) গোপন ক্যামেরা ব্যবহার করা হয় তাহলেও ত মোবাইল দিয়ে সনাক্ত কোনভাবেই করা যাবে না।
  •  ডুয়েল মিররের এপাশ থেকে দেখলে এটাকে একটা সাধারণ আয়না ছাড়া কিছুই মনে হবে না। কিন্তু উল্টো পাশ থেকে আয়নার এপাশের সব কিছুই পরিষ্কার দেখায় যায় সাধারণ কাঁচের মতো। এটিও আংগুল চাপাচাপি করে ধরতে পারবেন না। আপনার সান গ্লাস দিয়েই এটি টেস্ট করতে পারেন। সুতরাং অযথা বোকা হবেন না! কেউ কেউ ফেসবুক সহ ব্লগে ব্লগে বিভ্রান্তি ছড়াচ্ছে।
আসুন দেখি কিভাবে চিহ্নিত করতে পারেন গোপন ক্যামেরা, যদিও কাজটি স হজ নয়:-
  1. গোপন ক্যামেরা আছে সন্দেহ হলে, চারপাশ ভাল করে দেখুন। মুলত ছাদের কোনা, দেয়ালের ছবি, ফুলের টব অথবা আয়নার পিছনে বসানো হয় এটি। সুতরাং এই জায়গাগুলি ভাল করে খেয়াল করুন।
  2. সিডি প্লেয়ার বা এজাতীয় বস্তুতেও বাসনো হয়। মুলত রুমের অন্ধকার এলাকা গুলিতে গোপন ক্যামেরা বসানো হয়, যাতে আলোকিত এলাকার ছবি ভাল মত আসে।
  3. রুম পুরোটা অন্ধকার করে কিছু সময় নিন, যাতে করে চোখ অন্ধকারকে সয়ে যায়। এবার খুব ভাল করে দেখুন ...লাল, সবুজ বা হালকা নীল কোন আলো কোথা থেকে বের হচ্ছে কিনা খেয়াল করুন। যদি খুজে পান তবে ধরে নিতে পারেন সেটা ক্যামেরা।
  4. এটি একটি পুরানা পদ্ধতি তবে অনেক সময় কাজে লাগে,,, রুমের সকল তার গুলি খেয়াল করুন, কোন তার কোথায় গেছে সেটি বুঝার চেস্টা করুন। তার গুলির মাঝে যদি একটি তার বিশেষ কোন কোনায় চলে যায় বা এরকম সন্দেহ করেন তবে তার গন্তব্য এর শেষ টা দেখুন, পাইলেও পাইতে পারেন.....
  5. অনেক ক্যামেরাতে "মোশনডিটেক্টর" থাকে। মানে হলো আপনি রুমের যেদিকে যাবেন ক্যামেরার লেন্স অটোমেটিক সেই দিকে ঘুরে যাবে। আপনি রুম অন্ধকার করে একটি সময় নিন। এরপর খুব সাবধানে শব্ধ না করে রুমের এদিক থেক ওদিক যান। কান খাড়া করে কোন শব্দ পান কিনা খেয়াল করুন। আপনার নড়াচড়ার সাথে সাথে যদি হালকা লেন্স ঘুড়ার শব্দ পান তবেই বুঝবেন কাম হয়ে গেছে....
  6. অতি আধুনিক কিছু যন্ত্রপাতি পাওয়া যায় , যা গোপন ক্যামেরা সনাক্ত করতে পারে। সেগুলি মুলত চীনের তৈরি, কম দামে নেট হতে কিনতে পারেন, যদি আপনি খুব বেশি ঘুড়াঘুরি করেন বা গোপন ক্যামেরার ভয় পান, না হলে কিনার দরকার নেই, নিজেই বানাতে পারেন সেটা। বলছি .......একটি সাদা কাগজ বা এ জাতীয় যে কোন কিছু নিন, না পেলে টয়লেট পেপারের ভিতর যে রোলটা থাকে সেটাও নিতে পারেন। সোজা কথায় কাগজ বা নিউজপেপার যাই হোক গোল করে বাইনোকুলার বা দুরবীনের মত করুন। বলতে ভুলে গেছি একটি টর্চলাইট লাগবে, মোড়ের দোকানেই পাবেন ছোট টর্চলাইট দামও বেশি না।.........এবার ঘরের সব লাইট বন্ধ করে টর্চ লাইট টি জালান। যে জায়গায় টর্চের আলো ফেলবেন ঠিক সেই জায়গাটি রোল বা গোল করা কাগজের মধ্য দিয়ে এক চোখ দিয়ে তাকান। এভাবে সারা রুমটি খোজ করুন। সময় লাগবে প্রায় ৩০ মিনিট। যদি গোপন ক্যামেরা থাকে তবে টর্চের আলো ক্যামেরার ছোট লেন্সের উপর পরলে সেটা চিক চিক করবে ফলে আপনি যখন রোল করা কাগজের মধ্য দিয়ে দেখবেন তখন অনেকটা স হজেই চিনতে পারবেন। এব্যাপারে অভিগ্গ হতে চাইলে আপনার ডিজিট্যাল ক্যামেরাটি ঘরের ভিতর যেকোন জায়গায় চালু করুন বা লুকিয়ে ফেলুন, এর পর টর্চ আর রোল করা কাগজ দিয়ে চেস্টা করুন লুকানো ক্যামেরাটি বের করতে পারেন না, যদি পারেন তবে আপনি পারবেন,,,আপনার দ্বারাই হবে ....
আধুনিক প্রযুক্তি মানেই নতুন কিছু , নতুন ঝামেলাও বটে। শেষে বলি একটি কথা আপনার পরিচিত কেউ হতে পারেন গোপন ক্যামেরার শিকার। যদি সেটি ঘটেই যায়, তবে হই হট্টোগল করে পানি ঘোলা করবেন না। যার ছবি উঠেছে বা প্রকাশ পেয়েছে তার সাথে স্বাভাবিক আচরন করুন, কারন এতে উনার তো দোষ নেই। উনাকে স্বাভাবিক জীবন যাপন করতে দিন। ভাল থাকুন। শুভ কামনা
 Source: Book and Internet

Thursday, September 15, 2011

9 Best Practices in Software Management

  1. Formal Risk Management
  2. Agreement on Interfaces
  3. Formal Inspections
  4. Metric-Based Scheduling and management.
  5. Binary Quality Gates at the Inch-Pebble Level.
  6. Program-Wide Visibility of Progress versus Plan
  7. Defect Tracking Against Quality Targets
  8. Configuration Management
  9. People-Aware Management accountability.
Source: Software Project Management by Barry W. Boehm

Top 10 Software Management Principles

  1. Base the process on an architecture-first approach.
  2. Establish an iterative life-cycle process that confronts risk early.
  3. Transition design methods to emphasize component-based development.
  4. Establish a change management environment.
  5. Enhance change freedom through tools that supports round-trip engineering.
  6. Capture design artifacts in rigorous, model-based notation.
  7. Instrument the process for objective quality control and progress assessment.
  8. Use a demonstration-based approach.
  9. Plan intermediate releases in groups of usage scenarios with evolving levels of detail.
  10. Establish a configurable process that is economically scalable.
Source: Software Project Management by Barry W. Boehm

Conventional Work Breakdown Structures (WBS) in Software Project Management

Conventional work breakdown structures frequently suffer from three fundamental flaws.
  1. They are prematurely structured around the product design.
  2. They are prematurely decomposed, planned and budgeted in either too much or too little detail.
  3. They are project specific and cross-project comparisons are usually difficult or impossible.
Source: Software Project Management by Barry W. Boehm

Tuesday, August 16, 2011

Enterprise Design Pattern

Design patterns which are used mostly for Enterprise Application Architecture areknown as Enterprise Design Pattern.Enterprise Design patterns are introduced in Core J2EE Patterns, the patterns deal with presentation, and application logic.

Examples of Enterprise Design Pattern:

Base Patterns
  • Command: An object encapsulates everything needed to execute a method in another object
  • Registry: This pattern is useful for making data available to all classes in a process.Through careful use of serialization, it can also be used to store information across a session or even across instances of an application.
Web Presentation Patterns:
  • Front Controller: A controller that handles all requests for a Web site.
  • Application Controller: A centralized point for handling screen navigation and the flow of an application
  • Template View: Renders information into HTML by embedding markers in an HTML page.
  • Page Controller: An object that handles a request for a specific page or action on a Web site. Lighter weight but less flexible than Front Controller, Page Controller addresses the same need. Use this pattern to manage requests and handle view logic if you want fast results and your system is unlikely to grow substantially in complexity.
Domain Logic Patterns
  • Transaction Script: When you want to get things done fast, with minimal up-front planning, fall back on procedural library code for your application logic. This pattern does not scale well. This pattern Organizes business logic by procedures where each procedure handles a single request from the presentation.
  • Domain Model: An object model of the domain that incorporates both behavior and data.
Source: From lecture notes of Design and Development Open Multi-tier Application

Friday, August 12, 2011

Solution of CakePHP Notices: Please change the value of 'Security.salt' and 'Security.cipherSeed'

I have seen following notices during using CakePHP,
  • Notice (1024): Please change the value of 'Security.salt' in app/Config/core.php to a salt value specific to your application [CORE\Cake\Utility\Debugger.php, line 657]
  • Notice (1024): Please change the value of 'Security.cipherSeed' in app/Config/core.php to a numeric (digits only) seed value specific to your application [CORE\Cake\Utility\Debugger.php, line 661]
This error is generating, because your application doesn't have the same security seed out of million of other installations. So this is a serious security problem. So follow the following steps to solve the issue,
  1. Open this file, 'YourProjectName/app/config/core.php'
  2. Find this two words, 'Security.salt' and 'Security.cipherSeed'
  3. Replace this two words with some random characters.
  4. Save core.php

Thursday, August 4, 2011

How to use IIS and XAMPP together

I have IIS setup in my PC which use 80 port by default. Today I have installed XAMPP in my PC so that I can do both ASP and PHP programming together. But I have seen that Apache is not running. Thus I am failing to run php files. This is happening, because Apache server also use 80 port. IIS is using the same port, so Apache server will not work in this port. So I have to set Apache server in other port (8080) so that it can run properly. To change the port, please follow the following steps,

1/ Change to this file, C:\xampp\apache\conf\httpd.conf
  • Find "Listen 80" and replace with "Listen 8080"
  • Find "ServerName localhost:80" and replace with "ServerName localhost:8080"
2/ Change to this file, C:\xampp\apache\conf\extra\httpd-ssl.conf
  • Find "Listen 443" and replace with "Listen 4499"
  • Find "ServerName localhost:443" and replace with "ServerName localhost:4499"
Now you will be able to use both server together using following URL,
  • IIS Server: http://localhost/YourProjectName/
  • Apche Server: http://localhost:8080/YourProjectName/

Wednesday, August 3, 2011

5 basic improvement parameters of software cost model

Five basic improvement parameters of software cost model are,
  1. Reducing the size or complexity of what needs to be developed
  2. Improving the development process.
  3. Using more-skilled personnel and better terms (not necessarily the same thing)
  4. Using better environment (tools to automate the process)
  5. Trading off or backing off on quality thresholds
Source: Software Project Management by Barry W. Boehm

Sunday, July 31, 2011

Dependency Injection Pattern using PHP

Behavioral Pattern – It is a technique that indicates to a part of a program which other parts it can use, i.e. to supply an external dependency, or reference, to a software component.

In technical terms, it is a design pattern that separates behavior from dependency resolution, thus decoupling highly dependent components.

// User.php
<?php
include_once('Database.php');
/**
 * Establishes a database connection and utilizes a singleton pattern
 * implementation to ensure only one instance exists during execution
 */
class User
{
    public function dbTask($db)
    {       
        $query = "SELECT name, age FROM student ";                       
        $result = $db->getQueryResult($query );
       
        while($thisrow = mysql_fetch_row($result))
        {
              $i=0;
              while ($i < mysql_num_fields($result))
              {
                $field_name = mysql_fetch_field($result, $i);
                echo $thisrow[$i] . " ";  //Display all the fields on one line
                $i++;
              }
            echo "<br>";  //put a break after each database entry
        }
    }
}
?>

// Calling.php
<?php
include_once('noUser.php');
// User and db is loosely coupled and dependency injected here between them
echo "Dependency Injection is applied"."<br><br>";
$user = new User();
$db = Database::getInstance();
$user->dbTask($db);
?>
Source: From lecture notes of Design and Development Open Multi-tier Application 

Registry Design Pattern example using PHP

It's a bhavioral Pattern – It’s generally considered “good form” to avoid the use of global variables, objects are usually passed from one code segment to another as parameters.

The problem with passing instances globally is that objects sometimes end up as “tramp data,” passed into one function only to be passed again to another function which truly needs the object. To make writing, reading, and consuming code simpler, it’s best to minimize the number of different objects and consolidate knowledge of how to get to a numerous of other widely-used objects into a single, well-known object.

How can you get references to objects through a single, well-known, object? The Registry design pattern is like an “object phone book”—a directory—that stores and retrieves references to objects.

The Registry pattern can be useful, for example, if, for the bulk of your application, you use the same database connection, but need to connect to an alternate database to perform a small set of tasks every now and then. If your DB class is implemented as a Singleton, this is impossible (unless you implement two separate classes, that is)—but a Registry makes it very easy:

<?php

class Profile {    
  protected $_address1;
  protected $_address2;
  protected $_city;
  protected $_state;
  protected $_zip;
  protected $_phone;
  protected $_fax;
   
  public function __construct() {
       
  }
   
  public function address1($address = NULL) {
    if(isset($address)) {
      if(!is_string($address)) throw new ProfileEx(__METHOD__.' expects a string parameter.');
      $this->_address1 = $address;
    } else {
      return $this->_address1;
    }       
  }
   
  public function address2($address = NULL) {
    if(isset($address)) {
      if(!is_string($address)) throw new ProfileEx(__METHOD__.' expects a string parameter.');
      $this->_address2 = $address;
    } else {
      return $this->_address2;
    }
  }
   
  public function city($city = NULL) {
    if(isset($city)) {
      if(!is_string($city)) throw new ProfileEx(__METHOD__.' expects a string parameter.');
      $this->_city = $city;
    } else {
      return $this->_city;
    }
  }
   
  public function state($state = NULL) {
    if(isset($state)) {
      if(!is_string($state)) throw new ProfileEx(__METHOD__.' expects a string parameter.');
      $this->_state = $state;
    } else {
      return $this->_state;
    }
  }
   
  public function zip($zip = NULL) {
    if(isset($zip)) {
      if(!is_string($zip)) throw new ProfileEx(__METHOD__.' expects a string parameter.');
      $this->_zip = $zip;
    } else {
      return $this->_zip;
    }
  }
   
  public function phone($phone = NULL) {
    if(isset($phone)) {
      if(!is_string($phone)) throw new ProfileEx(__METHOD__.' expects a string parameter.');
      $this->_phone = $phone;
    } else {
      return $this->_phone;
    }
  }    
  public function fax($fax = NULL) {
    if(isset($fax)) {
      if(!is_string($fax)) throw new ProfileEx(__METHOD__.' expects a string parameter.');
      $this->_fax = $fax;
    } else {
      return $this->_fax;
    }
  }
   
}
?> 
Source: From lecture notes of Design and Development Open Multi-tier Application 

Tuesday, July 26, 2011

5 characteristics of a successful object-oriented software project

5 characteristics of a successful object-oriented software project are,
  1. A ruthless focus on the development of a system that provides a well understood collection of essential minimal characteristics.
  2. The existence of a culture that is centered on results, encourages communication, and yet is not afraid to fail.
  3. The effective use of object oriented modeling
  4. The existence of a strong architectural vision.
  5. The application of a well-managed iterative and incremental development life cycle.
Source: Software Project Management by Barry W. Boehm

Thursday, July 14, 2011

Adaptor Design Pattern example using PHP

Adapters are used to enable objects with different interfaces to communicate with each other.Convert the interface of a class into another interface clients expect. It is useful when we upgrade system

<?php
//SimpleBook.php copyright Lawrence Truett and FluffyCat.com 2006, all rights reserved
 
class SimpleBook
{
     private $author;
     private $title;
     function __construct($author_in, $title_in) {
        $this->author = $author_in;
        $this->title  = $title_in;
    }
    function getAuthor() {return $this->author;}
    function getTitle() {return $this->title;}
}
?>

<?php
//BookAdapter.php copyright Lawrence Truett and FluffyCat.com 2006, all rights reserved
include_once('SimpleBook.php');

class BookAdapter
{
    private $book;
    function __construct(SimpleBook $book_in) {
      $this->book = $book_in;
    }
    function getAuthorAndTitle() {
      return $this->book->getTitle() . ' by ' . $this->book->getAuthor();
    }
}
?>

<?php
//testAdapter.php copyright Lawrence Truett and FluffyCat.com 2006, all rights reserved
include_once('SimpleBook.php');
include_once('BookAdapter.php');

define('BR', '<'.'BR'.'>');
echo 'BEGIN TESTING ADAPTER PATTERN'.BR;
echo BR;

$book = new SimpleBook("Gamma, Helm, Johnson, and Vlissides","Design Patterns");
$bookAdapter = new BookAdapter($book);
echo 'Author and Title: '.$bookAdapter->getAuthorAndTitle();
echo BR.BR;
echo 'END TESTING ADAPTER PATTERN'.BR;
?>

Source: From lecture notes of Design and Development Open Multi-tier Application 

Singleton Design Pattern example using Java

Creational Pattern- Ensure a class only has one instance, and provide a global point of access to it.Sometimes we want just a single instance of a class to exist in the system. For example, we want just one window manager. And we want to ensure that additional instances of the class cannot be created.
  • Normally when you have a class and you create many instances of it then you get many objects.
  • But in the case of singleton design pattern we get one instantiated object for many calls of getInstance() method instead of new.
  • Example of Singleton Design pattern is implemented in the following database class. Note that it private constructor. Only getInstance() method is used to create single instance of the class.
public class Database
{
    private static Database singleObject;
    private int record;
    private String name;

    private Database(String n) // Note private
    {
        name = n;
        record = 0;
    }
    public static Database getInstance(String n) //instantiation
    {
        if (singleObject == null){
            singleObject = new Database(n);
        }
        return singleObject;
    }
    public void editRecord(String operation)
    {
        System.out.println("Performing a " + operation + " operation on record " + record + " in database " + name);
    }
    public String getName()
    {
        return name;
    }
}
public class TestSingleton
{
    public static void main(String args[])
    {
        Database database;
        database = Database.getInstance("products");
        System.out.println("This is the " + database.getName() + " databse.");
        database = Database.getInstance("employees");
        System.out.println("This is the " + database.getName() + " databse.");
    }
}

Source:  From lecture notes of Design and Development Open Multi-tier Application 

Tuesday, July 12, 2011

Observer Design Pattern example using PHP

The observer pattern is a software design pattern in which an object (called the subject object) maintains a list of its dependents (called observers) and notifies them automatically of any state changes, usually by calling one of their methods. It is mainly used to implement distributed event handling systems.
  • The Observer pattern defines an one-to-many dependency between a subject object and any number of observer objects so that when the subject object changes state, all its observer objects are notified and updated automatically.
  • The Observer pattern essentially allows an unlimited number of objects to observe or listen to events in the observed object (or subject) by registering themselves. After observers are registered to an event, the subject will notify them when the event is fired.
  • The subject handles this by storing an observer collection and iterating through it when the event occurs in order to notify each observer.
  • Observer Pattern registers observers with a subject.
  • You might have multiple observers. Subject must keep a list of registered observers and when event occurs it fires (provides notification) all registered observers.
  • Unregister also possible when we do not need any observer.

Example using Observer Design Pattern:
<?php
interface IObserver {
    function onChanged($sender, $args);
}

interface IObservable {
    function addObserver($observer);
}

class UserList implements IObservable {
    private $_observers = array();

    public function addCustomer($name) {
        foreach( $this->_observers as $obs )          
            $obs->onChanged( $this, $name );
        }
   
    public function addObserver( $observer ) {
        $this->_observers []= $observer;
    }
}

class UserListLogger implements IObserver {       
   
    public function onChanged( $sender, $args ) {
        echo( "'$args' notifies  UserListLogger <br>" );           
    }
}

class AuditLogger implements IObserver {
   
    public function onChanged( $sender, $args ) {
        echo( "'$args' notifies  AuditLogger <br>" );       
    }
}

$ul = new UserList();
$ul->addObserver(new UserListLogger() );
$ul->addObserver(new AuditLogger() );

$ul->addCustomer("Jack" );
$ul->addCustomer("John" );
?>

Source:  From lecture notes of Design and Development Open Multi-tier Application

Friday, July 8, 2011

Software economics and cost models

Most software cost models can be abstracted into a function of 5 parameters. They are,
  1. Size - It's indicate number of source instructions or the number of function points required to develop the functionality.
  2. Process - It used to produce the end product, in particular the ability of the process to avoid rework, bureaucratic delays and communications overhead.
  3. Personnel - Indicate the capabilities of software engineering personnel.
  4. Environment - Indicate the tools and techniques available to develop the software.
  5. Quality - It's indicate quality of the software including its features, performance, reliability, and adaptability.
Effort = (Personnel)(Environment)(Quality)(Size^Process)
Source: Software Project Management by Barry W. Boehm