Monday, June 20, 2011

The Work Of A Software Developers

It's 10:00 AM. I think it's time for me to say a little info about me. This post is about a little thing about me as a Software Developer and Engineer.
Part I: The Basics.

When I talked to a developer or have a discussion with a developer, I may anticipate what he/she will say. They may throw a bunch of technical terminologies, patterns and practices, new technologies or the tools they used on their last projects. Some experienced developers may tell the design of their previous projects. I may anticipate it because that is what a typical developer does. I know that because I am a software developer too. The software developers may notice that he/she repeatedly doing the the following processes:
  1. Accept a task from a superior (task i.e. bug or specifications).
  2. Give a number (i.e. schedule and time intervals to deliver the working output of the task).
  3. Develop the code to get the task done.
  4. Collaborate with other teammates.
  5. Submit the working output of the task to his/her superior.
During the code development iteration, the developers could conduct a research and could learn new algorithms, patterns and practices, software development methodologies, and new technologies, etc. The coding process can be summarized into (but not limited to) the following principles for Object-Oriented Developers:
  1. Designing a single class.
  2. Create an association between classes.
  3. Program to an interface (GoF).

Designing A Single Class

From here, the software developers is thinking the design for the blue-prints (i.e. types and method definition). See Object-Oriented Analysis and Design.

Creating An Association Between Classes

From here, the software developers is thinking about creating and injecting dependencies of objects. Let us have an example here, supposed I want you to write a class that will represents a real world developers that has a task to perform. Typically the developers will:
  1. Design their class to instantiate their own dependencies. Or;
  2. Use Strategy Pattern for IoC (Inversion of Control). Or;
  3. Use Factory Patterns.
Example using C#.NET:

using System;

public class Developer
{
    // 1. create the dependency itself.
    private ITask task = new Task();
    // 2. for strategy pattern.
    private ITask taskStrategy;
    // 3. ask via factory patterns
    private ITask taskFactory = Superior.DeveloperTask;
    public Developer()
    {
    }
    // 2. Use Strategy Patterns (with constructor-arg)
    public Developer(ITask task)
    {
        Task = task;
    }
    // 2. Use Strategy Pattern (with Accessor/Mutator)
    public virtual ITask Task
    {
        set
        {
            ITask newTask = value;
            if (newTask == null) {
                throw new ArgumentException();
            }
            taskStrategy = newTask;
        }
        get
        {
            return taskStrategy;
        }
    }
    public void DoWork()
    {
        Task.Perform();
    }
}

For advance dependency injection developers can use Spring.NET or Spring for Java. See Dependency Injection Patterns.

Program To An Interface (GoF)

From here, the developer will segregate the contract from its implementation. The contract is just an abstract interface. Let's have my example above once again. In my example, I segregate the contract (ITask) from its implementation (Task), because a task can have many implementations.


public interface ITask
{
     void Perform();
}


using System;
public class CodingTask : ITask
{
    public virtual void Perform()
    {
        Console.WriteLine("I'm Coding Now..");
    }
}


using System;
public class SubmissionTask : ITask
{
    public virtual void Perform()
    {
        Console.WriteLine("Submitting my work now...");
    }
}


using System;
using System.Collections.Generic;
public class DailyTask : ITask
{
    private List<ITask> taskList = new List<ITask>();
    public DailyTask()
    {
        Add(new CodingTask());
        Add(new SubmissionTask());
    }
    public virtual void Perform()
    {
        foreach (ITask task in taskList)
        {
            task.Perform();
        }
    }
    public virtual void Add(ITask newTask)
    {
        taskList.add(newTask);
    }
    public virtual ITask this[int index]
    {
        get
        {
            return taskList[index];
        }
    }
}


using System;
public class Work
{
    public static void Main()
    {
        ITask myTask = new DailyTask();
        Developer ron = new Developer(myTask);
        ron.DoWork();
    }
}


The above is only a fraction of the whole big picture. To be continued... :))

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.