Just one step before Design Patterns: *Micro Patterns*

1. Introduction

It has always been a good question to ask: “How to trace the design of a program?”, The most obvious answer is to trace the design patterns. Finding design patterns in source code is hard, so researchers are trying to find simpler patterns to trace. The main idea of this blog post is to define “Micro Patterns” which are one-class design patterns, and talk about their importance and how they are related to SAPM. Micro Patterns are midway between simple structures and design patterns! Let’s see 🙂

2. Patterns! Patterns! Patterns!

In the SAPM course[8] we had a lecture about “Design Patterns” and another about higher-level patterns called “Architectural Patterns” followed by another lecture about an important example of Architectural Patterns which is Scripting Components. I have also seen that there are many blog posts my colleagues posted about these patterns!

2.1. Hey! Do you remember what design and architectural patterns are?

RECAP: Design Patterns are approaches and solutions for problems occurring repeatedly in object-oriented software development [1]. They provide a shared vocabulary and ease the communication between developers. Design patterns are template solutions [2] that might contain one class (such as Singleton) or ,most-of-the-time more than one class (2,3..or more). Architectural Patterns care about the whole project, not specifically to a problem. The aim is to build reusable components [3].

2.2. Allan, SPAM and the big step!

Allan
I want to go back to SAPM lectures. Allan stated that developers solved the idea of reusability in small but not in large-scale projects. Just go back to the first slides of the Design Patterns lecture [4] and check how we started from finding simple patterns in codes (e.g. how developers patterned the looping idea as a “for” structure). I felt that there is a dramatically big step from finding simple patterns that led to defining structures like (loops, methods, classes,…etc) to finding higher-level patterns like the design patterns. Don’t you think the same?
This idea reminds me of a paper I once read and it talked about what they called “Micro Patterns”!

2.3. Ok? So isn’t it enough we have all these types of patterns! You want us to have more?!!

Simply… YES!!!! Most of design patterns contain more than one class and it is really HARD to find patterns in more than one class. My research review last semester was about finding patterns in source code and i found that it is difficult to find patterns in one class so how about finding patterns among several classes?

2.4. So?

Simply, I think we should work to find some simple patterns and then work to find some more sophisticated patterns. I am not saying that we CAN’T find these complex patterns immediately. Some people have already done so but as Mak, Choy and Lun[5] said, “. . . automation support to the utilization of design patterns is still very limited”.

3. Finding Patterns in Source Code! What is this?

Finding patterns in source code means searching for interesting information and structures in the code. The aim is to detect similar code fragments in source code. Finding these patterns has many applications such as bugs detection, code quality determination , and refactoring. Although the machine learning (ML) techniques and natural language processing (NLP) algorithms are mostly developed by researchers in the field of computer science and artificial intelligence, they are not used that much to solve the problems of informatics itself. Using the ML and NLP techniques to find patterns in source code seems an interesting field as it seeks to solve the problems of informatics by using tools developed by people from the same field.

3.1. ok! But What are Micro Patterns?

As stated in the introduction, It has always been a good question to ask: “How to trace the design of a program?”, The most obvious answer is to trace the design patterns. Many systems do this but with low precision and high error rate. Some researchers suggested looking for other patterns which are traceable and less abstract [6, 7]. The term “Micro Patterns” is used to represent the class-level traceable patterns. Finding these patterns has a great influence on Software engineering as they might help in using more efficient design, code reuse, and automation.
Finding patterns in a source code is extremely useful, but can you use these techniques to generate new patterns? Answering this question is somehow hard as we need new ways to let our algorithms understand the object oriented programming fundamentals such as the inheritance and polymorphism.

3.2. Wait a little, I googled “Micro Patterns” and didn’t find much results!

Well, I did too! While some people consider these patterns as a kind of design patterns since they aim to create a sharable vocabulary in addition to the previous advantages, the term is mostly used by people working in the field of source code mining to refer to one-class patterns they want to find!

4. Conclusion

