August 27, 2010

at Friday, August 27, 2010 Labels: Posted by Billy 0 comments

In the world of software development, managers have deployed many
strategies over the years to guide complex software projects. As the
result of the numerous headaches and failures, different methodologies
have arisen that try to handle the malleable process of developing
software. The so-called waterfall approach, a mirror image of
traditional management of most non-software projects, first
entails producing an unequivocal specification that theoretically
leads to a simple implementation process.

Nevertheless, this waterfall approach failed time and time again for
many software projects. In comes the Agile software development
approach. It encourages rapid and incremental development, continuous
communication with the customers, adaptation and self organizing
teams.

Scrum is a method of agile software development, and Agile Project Management with Scrum by Ken Schwaber gives
real life stories of teams that used scrum successfully and
unsuccessfully. The stories are short and illustrative of common
pitfalls and misunderstandings that teams encounter when first using
Scrum. For example, one such story told of a Scrum Master running the
daily scrum meeting, asking each developer what he/she has
accomplished and assigning them their next task. This is a major
violation of Scrum; Scrum teams are self managed. The Scrum Master
facilitates the use of Scrum for the project, but scrum teams decide
who works on what and the best way to get the job done correctly.

This book was a quick read and great introduction to Scrum. No
software development process is perfect, however, and neither will any
new methodologies that may appear in the future be either. In my ideal
world of software projects, developers should never need to attend
meetings, interruptions will never spring up, and they will work
unbothered in "the flow" all day long. However, people need to
exchange information and software development is a team game. The
Scrum process seems to be a great way to boost productivity, satisfy
managers and stakeholders, and increase workplace moral.

August 15, 2010

at Sunday, August 15, 2010 Posted by Billy 0 comments

Unhappy with the lack of a sophisticated way to auto-generate public properties from private variables in Visual Studio, I turned to EMacs to implement my own version. The code at the end of this post is for VB.NET. It takes a buffer like this:

strLastName
strFirstName
intAmount
dblPrice

and changes it to this:

Private strLastName As String
Private strFirstName As String
Private intAmount As Integer
Private dblPrice As Double

Public Property LastName() As String
  Get
    Return strLastName
  End Get
  Set(ByVal value As String)
    strLastName = value
  End Set
End Property

Public Property FirstName() As String
  Get
    Return strFirstName
  End Get
  Set(ByVal value As String)
    strFirstName = value
  End Set
End Property

Public Property Amount() As Integer
  Get
    Return intAmount
  End Get
  Set(ByVal value As Integer)
    intAmount = value
  End Set
End Property

Public Property Price() As Double
  Get
    Return dblPrice
  End Get
  Set(ByVal value As Double)
    dblPrice = value
  End Set
End Property

You can easily configure the variable types it detects by modifying the alist *vb-types*. At work I have adjusted the template to expand into code complying with my company's coding guidelines. To use, visit a new buffer, type in the names of your private variables prefixed with a type designator, then type M-x props.

(defconst *vb-types*
  '(("str" . "String")
    ("dbl" . "Double")
    ("int" . "Integer")))

(defun var-name (var)
  (unless (< (length var) 4)
    (substring var 3)))

(defun var-type (var)
  (unless (< (length var) 4)
    (let ((type (substring var 0 3)))
      (cdr (assoc type *vb-types*)))))

(defun insert-private-vars (var)
  (let ((type (var-type var)))
    (when type
      (insert "Private " var " As " type)
      (newline))))

(defun insert-properties (var)
  (let ((type (var-type var))
 (name (var-name var)))
    (when (and name type)
      (insert "
Public Property " name "() As " type "
  Get
    Return " var "
  End Get
  Set(ByVal value As " type ")
    " var " = value
  End Set
End Property
"))))

(defun props ()
  (interactive)
  (let ((vars (split-string (buffer-string))))
    (erase-buffer)
    (mapc #'insert-private-vars vars)
    (newline) (newline)
    (mapc #'insert-properties vars)))