Thursday 29 August 2013

TDD and BDD

Why is Behaviour Driven Development better than Test Driven Development? Why should I switch to BDD?”

Well BDD focuses on specifying what will happen next. where as TDD focuses on setting up a set of conditions and then looking at the output. 

BDD

Behaviour driven development comes from TDD and focuses more on the expected/desired behaviour of your application and using this to drive your design and development process. Generally BDD focuses on obtaining a clear understanding of desired software behaviour through discussion with stakeholders. It extends TDD by writing test cases in a natural language that non-programmers can read. Behaviour-driven developers use their native language in combination with the ubiquitous language of domain driven design to describe the purpose and benefit of their code. This allows the developers to focus on why the code should be created, rather than the technical details, and minimizes translation between the technical language in which the code is written and the domain language spoken by the business, users, stakeholders, project management, etc.
BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.

TDD

Test Driven Development is all about writing tests first. This basically forces you to write your own client before you write your application code. The cycle is generally write a test for an API that doesn’t exist, run the test expecting it to fail, go write your API code, run your test again and make sure it passes. Then write your next test… and so on.
Once the test passes, observe the resulting design and refractor to remove any duplication you see. It is natural at this point to judge the design as too simple to handle all of the responsibilities this code will have.

If person adhere more strongly to TDD principles he spend less time reworking later. The amount of time spent is all in how well you write unit tests though. If the unit tests don’t capture the expected behaviour, all the time spent on them is wasted.

Differences between BDD and TDD

1) BDD focuses on specifying what will happen next. where as TDD focuses on setting up a set of conditions and then looking at the output.

2) BDD specifies behaviours while TDD specifies outcomes.

3) BDD can be layered, while outcomes(TDD) cannot.

4) TDD is for testing and we can't perform Design process, Requirements capturing and Behaviour specification in TDD, but these can be possible in BDD.

5) BDD is mainly used as a communication tool. its main goal is to write executable specifications which can be understood by the domain experts.

The main difference between BDD and TDD is wording. as these are important for communicating your intend.

Getting Started with Ruby 2 and Rails 4


If you are new to Rails then you will might want to check out my other post basic installation packages as the following steps will assume a similar setup.

Installing Ruby 2
  • Ruby 2 is the latest stable version to start working with it.
  • rvm install ruby-2.0.0
  • rvm list
  • rvm use ruby-2.0.0-p247
Installing Rails 4

Before installing a new version of Rails, I like to switch to a new RVM gemset. If you're not using RVM, don't worry about this step. 
A Best Rails 4 Book to start with
$ rvm use @rails4 --create
Installing Rails 4 is as easy as it ever way, just use gem install.
            gem install rails -v=4.0.0.rc2
Rails 4 is now the latest stable release so it's much easier to get going with it. 
Once the gem installer has done it's thing you can now check the Rails version withrails -v and start a new project in the usual way.








How to create a Rails 3 project with Rails 4 installed
With Rails 4 now taking priority over Rails 3 in your gem list how do you make a new Rails 3.2 project without going through the hassle of uninstalling Rails 4.
Simple really, check the versions of Rails you have installed already with gem list rails.
*** LOCAL GEMS ***
rails (4.0.0, 3.2.13)
The output shows I have the Rails 4.0.0 and 3.2.13 installed and you can simply append that version number to your rails command like so.
rails _3.2.13_ new myproject
This will create a project in the usual way but this time using the 3.2.13 version of the gem.
Don't forget that you should use bundle exec within your project when callingrails generate and friends so that the correct gem version according to the projects Gemfile is used. For example: bundle exec rails generate model User.

Friday 16 August 2013

What is the difference between include and extend in Ruby?

Okay  !!!!
Now let me describe the difference between include and extend in Ruby. This question is quite similar to my previous blog topic.

Include: When you Include a module into your class, it’s as if you took the code defined within the module and inserted it within the class, where you ‘include’ it. It allows the ‘mixin’ behavior. It’s used to DRY up your code to avoid duplication, for instance, if there were multiple classes that would need the same code within the module.
The following assumes that the module Log and class TestClass are defined in the same .rb file. If they were in separate files, then ‘load’ or ‘require’ must be used to let the class know about the module you’ve defined.

Extend: When using the extend method instead of include, you are adding the module’s methods as class methods instead of as instance methods. When using extend instead of include within the class, if you try to instantiate TestClass and call method class_type on it, as you did in the Include example above, you’ll get a NoMethodError. So, again, the module’s methods become available as class methods.

