Sunday, September 11, 2011

Coder to Developer: Tools and Strategies for Delivering Your Software by Mike Gunderloy : Chapter 11



The author discusses about working in team and the reasons for doing so such as:
  • Large projects with thousands of classes cannot be handled by a single person
  • Creating a whole application by a single person may miss the deadline
  • Creating a software involves not just developing an application but documentation, help files, installer, graphics, a website and many more things so it is better to have a team with different skills
The author then discusses about team management and the 'soft' issues involved in managing the team such as:
  • Choosing a structure: There are two alternatives to deciding a team structure
    • Community of equals: Each member on the team is recognised of being equally capable.
    • Hierarchy:
  • Tracking progress: The author suggests email-notification tool from source code control module or web page refresh from build tools. The author suggests 3 x 3 approach where each member regularly sends a report to other members of the team or just the project manager containing:
    • Three accomplishments for the previous week
    • Three obstacles to progress from the previous week
    • Three plans for the coming week
  • Avoiding your incompetence: The author discusses the Peter Principle, i.e. In a hierarchy, every employee tends to rise to his or her level of incompetence. In most organizations, people are promoted when they do their job well but never demoted. The author gives following tips to become a competent manager:
    • Start with a small team
    • Spend some time on management chores
    • Pay attention to everybody's ideas
    • Read literature on software project management
The author then discusses tools for distributed teams such as:
  • E-mail:
    • Use spam protection
    • Keep project related emails organized
    • Read emails in a batch
    • Instead of sharing every email with everyone, try sharing items through public folders or a news server
  • Instant Messages:
    • Read messages in a batch
    • Keep everybody on the same service
    • Keep an archive of conversations
  • Online Workspaces: The author discusses use of online workspaces like GotDotNet or SourceForge and their pros and cons.
  • Wikis: The author provides several wikis available and what their benefits and disadvantages are.
  • Microsoft Sharepoint: The author discusses advantages and disadvantages of Microsoft sharepoint and groove.
  • Programmer's tools: The author discusses CodeWright and CodeReview.

Thursday, September 8, 2011

Find depth of a k-ary tree given a parent array : Solution 3

The problem statement is mentioned here. The first solution is here. The second solution is here.

While traversing up the tree from a leaf node, we can avoid the whole path till root if we can utilize the depth already found for nodes that were traversed earlier. This will reduce the problem to $ O(N) $ as below with extra space of $ O(N) $.
Let DEPTH be an array of length N
Initialize all elements of DEPTH to -1
FINDDEPTH(i)
    if DEPTH[i] == -1
        if P[i] == -1
            DEPTH[i] = 0
        else
            pDepth = FINDDEPTH(P[i])

           DEPTH[i] = pDepth + 1
    return DEPTH[i]


Let L be an array of length N
Initialize all elements of L to true
for each node i from 0 to N-1
   if P[i] is not -1
       set L[P[i]] to false
   end if
end for
initialize maxDepth to 0
for each node i from 0 to N-1
    if L[i] is false, continue next node
    depth = FINDDEPTH(i)
    if maxDepth < depth
       set maxDepth = depth
    end if
end for
As can be seen, the time complexity of the algorithm is $O(N)$ where $N$ is the number of nodes. The space complexity is $O(N)$. Thanks to my colleague Jignesh Parsana to help point to this solution.

Sunday, September 4, 2011

Coder to Developer: Tools and Strategies for Delivering Your Software by Mike Gunderloy : Chapter 10

The author discusses importance of logging application activity both during development and after shipping and methods of logging. The logging during development is required since
  • Log allows you to understand actions that led to a bug
  • Log helps clarify the order of events
  • Some bugs only reproduce when running without a debugger
  • Some bugs occur after thousands of calls of a function
The author suggests to make it easy for end user to turn logging on or off. The author advises to include following in the logs:
  • Error messages and information including stack trace
  • The state of internal data structures
  • User actions
  • The timings of significant actions
  • Important environment information
The author then discusses about logging tools including:
  • The Trace and Debug classes of .Net framework -
  • The EventLog class - This is used to log events to Windows Event Log
  • Enterprise Instrumentation Framework
  • Logging Application Block
  • log4net
