class Seecalc::FPA

FPA calculator Usage “`ruby require 'seecalc'

Seecalc::FPA.estimate do

ILF 'product',  det: 20, ret: 3
ILF 'customer', det: 20, ret: 2
ILF 'order',    det: 10, ret: 1
EO 'customer.select', det: 20, ftr: 1
EI 'customer.create', det: 20, ftr: 2
EQ 'customer.update', det: 20, ftr: 2
characteristics ({
  data_communications:         0,
  distributed_data_processing: 0,
  performance:                 0,
  heavily_used_configuration:  0,
  transaction_rate:            0,
  online_data_entry:           0,
  enduser_efficiency:          3,
  online_update:               3,
  complex_processing:          3,
  reusability:                 0,
  installation_ease:           3,
  operational_ease:            3,
  multiple_sites:              0,
  facilitate_change:           3
})
puts calculate

end “`

Constants

AVG
COMPLEXITY
FACTOR
HIGH
LOW
POINT_TYPE
UFP_VALUES

Attributes

items[R]
Hash<Object>

Public Class Methods

estimate(&block) click to toggle source

@return [Seecalc::FPA] object @param block FPA estimation block

# File lib/seecalc/fpa.rb, line 54
def self.estimate(&block)
  calc = new
  calc.instance_eval(&block) if block_given?
  calc
end
new() click to toggle source
# File lib/seecalc/fpa.rb, line 60
def initialize
  @characteristics = {}
  @items = {}
end

Public Instance Methods

EI(object, det:, ftr:) click to toggle source
# File lib/seecalc/fpa.rb, line 75
def EI(object, det:, ftr:)
  cpx, ufp = calc_ufp(type: :EI, det: det, ftr: ftr)
  hold(object, fun: :EI, det: det, ftr: ftr, complexity: cpx, ufp: ufp)
end
EIF(object, det:, ret:) click to toggle source
# File lib/seecalc/fpa.rb, line 70
def EIF(object, det:, ret:)
  cpx, ufp = calc_ufp(type: :EIF, det: det, ret: ret)
  hold(object, fun: :EIF, det: det, ret: ret, complexity: cpx, ufp: ufp)
end
EO(object, det:, ftr:) click to toggle source
# File lib/seecalc/fpa.rb, line 80
def EO(object, det:, ftr:)
  cpx, ufp = calc_ufp(type: :EO, det: det, ftr: ftr)
  hold(object, fun: :EO, det: det, ftr: ftr, complexity: cpx, ufp: ufp)
end
EQ(object, det:, ftr:) click to toggle source
# File lib/seecalc/fpa.rb, line 85
def EQ(object, det:, ftr:)
  cpx, ufp = calc_ufp(type: :EQ, det: det, ftr: ftr)
  hold(object, fun: :EQ, det: det, ftr: ftr, complexity: cpx, ufp: ufp)
end
ILF(object, det:, ret:) click to toggle source
# File lib/seecalc/fpa.rb, line 65
def ILF(object, det:, ret:)
  cpx, ufp = calc_ufp(type: :ILF, det: det, ret: ret)
  hold(object, fun: :ILF, det: det, ret: ret, complexity: cpx, ufp: ufp)
end
calculate() click to toggle source
# File lib/seecalc/fpa.rb, line 94
def calculate
  vaf = calc_vaf(@characteristics)
  ufp = @items.values.inject(0){|s, v| s += v[:ufp]}
  { ufp: ufp, vaf: vaf, fp: (ufp * vaf).round(2) }
end
characteristics(characteristics) click to toggle source
# File lib/seecalc/fpa.rb, line 90
def characteristics(characteristics)
  @characteristics = characteristics
end

Protected Instance Methods

calc_ufp(type:, det:, ret: 0, ftr: 0) click to toggle source

Calculate unadjusted funtion points TODO check input values and their cobinations

# File lib/seecalc/fpa.rb, line 110
def calc_ufp(type:, det:, ret: 0, ftr: 0)
  complexity = case type
    when :ILF, :EIF
      case ret
      when 1 then    det > 50 ? AVG : LOW
      when 2..5 then det < 20 ? LOW : det > 50 ? HIGH : AVG
      else det < 20 ? AVG : HIGH
    end
    when :EI
      case ftr
      when 0..1 then det > 15 ? AVG  : LOW
      when 2 then    det > 15 ? HIGH : det > 4 ? AVG : LOW
      else det > 4 ? HIGH : AVG
    end
    when :EO, :EQ
      case ftr
      when 0..1 then det > 19 ? AVG  : LOW
      when 2..3 then det > 19 ? HIGH : det > 5 ? AVG : LOW
      else det > 5 ? HIGH : AVG
    end
  end
  [COMPLEXITY[complexity], UFP_VALUES[type][complexity]]
end
calc_vaf(system_characteristics) click to toggle source

@return [Number] Value Adjustment Factor @param system_characteristic [Hash] vaule must be in range 0..5. Hash keys don't bring anything in calculation

:data_communications, :distributed_data_processing, :performance, :heavily_used_configuration, :transaction_rate, :online_data_entry, :enduser_efficiency, :online_update, :complex_processing, :reusability, :installation_ease, :operational_ease, :multiple_sites, :facilitate_change

TODO check value in range?

# File lib/seecalc/fpa.rb, line 139
def calc_vaf(system_characteristics)
  sum = system_characteristics.values.inject(0, :+)
  (sum * 0.01 + 0.65).round(2)
end
hold(obj, params) click to toggle source

TODO: how about 'obj.1', :ILF and then 'obj.1', :EQ

# File lib/seecalc/fpa.rb, line 103
def hold(obj, params)
  raise "An attempt to add a duplicate item '#{obj}'" if @items[obj]
  @items[obj] = params
end