So, I am a post grad student in the software development field, and I am not working at the moment, but I have some questions on Business Rules, User Stories, etc. So I was wondering if perhaps we could open up a discussion here on some of the common business problems that programmers typically run into in their fields, and what sorts of user stories could be useful for an entry level programmer to pursue in their development career. I have an example;

Recently I rode in a cab. While in this cab we had to wait for a truant passenger who habitually did not participate in the trips. From this I derived a user story, where the cabbies could use a truancy histogram such that they could rate customers on attendance and change the color of pins on their gps devices. The User story is that there are habitually truant passengers. The solution is a truancy histogram.

Specifically I just want some good ideas on User Stories and Buisiness Rules that typically come up and you can post here some of your observations.

        /*
            DELETE FROM ATTENDANCE
            WHERE DATE_EVENT < date() - 30
         */

        //create database tables initialize database
        var cfg = new Configuration();
        cfg.Configure();
        cfg.AddAssembly(typeof(User).Assembly);

        new SchemaExport(cfg).Execute(true, true, false);

        //create user
        User user = new User();
        user.UserName = "Cameron Block";

        //create attendance history
        user.Attendance = new List<Attendance>();
        Random rand = new Random((int)DateTime.Now.Ticks);
        for (int i = 0; i < 2; i++) {
            bool isTruant = rand.NextDouble() >= 0.5;
            user.Attendance.Add(new Attendance() { DateEvent = DateTime.Now.AddDays(-i), Truant = isTruant });
        }

        //determine rating
        int rating = user.GetRating(5, 3);

        //insert into database table
        using (UserRepository repo = new UserRepository()) {
            repo.BeginTransaction();
            repo.Insert(user);
        }

    /// <summary>
    /// The attendance record of the user specified. 
    /// </summary>
    public IList<Attendance> Attendance {
        get; set;
    }

    /// <summary>
    /// Returns a rating on a given scale to determine hot or cold.
    /// Scale is essentially number of stars. 
    /// Threshold prevents 0 event people from getting bad service. 
    /// </summary>
    /// <param name="scale"></param>
    /// <param name="threshold"></param>
    /// <returns></returns>
    public int GetRating(int scale, int threshold) {
        int numStars = scale;

        int attended = 0, max = 0;
        max = Attendance.Count();
        foreach (var attendance in Attendance)
            if (attendance.Truant == false)
                attended++;

        //determine if number of attendances is greater than threshold
        decimal percentage = 0.00M;
        if (Attendance.Count() > threshold)
            percentage = (decimal)attended / (decimal)max;
        else
            percentage = 1.0M;

        int rating = (int)(Math.Ceiling(percentage * (decimal)numStars));

        return rating;
    }//end method

Recommended Answers

All 3 Replies

This reminds me of one metric of a Social Credit Score. Your metric is just one of many you can implement. I'm not saying you should but there are many social scoring metrics to explore. For example read https://en.wikipedia.org/wiki/Social_Credit_System then think about your business, company or country and what else you could apply a score to.

Good observation. Please others post good business problems, even if "user stories" that newbies should be thinking of. Thanks.

I was hoping to keep this open as an ongoing discussion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.