Well, I think, and as stated in SAPM lectures, reusability in small projects is solved by defining structures but we still need to formalize the solutions for higher-level larger-scale projects. Micro Patterns are somewhere in the middle between simple structures and higher-structures. Searching for them and using them will have lots of advantages.
Micro Patterns are one-class design patterns that are easier to find and therefore to be formalized. They have the advantages of design patterns as they are types of them beside the benefit that they are easier to find.

Note: I didn’t want to fill the blog post with names and descriptions of micro patterns since my aim was to introduce the Micro Patterns without drowning in their details. People interested in getting more details about the topic are recommended to read the paper “Micro patterns in Java code”[7].


References
[1] http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/391
[2] http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/485
[3] http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/486
[4] http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/Design_Patterns_Lecture_Start
[5] Jeffrey K. H. Mak, Clifford S. T. Choy, and Daniel P. K. Lun. Precise modeling of design
patterns in UML. In Proc. of the Twenty Sixth International Conference on Software Engineering
(ICSE’04), pages 252–261, Edinburgh, Scotland, United Kingdom, May 23-28
2004. IEEE Computer Society Press.
[6] Balanyi, Zsolt and Ferenc, Rudolf, Mining design patterns from C++ source code, International Conference on Software Maintenance, ICSM, pages=305-314, IEEE, 2003.
[7] Gil, Joseph Yossi and Maman, Itay, Micro patterns in Java code, ACM SIGPLAN Notices, Volume 40, Number 10, pages 97-116, ACM, 2005.
[8] http://www.inf.ed.ac.uk/teaching/courses/sapm/

Game Development as Software Development

1. Introduction

Game development is a collaborative art. Creating games require many teams working together in drawing, choosing music, writing scenario and programming!
This blog post aims to compare game development with the general software development in order to find the best methodology for game development. While most applications are service-oriented, games goal is to entertain users. Since there are some differences between games and software, there will be some differences in the development process. Will traditional project management techniques work with games? What about waterfall and agile methods? Let’s see!

2. Games Development

2.1. Video Games VS. Software

video-games-132
Nintendo…the world’s largest video game company by revenue

A video game is an electronic game that involves human interaction with a user interface to generate visual feedback on a video device[1]. There are several types of games such as casual, educational, and serious.
Video Games are just like any other computer program in terms of intangibility. However, there are some differences. We usually create applications to provide services. Microsoft Word for example is software to create/edit/print textual data! However, the main aim of games is to provide some “fun”[2]. Games are created to entertain users! Even if they are educational, the goal is to teach the user while he is having some fun.

2.2. Game Development VS. Software Development

Video game development is the process of creating a video game[3]. Just like any other software development there are plenty of methodologies we may follow. Games are, most of the time, large-scale software. In game development there are several teams working in the same project. There are teams for programming, drawing, designing..etc. Games include audio, video, images, and a scenario. Another important thing to consider is the “experience” we aim to create and evolve in games[2].

GD1_B
Many teams work together to build a successful game

In “Probabilistic Modelling and Reasoning” course[12] we learnt that one of the hot topics in machine learning now is how to match players with similar skill levels in a large online gaming site[11]. It is about “measuring” experience of players! Or measuring experience of one player in order to let him play with a difficulty-level that matches his experience!
Game development is not just about programming! It is a creative work! We learnt that a piece of software is considered a successful one if it is delivered on schedule, within budget and meets users’ needs in scope and quality[4]. A good question to ask here: “What are users’ needs for a video game?”. In lectures we discussed how hard it is to measure software! It is even harder to measure how fun a game is! Or How entertained the gamers are! We studied some measures for software but here the measurements are harder since game development is driven by innovation.
Sometimes we have the time limit. For example, a game for Christmas should be published before Dec.25th!

2.3. Choosing the Methodology

Game development is a software development process[3]. Some people say that game development is not suited for typical software life cycle methods, such as the waterfall model[5]. Waterfall is a hated process especially in games[7]. Some developers say it is not practical because creating fun(user needs) is an experimental process. Building software iteratively by separating it into small deliverables and working on tight timeframes seem more reasonable for some developers[7]. However, some others believe in creating a balance[6] between the agility and the waterfall approaches. Game development involves an overlap of many methodologies[6]. When we have clear requirements and specification we can use waterfall but the design will be iterative[5].

