Wednesday, January 27, 2016

Ultra Light Wizard v0.0.2

Ultra Light Wizard v0.0.2 is OUT... with view navigation support (Previous/Next) and Rails helper generation.

Also, fixed issues with wizard step controller.

https://rubygems.org/gems/ultra_light_wizard/versions/0.0.2

Enjoy testing and reporting feedback!

Tuesday, January 26, 2016

Ultra Light Wizard v0.0.1

Ultra Light & Maintainable Rails Wizard was a solution pattern I came up with 3 years ago to facilitate creating Rails multi-step forms that adhere to REST, OO, MVC, and other software best practices.



The original blog post about it is over here:
http://www.codepainter.ca/2013/10/ultra-light-maintainable-wizards-in.html

And the RailsConf 2014 talk I gave about it in Chicago is here:
https://www.youtube.com/watch?v=muyfoiKHMMA

From talking to developers at our local Montreal.rb user group and interacting with different client developers, it seems that the pattern has caught on and is being put to good use, sometimes with the aid of the Rubygem Wicked.

Of course, given that the Ultra Light & Maintainable Rails Wizard approach simplifies development and maintenance of wizards immensely, it is not necessary for the many smart and responsible developers out there to have a library. After all, following the approach is supposed to yield a lighter-weight solution than using most libraries out there. Nevertheless, if it is possible to codify the pattern in a library that is light-weight enough and simple to use, then we may as well have one...

And two years after announcing the idea at RailsConf 2014 (and a few hours of work).... I finally have something to show!

Ultra Light Wizard v0.0.1: https://rubygems.org/gems/ultra_light_wizard/versions/0.0.1

GitHub: https://github.com/AndyObtiva/ultra_light_wizard

Please install and use on your projects.

Stay tuned for more developments and enhancements and feel free to suggest ideas via comments.

Tuesday, October 13, 2015

CodeMentor Experts Reveal The Secrets To Staying Motivated


I've been featured in an article on CodeMentor.io, so thought I'd share:

CodeMentor Article: Experts Reveal The Secrets To Staying Motivated

“Build a personal low-risk project that tackles a new idea or puts a new twist on an old idea” – Andy Maleh

“Get training or regular mentoring by an expert in the language of choice or technology you aspire to master” – Andy Maleh

If you ever feel like solving a programming problem on a side project with the help of a mentor, expert, or pair-programming partner, hit me up at CodeMentor.io:

https://www.codementor.io/andymaleh

Monday, April 13, 2015

Presenting Abstract Feature Branch at Montreal.rb April 2015

I am giving a talk at this month's Montreal.rb user group, taking place next week on April 21, 2015:
http://www.montrealrb.com/2015/04/april-21th-meetup/

Abstract:

How many times do you find yourself near the software release finish line on an exciting new feature only to be pulled off by management in the last minute to sneak in some higher priority emergency fix? What do you do with the unfinished feature's code if parts of it were already functional and merged into master? Do you pluck it out and move to a remote feature branch? Do you simply comment out the code not ready for exposure to the customer? What about some of the nice software design improvements that were done as part of the feature and are being put to good use by the team today? Do you also put design improvements off till the feature is deemed by management high priority again?

These questions typically get decided on by the team on a case by case basis, and often with big compromises affecting both project delivery and code quality.

While consulting for Sears in 2009 and working at Groupon.com in 2012, I happened to work in teams that adopted a very effective and inexpensive solution to the problem called "Branch by Abstraction", a technique originally popularized by Martin Fowler, author of UML Distilled and Patterns of Enterprise Application Architecture.

In this talk, I aim to explain Branch by Abstraction and demonstrate how to apply in Ruby using a gem I wrote called Abstract Feature Branch, partly inspired by the internal team libraries used at Sears and Groupon. The gem has already had over 50,000 downloads from rubygem.org and has been utilized in several of my newer projects, including launch of EarlyShares.com and enhancements of Factor75.com.


Attendees should walk out with basic understanding of Branch by Abstraction and enough knowledge of Abstract Feature Branch to be able to explore further in their own projects after the talk.

Tuesday, April 07, 2015

SuperModule v1.1.0 is the New Sherif in Town!

After posting an article on AirPair.com about SuperModule v1.0.0 and getting quite a bit of feedback on it in the form of article reviews and reddit posts, I decided to make a new revision with quite a number of improvements, which was released yesterday as SuperModule v1.1.0:

What's New in v1.1.0?

  • Brand new self-friendly algorithm that ensures true mixing of super module singleton methods into the including base class or module, thus always returning the actual base class or module self when invoking a super module inherited singleton method (thanks to Banister for reporting previous limitation on Reddit and providing suggestions)
  • New included_super_modules inherited singleton method that provides developer with a list of all included super modules similar to the Ruby included_modules method.
  • No more use for method_missing (Thanks to Marc-AndrĂ© Lafortune, a Ruby language contributor, for bringing up as a previous limitation in AirPair article reviews)
  • New dependency on Banister's method_source library to have the self-friendly algorithm eval inherited class method sources into the including base class or module.
  • Refactorings, including break-up of the original SuperModule into 3 modules in separate files
  • More RSpec test coverage, including additional method definition scenarios, such as when adding dynamically via class_eval and define_method
Cheers...

Thursday, March 27, 2014

Ruby SuperModule Comes To The Rescue!!

Tired of ActiveSupport::Concern and Ruby's modules not allowing you to mix in class methods easily? Well, worry no more! SuperModule comes to the rescue!



SuperModule allows defining class methods and method invocations the same way a super class does without using def included(base).

This succeeds ActiveSupport::Concern by offering lighter purely idiomatic Ruby syntax and simpler module dependency support.

1. Just include SuperModule at the top of a module definition:
module UserIdentifiable
  include SuperModule

  belongs_to :user
  validates :user_id, presence: true

  def self.most_active_user
    User.find_by_id(select('count(id) as head_count, user_id').group('user_id').order('count(id) desc').first.user_id)
  end

  def slug
    "#{self.class.name}_#{user_id}"
  end
end

2. Mix newly defined module into a class or another super module
class ClubParticipation < ActiveRecord::Base
  include UserIdentifiable
end
class CourseEnrollment < ActiveRecord::Base
  include UserIdentifiable
end
module Accountable
  include SuperModule
  include UserIdentifiable
end
class Activity < ActiveRecord::Base
  include Accountable
end

3. And start using by invoking class methods or instance methods
CourseEnrollment.most_active_user
ClubParticipation.most_active_user
Activity.last.slug
ClubParticipation.create(club_id: club.id, user_id: user.id).slug
CourseEnrollment.new(course_id: course.id).valid?

More details and examples are available over here: https://github.com/AndyObtiva/super_module

And the SuperModule RubyGem lives over here: http://rubygems.org/gems/super_module

Enjoy!!

Saturday, March 15, 2014

Presenting at RailsConf 2014

Update: here are the links to the talk video and slides

My talk "Ultra Light and Maintainable Rails Wizards" has been added to the RailsConf 2014 program

Abstract:

Wizards have been common in web applications since the dawn of the Internet, with the most popular example being the Shopping Cart, yet many struggle with writing wizard code effectively, resulting in a huge untraceable rat's nest of copy/paste code. In fact, many implementations violate REST and include Fat Controllers as well as overly complicated wizard-step management, data, session, and validation code. This talk covers a better way that yields Ultra Light and Maintainable Rails Wizards!

If you have any special requests to include in the talk, please let me know in the comments.

Looking forward to connecting with Rails developers at RailsConf 2014.