Thank you :)
keep visiting.

What is the difference between include and require in Ruby

Many questions may be arise in the mind of a beginner whenever He/She steps to the real Work field.
Like:  
What's the difference between require and include in Ruby? If I just want to use the methods from a module in my class, should I require it or include it?

Let me describe it in details. I am also new to this field and I have collected it from different resources. If you have any more Information regarding this then please do mention in the comment box.

The include and require methods do very different things.
The require method does what include does in most other programming languages: run another file. It also tracks what you've required in the past and won't require the same file twice. To run another file without this added functionality, you can use the load method.

The include method takes all the methods from another module and includes them into the current module. This is a language-level thing as opposed to a file-level thing as with require. The include method is the primary way to "extend" classes with other modules (usually referred to as mix-ins). For example, if your class defines the method "each", you can include the mixin module Enumerable and it can act as a collection. This can be confusing as the include verb is used very differently in other languages.

So if you just want to use a module, rather than extend it or do a mix-in, then you'll want to use require.
Oddly enough, Ruby's require is analogous to C's include, while Ruby's include is almost nothing like C's include.

The require() method is quite similar to load(), but it’s meant for a different purpose. You use load() to execute code, and you use require() to import libraries.

You may also found this helpful. There I have explained the difference between include and extend in Ruby.

Friday 9 August 2013

First 'electric' road charges buses in S Korea

SEOUL: In a first, South Korea has developed a hi-tech 'electrified' road which can recharge moving electric vehicles as they drive over it. 

Project developers claim that the 12 kilometre route is the first of its kind in the world and allows electric public buses to recharge their batteries from buried cables as they travel. The Online Electric Vehicle (OLEV) is an electric vehicle that can be charged while stationary or driving, thus removing the need to stop at a charging station, researchers said. 

OLEV, developed by the Korea Advanced Institute of Science and Technology (KAIST), does not require pantographs to feed power from electric wires strung above the tram route. 

Two OLEV buses run in an inner city route between Gumi Train Station and Indong district, for a total of 24km roundtrip. 

The bus receives 20 kHz and 100 kW (136 horsepower) electricity at an 85 per cent maximum power transmission efficiency rate while maintaining a 17cm air gap between the underbody of the vehicle and the road surface. OLEV receives power wirelessly through the application of the Shaped Magnetic Field in Resonance (SMFIR) technology. 

SMFIR is a new technology that enables electric vehicles to transfer electricity wirelessly from the road surface while moving. 

Power comes from the electrical cables buried under the surface of the road, creating magnetic fields. There is a receiving device installed on the underbody of the OLEV that converts these fields into electricity. 

The length of power strips installed under the road is generally 5-15 per cent of the entire road, requiring only a few sections of the road to be rebuilt with the embedded cables. 

The road has a smart function as well, to distinguish OLEV buses from regular cars - the segment technology is employed to control the power supply by switching on the power strip when OLEV buses pass along, but switching it off for other vehicles, researchers said. 

"This is certainly a turning point for OLEV to become more commercialized and widely accepted for mass transportation in our daily living," Dong-Ho Cho, a professor of the electrical engineering at KAIST, said. 

Source: Times of India

Tuesday 6 August 2013

What is the Technology works behind the tilt function in Android Apps/ Games


How Does it Exactly Works?
A great Android experience starts with a great App or game. And the Crazy and Exciting features implemented in all those Android apps provide a great experience to all the users. And the features like tilt screen, blow up etc and other motion gestures are making the user more exciting to stick with a particular game for long time. Let me tell what is this tilt function exactly and how it works.



How these motion gestures exactly works?
Generally Accelerometer works behind every smart phone to make the user experience more wild and juiced up. Then what this Accelerometer exactly is?  accelerometer is a device that detects its own acceleration and is used in mobile phones to determine the phone's orientation. Once the orientation is determined, the phone's software can react accordingly, such as by changing its display from portrait to landscape. Accelerometers are designed to detect changes in force resulting from fall, tilt, motion, positioning, shock and vibration. 
An accelerometer is able to detect acceleration through a micro-electromechanical system (MEMS), which changes electrical properties such as voltage. These changes are translated into signals, which are sent to the appropriate software for processing.