2.4. Personal Opinion

Assassin's_Creed_Revelation_Development_team
Assassin’s Creed Revelation Development team

In SAPM lectures[10] we studied that it is important to use the formal traditional project management charts and methods when there are tasks with complex dependencies. I believe that there are higher dependencies in game development than any other software. There are high numbers of people working together in a tight-connected tasks. Artists should finish drawing the characters in the game in a specific time. Programmers can’t do some tasks without having some images and audio files. In game management we need to use the traditional techniques for the whole project. Contracts and assets could be written waterfally. However, we still need to use some agile methods for the design. Successful games projects are delivered on time, within budget, and they should entertain the users. Finding the balance in using the methodologies is a core key for this.

3. Conclusion

Games are just like any other software in terms of intangibility. However, games are more complex in terms of having multiple teams working together with complex related tasks. The goal of games is to entertain the user. The best approach for game development is to use a mixture of methodologies starting from formal traditional techniques to deal with the whole project, to waterfall method in writing contracts, till agility in programming!

Recommended Video (less than 3 minutes)- The Evolution of PC Games
https://www.youtube.com/watch?v=OuO-s1kugLs

References
1. http://en.wikipedia.org/wiki/Video_game
2. http://informatics-sapm.blogspot.co.uk/2013/03/video-game-production-different-kind-of.html
3. http://en.wikipedia.org/wiki/Video_game_development
4. http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/6
5. http://gamifique.files.wordpress.com/2011/11/11-game-design-second-edition.pdf / page 225
6. http://www.gamasutra.com/view/feature/181992/waterfall_game_development_done_.php
7. http://www.whatgamesare.com/waterfall-development.html
8. http://www.whatgamesare.com/agile-development.html
9. http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/305
10. http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/108
11. http://www.kaggle.com/
12. http://www.inf.ed.ac.uk/teaching/courses/pmr/lectures/beliefnetworks-print.pdf – slide 2

Pictures:
1- http://www.beachbayonet.com/wp-content/uploads/2014/03/video-games-132.jpg
2- http://assassinscreed.wikia.com/wiki/File:Assassin%27s_Creed_Revelation_Development_team.jpg
3- http://www.e-games.tech.purdue.edu/images/GD1_B.png

Response Article: Pair Programming is OVER-RATED

This is a response article to the blog post:
“Why Pair Programming Is The Best Development Practice?”
You can find it here:

Why Pair Programming Is The Best Development Practice?

Introduction

In this blog post I am responding to an article claiming that Pair programming is the best development practice! Even though I believe pair programming is a great practice in some conditions, I think it is totally over-rated by the author of that article. I would comment on two things, the way the author delivered the idea and the idea itself.

1. “Hey! I am awesome”
hlowlwtnkpgqbdrduqxnhvyrj
I totally believe “Pair programming” is a great activity, but you cannot come to people and say: “Hey! This is the best thing in the world”. The article title assumes that pair programming is the best development practice!
In that blog post’s conclusion, the author stated that: “Pair Programming is the best development practice, because it is fun!”. Well! I enjoy riding a rollercoaster and lots of people do, but this doesn’t make it the best leisure activity! And if I like pizza it doesn’t make it the best food in the world! YES! I totally agree Pairing is fun, but this is not, in anyhow, a reason to make it the best development practice.
Were I the one convincing people that pair programming is a great activity I wouldn’t use this claim! There is a bunch of reasons that could be used like:
– “Good fulltime pair programmers consistently produce higher-quality code faster..” – Jim “Big Tiger” Remsik
Or:
– “In pairs, progress is faster, we can work longer without losing headway, and quality is higher” –Ron Jeffries

2. I agree…Pair Programming is a great activity!

Untitled
Pair programming is a practice where two programmers work side by side on the same computer together collaborating on design, algorithm and code.
I believe that it is a useful activity to follow when you are dealing with difficult tasks, having people share the same level of skills and experience. I also agree with the five points mentioned in that blog post for successful pairing.