If there is no logging included in application, the author discusses about diagnostic tools like System Information to collect information from user machine.

Coder to Developer: Tools and Strategies for Delivering Your Software by Mike Gunderloy : Chapter 9

The author discusses about how to manage risk and bugs in software development. The author divides risk management in following
  1. Risk Assessment: The author suggests to brainstorm a list of things that might go wrong for risk assessment including things that might impact the cost, schedule or quality of the product. The author then asks the reader to order the list of risks based on importance. This is achieved by assigning probability and cost to each risk and multiplying them to get the impact.
  2. Risk Control: After the risks have been identified and prioritized, the author advises to create a risk management plan where the reader needs to specify what he is going to do to mitigate the risk.
  3. Top Five Risks List: The author advises the reader to maintain top five risk list including its previous rank and how long the risk is on the list.
The author then discusses about Bug Triage, a term that refers to prioritizing bugs based on their criticality and decide on what to do about them. The author then provides following list of resolutions that can be applied to bugs:
  • By design
  • Duplicate
  • Postponed
  • Not reproducible
  • Won't fix
  • Reassigned
  • Fixed
The author then discusses different types of software testing such as:
  • Unit Testing - This is done by developers to ensure a function or unit is bug-free.
  • Functional Testing - This is is carried out by testers to make sure the application confirms to the requirements and specifications.
  • Conformance Testing - This ensures the application confirms the industry standards.
  • Compatibility Testing - This ensures that the application runs in different environments including hardware, operating systems, browsers etc...
  • Performance Testing - The goal of this testing is to identify performance issues and creating benchmarks.
  • Stress Testing - The goal is to identify how the application fails when it is subjected to excessive stress. It involves simulating large number of users, low RAM, CPU contention etc... to make sure the application failure doesn't result in damage to operating system or data loss.
  • Regression Testing - This involves making sure that new features didn't break the existing functionality.
  • Smoke Testing - This involves running quick tests to verify that major features work.
  • Black-box Testing - The testing of components is done based solely on their interfaces.
  • White-box Testing - Internal behaviour of the components is tested with full knowledge of the implementation.
The author provides some tips to effectively test the application when there is no separate quality assurance department. The author also suggest to take every bug as a learning experience rather than as a deficiency in coding skills of a developer.

The author then provides following tips to create a test network:
  • Buy pre-assembled machines
  • Buy name brands
  • Buy serious development hardware
  • Store data separately
  • Keep drive images
  • Use virtual machines
  • Use KVM switches
  • Get your own domain
  • Use a firewall
  • Set aside test machines
  • Set aside a build machine
  • Use a mix of machines for testing
The author then discusses about bug-tracking tools. The author then provides a list of issues to consider while deciding on a bug-tracking tool:
  • Price
  • License Fee structure
  • Cross-platform availability
  • E-mail notification
  • Allow outside access
  • Allow custom information
  • Differentiation between bugs and feature requests
  • Integration with source code control and requirements tool
  • Flexible workflow
  • Storage Format
The author then provides an example bug-tracking tool and how he used it to track one of the bugs for his own application.

Coder to Developer: Tools and Strategies for Delivering Your Software by Mike Gunderloy : Chapter 8


The author discusses that code generation is the core activity of any developer and his focus in this chapter will be on code generation tools. The author suggests to spend time on thinking about automating a repetitive task instead of doing it. The author then gives an example of generating stored procedures using a tool. The code generation tools are classified in two categories:
  • Passive that dumps the code and forgets
  • Active which are then classified in several other categories
    • Code munger
    • Inline-code expander
    • Mixed-code generator
    • Partial-class generator
    • Tier generator
    • Full-domain language
The author clarifies that code-generation is not just restricted to code but a variety of end products can be developed using the technology such as:
  • Database access code
  • User interface code
  • Documentation
  • Unit tests
  • Web services
  • DLL wrappers for legacy code
  • Configuration files or initialization files
  • Scripting files
  • Installation files
The author then discuss a specific example of generating code directly from a database table using MSDataSetGenerator tool in .NET. The author then also provide a list of other tools available and briefly mentions their functionality. The author then provides an example of how he uses one of the code generation tool to help create code for his DownloadTracker application. The author then provides a list of pros and cons of using code generation tools.