There are different types of accelerometers used in phoneses:
Piezoelectric Accelerometer: This device relies on the natural structures of piezoelectric crystals, which react to forces exerted on the phone by generating an electrical charge, which subsequently creates a voltage.
Micro-electromechanical System (MEMS): These are tiny mechanical structures that change when forces are applied to them, subsequently changing an electrical property.
Capacitive Accelerometer: This device is a kind of MEMS. A net force applied to the mechanical system results in a change in the system’s capacitance.
A typical mobile device has an accelerometer that can detect acceleration on two or three axes, allowing it to sense motion and orientation. A three-dimensional accelerometer can calculate pitch and roll and can be used in flight or driving simulation applications.


Accelerometers consume a lot of energy, so they should be turned off when they are not being used to avoid draining a device's battery.
(Turbofly Game: Fully works on Motion Sensor a Best Example)


Hello Friends, I really appreciate your valuable Suggestions and Comments on my each Posts. Please do post and help me to make quality posts. You can also check my posts What is the technology Works behind Skype, What is the technology works behind messaging services like WhatsApp.


Monday 5 August 2013

What is the Technology works behind Whatsapp

What is whatsapp and How does it works?
       People are becoming technology oriented day by day. it's became easier to communicate with family and friends rather than calling them or visiting them personally. And today's youngsters are mostly acquainted with this latest technologies. And generally mobile based hangout applications like whatsapp, wechat, nimbuzz, ebuddy etc serve this purpose very well. And today WhatsApp is a very popular app for most smartphones that allows users to replace their expensive SMS service with free texting locally and world wide as this app focuses on sharing text and multimedia messages. It works on all smartphone models with different platforms like iphone, Android phones, BlackBerry, Nokia and Windows phones.


      Like many other software, this application is internet based. This application once installed creates a user account in database. After that it accessess the phone book and synchronises it with its own database making it easier for the user to connect with their contacts those who have accounts on WhatsApp.


What is the Technology behind WhatsApp?


        WhatsApp uses a customised version of the open standard Extensible Messaging and Presence Protocol (XMPP) upon installation. WhatsApp automatically compares all the phone numbers from the device's address book with its central database of WhatsApp users to automatically compares all the phone numbers from the devices address book with its central database of WhatsApp users to automatically add contacts to the users WhatsApp contact list. 



What is Extendible Messaging and Presence Protocol (XMPP) ?

         The Extensible Messaging and Presence Protocol (XMPP) is an application profile of the Extensible Markup Language (XML) for streaming XML data in close to real time between any two or more network-aware entities. The address format for XMPP entities was originally developed in the Jabber Open Source Community in 1999. It functions between or among servers, and facilitates near-real-time operation. The Protocol may eventually allow internet users to send instant messages to anyone else on the Internet, regardless of differences in Operating systems and browsers. 

XMPP is sometimes called the Jabber protocol, but this is a technical misnomer. Jabber, an IM application similar to ICQ (I Seek You) and others, is based on XMPP, but there are many applications besides Jabber that are supported by XMPP. The IEEE XMPP working group, a consortium of engineers and programmers, is adapting XMPP for use as an Internet Engineering Task Force (IETF) technology. In addition, the Messaging and Presence Interoperability Consortium (MPIC) is considering XMPP as an important interoperability technology. Eventually, XMPP is expected to support IM applications with authentication, access control, a high measure of privacy, hop-by-hop encryption, end-to-end encryption, and compatibility with other protocols.
Hope you like it. You can also check  What is the Technology works behind skype

Sunday 4 August 2013

What is the Technology works behind skype

How does skype technology Works?
In this Technically Advanced World so many technologies being implemented each and every day to make the life and style more simplified. Few years ago, most peoples still had to rely on obscenely expensive mobile and Public Switched Telephone networks to carry their voice over short and long distances. But Today almost everyone seems to be using one way or another VoIP. And today Skype like many other VoIP clients has changed the way we think about communication and keeping in touch with loved ones over long distances. So here VoIP is the technology how exactly Skype works. 
      The technology used behind Skype is Voice over Internet Protocol. This system allows the call to be carried over an Internet connection rather than a phone line. Unlike a phone service, the Internet doesn't cost more to transfer data around the world.  






What is VOIP and how it works?