3. But……

3.1. Pair Programming is NOT suitable for all tasks and situations

11.strip_
Some people prefer to work alone, don’t like to socialize, or maybe are of higher quality than their mates. Some people claim that pair programming save the time by letting two people work together in the same project. However, in many cases this time could be easily wasted(communication, talking about ideas…etc). Beside some other disadvantages we discussed in the SAPM lecture about “Methodologies “[1] such as separated geographically programmers. Some people can’t program while someone is watching them all the time! Just think about arriving to the company and then waiting for your mate! You can’t do anything until he comes! What if he is sick!

3.2. Specific statements I don’t agree with…

I will just quote some sentences from that blog post and comment briefly on them.

  • “Guess what – your most programming tasks in a software company will focus on boring and repeatable tasks with very few of them being creative and challenging.”
    What? Really? Who said that?! Most of tasks are boring and repeatable?
  • “You probably think about programming as a creative process – sadly this is not relevant for every task.”
    I believe that all coding activities are creative, even the most silly ones! You can turn them into creative tasks.
  • “ Cowboys are of no value anymore.”
    Well I don’t think Cowboys coding software development is good but I won’t say it is of No value!
  • “I believe that those stories exist, because people have no idea how to practice pair programming.”
    I also believe that “SOME” of them have no idea how to do it properly but there are lots of blog posts about people who tried it correctly but it was useless and just a waste of time.
  • “Pair programming is an important and crucial part of Extreme Programming (XP) methodology. This being said, we cannot use pairing without following rules from XP.”
    Yes! It is really an important part of it but it doesn’t mean we can’t use it alone. One advantage of agile methods is that you are not obliged to do all activities[4].
  • “Is there an ultimate answer? Yes! There is an ultimate answer to the question “Why Pair Programming Is The Best Development Practice?”.
    if the answer is ULTIMATE then everybody will follow pairing! There is no ultimate answer even for the most common problems.

4. Trade-off

In my opinion, you can’t use pair programming in all cases and situations. You have to find what fits you and in which cases you want to adopt it. Some reports[2] suggest using it when mentoring new hires, for risky tasks, or when dealing with a new technology. However, programmers could have a say about this. Code reviews might be another solution for people that don’t feel ok with someone watching all the time. John Sextro worked in pairs with more than 100 developer and he said[3]: “Pair programming can be tough, even for the best developers, and can be downright daunting if you haven’t done it before, are introverted or unsure of yourself.” And he suggested 7 habits for high-efficient pair programming which are: Proficiency, Communication, Self Confidence, Self Control, Patience, Manners, and Hygiene. [3]

Conclusion

To conclude, pair programming is a useful and great activity but we can’t claim that it is “the best development practice”. Pairs will learn from each other, help in finding bugs, and the quality of design, algorithms and code are higher but it requires pairs to have similar skills and good respectful relationship between each other. I think the author of the core blog post overrated pair programming by considering it the best development practice.


[References]

1. http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/347
2. http://www.versionone.com/Agile101/Pair_Programming.asp
3. http://www.agileevidence.com/2013/11/7-secrets-of-highly-effective-pair.html
4. http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/349

[Images]
1- http://1.bp.blogspot.com/-8Rc7yYQ7L9E/UnZnrRwN6PI/AAAAAAAAB54/qQ3Xwg0e7O8/s640/11.strip_.gif
2- http://s3.amazonaws.com/giles/092209/hlowlwtnkpgqbdrduqxnhvyrj.jpg
3- from the video: https://www.youtube.com/watch?v=ET3Q6zNK3Io

Response Article: Software Measurements in the eye of clients

Hi,
This is a response article for the blog post “SOFTWARE METRICS, ADVANTAGE OR DISADVANTAGE”. It could be found here:

SOFTWARE METRICS, ADVANTAGE OR DISADVANTAGE.


1. Introduction
In this blog post i am responding to an article about Software Metrics. My main point is: the author of the post said in the introduction that he will talk about measures from the client’s overview and then spoke about some traditional measures that are not even useful for people in the development team.

