hasan's blog (বল্গ)

work for fun!!!

Archive for the ‘tools’ Category

what killed my time to run my first test using “cucumber”

without comments

stucked with “No such file or directory – cucumber.yml” error?
then you must doing the same mistake as i was doing for last 1 hour.

i had the following code in Rakefile

require ‘cucumber/rake/task’

Cucumber::Rake::Task.new do |t|
profile = ENV['PROFILE'] || ‘default’
t.cucumber_opts = “–profile #{profile}”
end

the fix is just keep the following code only -

require ‘cucumber/rake/task’

Cucumber::Rake::Task.new do |t|
end

so are you still facing problem while you are executing “rake features” but it doesn’t come up with any output?
here is the check list – (this list may grow gradually) -
1. do you have features directory
2. do you have features/steps directory
3. lets say you have “features/transfer.feature” file do you know that you must have “features/steps/transfer_steps.rb” file?
4. do you know “feature name” must be prefixed for steps file?
hope this might help you.

Written by nhm tanveer hossain khan

October 19, 2008 at 6:12 pm

Posted in BDD, Ruby, tools

refactormycode.com the best place to Refactor :your => ‘code’

without comments

i must start with saying “WoW”, the idea is great, though it was possible with previous code snippet type site.
the difference here is it is specialized on “Refactor my code”. the idea is neat and very clear more over very specific.

you will post your old nice or crappy code and through challenge to the community to come up with nice refactoring suggestion.
i would say i really like this idea.

i wish soon they will become the most popular development tool.
what if, they have integration with intelliJ idea, with “send to refactor my code” and a periodical update will display all the suggested refactorings.
check it out now

Written by nhm tanveer hossain khan

November 24, 2007 at 12:34 pm

Posted in development, tools

simple AOP implementation in ruby

without comments

i was suppose to work on some of my other projects, but i passed my time by writing a simple aop implementation in ruby.
it is neither powerful like AspectJ nor comparable with AspectR. however, i was having fun with my day off.

here is how my simple example is running-

def test_aop
# apply pointcuts
apply_advices(:before, /^do_.+/, SimpleService, SimpleServiceAdvice, :before_do)
apply_advices(:around, /^do_.+/, SimpleService, SimpleServiceAdvice, :around_do)
apply_advices(:after, /^do_.+/, SimpleService, SimpleServiceAdvice, :after_do)

simple_service = SimpleService.new
simple_service.do_1(“A”)
end

here is the parameter name.

apply_advices(type_of_advice, pointcuts_in_regex, service_class, advice_class, advice_method)

instead of making aspectJ type pointcuts syntax, i have used regex, which is fine for the time being.

if you run this code you will find the following output -

Before execution.
Around {
1 performed – A
}
After execution.

now let’s have a look on my SimpleService class.

class SimpleService

def do_1(p_param)
puts “1 performed – #{p_param}”
end

def do_2
puts “2 performed.”
end

def no_do
puts “No do”
end
end

and here is my aspect class,

class SimpleServiceAdvice

def around_do(p_invoke)
puts “Around { “
output = p_invoke.proceede()
puts “}”
return output
end

def before_do(p_invoke)
puts “Before execution.”
end

def after_do(p_params, p_output)
puts “After execution.”
end
end

my implementation is very straight forward, actually during implementing this stuff, i really felt the strength of meta programming. it is so flexible and so easy that sky is the limit.

here is the attached source code.

much better and complete aop implementation in ruby

Written by nhm tanveer hossain khan

November 10, 2007 at 2:39 pm

Lego Programming

with 2 comments

Very nice post on Joel on software
http://www.joelonsoftware.com/items/2006/12/05.html

Frequently, the mainstream media, reporting on computer programming tools, gets the story horribly wrong.

What happens is that some kind of vendor of programming technologies has come up with some product they are claiming makes programming easier. The journalists don’t really understand. What they hear is “programming is going to be easier.” Usually there’s some kind of Lego allusion.

Om Malik (November, 2006): “… these startups are building development environments that let the user cobble together software packages as easily as snapping together Lego bricks.”

He admits: “… the transition to this type of platform is going to be slow; I believe it could take about three years to realize its potential.”

Three years?

BusinessWeek ran a cover-story about object oriented programming way back in September, 1991, accompanied by a picture of a baby in diapers programming a computer. They also used the Lego metaphor: “Indeed, at the software startup they now head, Objective Technologies Inc., programming seems downright juvenile: Instead of mucking around in tangles of C code—writing arcane statements such as printf (“%s/n”, curr str)—they mainly connect boxes on the screens of their NeXT Computer Inc. workstations and fill in blanks. In minutes, they have industrial-strength programs that run right the first time and that can be modified without brain surgery. Says Bergerson, 27: ‘I showed my mother, and she said, “You’re still playing with Lego blocks, like when you were a kid!”’”

“Eventually, a whole new way of selling software may emerge. In a market of interchangeable, plug-and-play objects, you might shop for pieces separately and compile your own custom software.”

None of them believed Frederick P. Brooks, in 1987: “Not only are there no silver bullets now in view, the very nature of software makes it unlikely that there will be any—no inventions that will do for software productivity, reliability, and simplicity what electronics, transistors, and large-scale integration did for computer hardware…. I believe the hard part of building software to be the specification, design, and testing of this conceptual construct, not the labor of representing it and testing the fidelity of the representation…. If this is true, building software will always be hard. There is inherently no silver bullet.”

Written by nhm tanveer hossain khan

December 8, 2006 at 1:16 am

Posted in News, tools