Voice over Internet Protocol (VOIP) is a methodology and a group of technologies for the delivery of voice communications and multimedia sessions over internet protocol (IP) networks, such as Internet. Other terms commonly associated with VoIP are IP telephony, Internet telephony, Broadband telephony, IP Communications and Broadband phone service. VOIP simply converts the sound of your voice(and the picture with video calls) into computer data. It reduces the quality of the audio to reduce the data demands. This works in the same way as music file formats such as mp3(where the audio is reduced in quality but not to the point that most callers will notice).

      VoIP owes its versatility to another fantastic technology, the Internet. Instead of sending signals via a PSTN network, be it analog or digital, a VoIP application usually uses SIP (a variation of the standard TCP/IP protocols) to create data packets, and sends them on the same network you use for email and web surfing.
By using data packets, the technology can be used to carry more than the standard mono voice your old telephone does; VoIP can carry text, images, live video and high quality stereo sound as well as ‘screen sharing’, depending on the speed and reliability of your internet connection.
      Skype doesn't use direct connections. When two people speak on Skype, the data doesn't run straight from one caller's device to the other. In fact, it doesn't simply run from one caller to Skype and then from Skype to the receiver of the call. All computers logged in to Skype are connected in a peer-to-peer network, which runs in the same way as those used for both legal and illegal file sharing. Whenever you make a call, the data is routed through a combination of Skype users' computers to find the most efficient path. As a result, Skype itself drastically reduces the amount of data flowing into and out of its own equipment, cutting its costs.

I will update more on different technologies used behind those tools and apps we are using in our daily life along with many other technical stuffs. Keep visiting. And yes, don't forget to give your valuable comments/feedbacks/suggestions. I can only write more useful and quality articles if you guys co-ordinate with me.




Friday 2 August 2013

Some Legend's in the Computer Industry

  • Sabeer Bhatia borned in Chandigarh, India and co-founded first free email service site Hotmail.com with Jack Smith.
  • Tim Berners-Lee is the inventor of the World Wide Web and Director of the World Wide Web Consortium (W3C).
  • Larry Page is co-founder of the Google internet search engine, now Google Inc.
  • Sergey Brin is co-founder of the Google internet search engine, now Google Inc. He co-founded google with Larry Page.
  • Charles Babbage is known as the father of computer.
  • Larry Wall is the inventor of Perl, rn,patch, and many other wonderful things. He is the language designer for Perl 6, and has staked out the perl5 to perl6 translator as his own project.
  • Rasmus Lerdorf is father of PHP.Here is Rasmus pictured in the ship's exotic Greek ballroom at the conclusion of an hour's question and answer session.
  • James Gosling is a famous software developer, best known as the father of the Java programming language.
  • Dennis Ritchie is an American computer scientist notable for his influence on ALTRAN, B, BCPL, C, Multics, and Unix.
  • Bjarne Stroustrup designed and implemented the C++ programming language. He is the College of Engineering Professor in Computer Science at Texas A&M University.
  • Bill Gates founded Microsoft with Paul Allen
  • Michael Dell Michael Saul Dell (born February 23, 1965, in Houston, Texas) is an American businessman and the founder and CEO of Dell, Inc.
  • Mark Elliot Zuckerberg Mark Elliot Zuckerberg co-founding Facebook in 2004; world's 2nd youngest self-made billionaire (2012)

Thursday 1 August 2013

Installation of Seagull Framework

Hey Friends Have you ever heared about this Framework?
Seagull is a mature OOP framework for building web, command line and GUI applications. Licensed under BSD, the project allows PHP developers to easily integrate and manage code resources, and build complex applications quickly. If you are really interested to do something new then here is the seagull installation procedure. Check it out. 
Requirements for Seagull
PHP: PHP 4.3.0 is the minimum, later versions works fine. like PHP 5.1.1 and above. Avoid anything in the 5.0.x series.
MySQl: MySQL 4.0.x, 4.1.x and 5.0.x are all supported. can also be used 3.23.x.
Apache: Seagull works fine with 1.3.x and 2.x series of Apache.

Download Seagull
http://seagullproject.org/download/

Installation of Seagull

http://trac.seagullproject.org/wiki/Installation

During the time of installation I have faced so many problems in PHP version.
To make it to support properly there need to do some changes in a file.

http://bugs.mysql.com/bug.php?id=59288  

'TYPE' is depreciated. So need to change that by replacing it with 'ENGINE'.
In the downloaded folder we can find a file named schema.my.sql inside 
modules/user/data folder. 
 
After making the above mentioned changes you will be able to see the admin page with a 
successfully installation message.

http://demo.seagullproject.org/

I have taken help of Demian Turner who is the creater of this framework by joinning him on his
google groups network. http://groups.google.com/group/seagull_general/
 
Join this group. And start working with Seagull.. Happy Coding  :)