2. In response to the blog post
Software Metrics are important measures and they should be studied from two perspectives: people-inside the company viewpoint and clients viewpoint. We have seen in SAPM lectures that it is hard to estimate and measure software but we have to do something![5]

2.1. I got excited about this topic…BUT!
The blog post is started with a very interesting and thrilling point and I will put the exact sentence that took my eye: “Nowadays, customers need to know that what they are buying has the quality they need, otherwise they cannot use it and they will not buy it”. The author also stated a very nice example about buying a car. I was totally excited assuming that he will talk about software measures in the eye of customers. However, he continued his blog post stating the measures that MIGHT mean something for the software development team or manager BUT ,surely, not for the customer. The author mentioned a list of measures such as Lines of code, Number of classes & interfaces, Code to comment ratio, Code coverage…etc.

2.2. so what’s my problem with this blog post?!
The problem is that, all of these measures mean NOTHING to the customer. How in the world will a client decide whether a 4500-line-of-code is good or bad software?! Just imagine some client asking about your program and its quality and you tell him “Well, I have a 3500 lines-of-code in my program so it is amazing!”. It is not even useful for comparing! Who said that a 4000 line-of-code program is better than a 3000 line-of-code one?

2.3. COBRA Effect!
Further to that, these measures are really not useful neither for the manager of the team nor for the programmers themselves (recall. Lectures of Allan and Cobra effect…etc)[1]. If these measures are of NO USE neither for the manager nor for the programmers, how come will they be useful for the client? The same thing holds true for other measures you stated.

2.4. Successful Software Projects
Let me go to one of another colleague’s post “Easy facts about LOC used in software measurement” (https://blog.inf.ed.ac.uk/sapm/2014/02/11/easy-facts-about-loc-used-in-software-measurement) and take the following: “Clients care about the function. Only the business value brought by these function is meaningful. LOC is not a metric that could be used to evaluate how meaningful the function is. More code does not necessarily suggest that the function is robust or the business value is large”[2]. This is exactly the case. Clients care about what your software will give them whether it has 100 classes or 1000 classes or even 1 class!
Clients might be more interested in the main criteria for successful projects. They want the software to be done on time, within budget and meet their needs in scope and quality[3]. In case you want to tell your customers how good/bad you are doing in the project up to now, you should look for an easy-to-interpret and meaningful functional measures for clients. The client is interested in knowing how reliable my software is, how secure, and how efficient it is.

3. Conclusion
My point towards this blog post is that, in the introduction it gives me a feeling that it will provide us with measures from the viewpoint of clients, but then it goes into the traditional measures.
Taking into account all what I have just said, I am a 100% agreeing with the author that telling the client about our software is a real need whether as estimates, measurements when we are coding, or as an evaluation after finishing the Software. Speaking in terms of Reliability, Security, Efficiency, Maintainability[4] might be more useful and easier to understand for the client.

[1] http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/276
[2] https://blog.inf.ed.ac.uk/sapm/2014/02/11/easy-facts-about-loc-used-in-software-measurement/
[3] http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/6
[4] http://en.wikipedia.org/wiki/Software_quality#Measurement
[5] http://www.inf.ed.ac.uk/teaching/courses/sapm/2013-2014/sapm-all.html#/235

Using Social Networks to Analyse the Stakeholders of Large-Scale Software Projects

1- Introduction


1-1- Stakeholders?! Mmmm I heard this word before!
Whatever your software project is, you have stakeholders! If there are no stakeholders, then how and why to do it?! All the people who are engaged in a software project are called “Stakeholders”. Stakeholders are the ones who affect and be affected by the actions in the system we are building. Employees, Customers, students are all examples of stakeholders. The importance of stakeholders comes from their knowledge of the processes we are working on.
 
1-2- Ok? So What’s the point?
A lot of software projects fail just because people ignore or neglect the role of stakeholders. Based on reports [1], ignoring stakeholders is the most common reason for failures in software projects.  I don’t want to spend the whole time convincing you how important stakeholders are. JUST BELIEVE ME and let’s continue.
 
1-3- So stakeholders are important.. then?
It is once said, “Not all your fingers are the same!”. The problem isn’t really just about ignoring the role of stakeholders, but it is about dealing with them all in the same way. They aren’t the same! How can I deal with the manager of the organisation just like I deal with the concierge?! Yes they both interact with the system but not in the same manner and not with the same influence. The main idea is about building a social network where nodes are the stakeholders and links between them are weighted recommendations.
 

2- Using Social Networks to represent stakeholders and their importance: More details about the approach


2-1- Ok! So it is about building a weighted graph? How to put the weights?
Yes! We will represent the stakeholders and their influence by using a graph. Weights will be assigned by allowing each stakeholder to recommend other stakeholders.
 
2-2- I just can’t get the idea! Why to build a social network?
When we build a social network we can simply use all the Graph properties and the social network measures.
 
2-3- Well! Things will be clearer with an example!
Let’s take a simple example! We have 4 stakeholders, Alice is the manager of the system, Bob is a programmer, Carl is a post-graduate student and Dave is an undergraduate student. Every one of them recommends the people with whom he/she interacts. These recommendations take the form:
<Stakeholder, Role, Salience> where:
–         Stakeholder: his/her name
–         Role: the role of the supervisor
–         Salience: ordinal number represents the importance of this person (Let’s say it’s between 1 and 5 where 5 is the most important).
For example, Alice recommends both Bob and Carl as:
<Bob, programmer, 4>
<Carl, PostGradStudent, 2>
And so on for all others. After writing the previous triples for all we build the network.
unnamed
2-4- So? We have a cute social network! But how to use it?
Simply, we will priorities our stakeholders using social network measures such as:
          2-4-1- Betweenness Centrality: it ranks a stakeholder based on its role as a “broker” between various stakeholders. It counts the number of shortest paths in the network that go through this stakeholder. For the previous example, Carl is the most central one as both Alice and Bob use him to go to Dave.
         2-4-2- PageRank: it is Google’s base algorithm for ranking search results. By simple words, the importance of a node (stakeholder) is determined by the importance of the nodes referring to it. In the previous example, Alice and Dave have a link with the value (5) going in. However, Alice is more important in this measure because it is recommended by Bob who has a higher rank than Carl who recommends Dave! (since Bob has a higher value of recommendations going into him!) The same as in the web, where the importance of a website is really determined by the importance of the websites that point to it!
         2-4-3- Other Measures: I don’t want to turn my blog post into a graph measures lecture! So I won’t list all of the things you can do and measure but some other ideas are related to the total number of arrows and their values (degree of a node, in-degree, out-degree, etc…).
 
2-5- mmmm.. that’s cool! But which measure to use?
Actually, it depends on the problem we are solving and on the domain. We may use a mixture of these. I don’t want to go into the details of this but it is interesting! Lots of papers are about this. Just google it!
2-6- Has anyone tried this method practically?
YES!! StakeNet is a tool defined and used by people from the University College London (UCL) with a LARGE-SCALE SOFTWARE PROJECT with a 30000 user [2]. Identifying and prioritising stakeholders are done by this tool for the new UCL access control project. StakeNet performs better than other usual methods to determine the importance of stakeholders.(More details in the paper[2] about the evaluation process).
 

3- Conclusion


Well, in my eye using a social network to show the stakeholders and their relations is extremely useful. The first reason is that you won’t ignore them and the second you will give them priorities. Another important point is allowing all the stakeholders to have an opinion in determining other people importance.  Using this representation for large-scale software projects will be a great thing for all these reasons.
 

– The example and image idea are from the reference [2]. I re-draw it in a more “cool” way 😉

 

[References]
1- D. C. Gause and G. M. Weinberg. Exploring Requirements: Quality Before Design. Dorset House Publishing, 1989.
2- Lim, Soo Ling and Quercia, Daniele and Finkelstein, Anthony, StakeNet: using social networks to analyse the stakeholders of large-scale software projects, Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering-Volume 1, ACM, 2010.