Saturday, 8 September 2012

Visual Studio Tip - Add Existing Item As Link

When you add an existing item in a project, Visual Studio automatically create a new copy of the file. This is usually what you want but sometimes you simply want to add a file as a link in order to reuse it and avoid to manage and maintain two different copies.

The trick is to use an "hidden" drop down menu in the "Add Existing Item" dialog.



You can see the effect because file added as link contains a special symbol (arrow) in the bottom left.


If you define macro in one of the project this technique allow you to share a file and customise it a little bit without the need to maintain two completely separate files. This is surely not a best practice but could be useful in some situations.

Visual Studio is clever enough to show you the code in grey based on where you open the file.




Friday, 7 September 2012

Book - 97 Things Every Software Architects Should Know

In this post I am going to share my opinions about the book I just finished to read. Till now, I simply limited myself in reporting the most interesting sentences from a book but starting from now (thanks to the constructive feedback of a friend) I decided to give more personal opinions and explaining what I really think. This is surely more difficult to do and more time consuming, but will allow me to deeply think and reflect about the books and set the stage for interesting discussions.


I am currently a software developer at the beginning of his career and I am willing to learn everything about software development and how to write better software. The role of the software architect fascinates me in some way and for some reasons is still a little bit unclear what are actually the responsibilities of one of them. Assuming this role could be a possible decision in my career so it is good to learn more about it. In addition, for personal projects like mobile applications you typically need to take architectural decisions and take care of all of the stages of the software development and the advices in the book can be useful.

Let's start to report the most interesting sentences in the book followed by my opinions.
A great software architect needs to master both sides of the architect's coin: business and technology
The fact that the software architect need to understand the business is very important and this is probably the most important reason why this is a separate role in the IT industry.
While it is important, even critical, to stay abreast of the latest trends and technologies, this should never happen at the cost of the customer. Always put the customer's long-term needs ahead of your own short-term needs and you won't go wrong.
This is a well know thing but it is always worth to remember. The need of our customers are the most important things and technology is only a way to solve a business problem.
Learning to treat people with respect, and learning give them the benefit of the doubt, is one of the core skills that turn a smart architect into an effective one.
Being able to work with people and respect them is a key element of any human being. It is always important to listen other people and be able to receive constructive feedback. This is for me a life principle and I truly believe in it. 
All too often, software architects sit in their ivory towers, dictating specifications, technology decisions, and technology direction to the developers below.
This is surely something that I don't like. As a developer, I would like to participate in discussions and contribute with feedback if I can. I like to know the "big picture", understand it. I like if architects take time (often) in discussing with developers the "big picture" because this, at least for me, help me to be more motivated and be more effective in my job.
Be sure to have a digital camera with you at all times (in order to take a picture of a whiteboard after a meeting).
This is surely something to remember and I have seen people in my company to do this. These days we always have our mobile phone in our pocket so this shouldn't be a big problem. In the future, we could have one of this 82'' LCD Multi-Touch Display in every meeting room :)
One thing most software architects fail to realize is that a software architect is also a leader. As a leader, you must gain the respect of your co-workers to work in a healthy and effective environment. Keeping developers in the dark about the big picture or why decisions were made is a clear recipe for disaster.
Same as a previous point. Everyone should know the "big picture" and surely the architect has the responsibility to simply share it.
By asking for the intended value of a requested feature or requirement, architects are able to address the real problem, and hopefully provide a better and cheaper solution than that suggested by the client. Arrange workshops and meetings where the architects focus is on customer needs - helping the customers to answer the "why" question.
One of the most important thing I learnt last year is the importance to start with why in everything you do. As an architect, you must care about the why of your customers in order to build the right solutions.
Experienced architects understand that they need to "sell" their ideas and need to communicate effectively in order to do that. Standing up automatically communicates authority and self-confidence. You command the room.
Because the architect is the bridge between business and technology there are often lots of trade off involved and the ability to communicate is key. This is an area where I need to learn a lot especially considering that I need first to master the English language.
No design is perfect from the start; all designs need to be modified as they are implemented. If you are also a developer on the project, value the time you spend writing code, and don't believe anyone who tells you it's a distraction from you work as architect.
It is important to accept that you can't design everything upfront in a perfect way. Adopting an iterative process is mandatory. In addition, a software architect is still a developer and I believe he should never stop writing code.
Commit and run is a crime because it kills flow. It's one of the most common ways for a developer to try to save time for himself, and it ends up wasting other people's time and is downright disrespectful. Why? Usually because it takes too long to build the system properly or to run the tests. Invest time in making the system fast to work with.
This is true and I have to admit happened to me sometimes. With very big projects sometimes the build time is very long and you need to do as much as you can in order to speed up the system but it is not always possible. At least, you shouldn't commit at the end of the day with the risk of breaking the build and create problems for your team.
The architect, in conjunction with development management, must create and nurture the means for regular, ongoing information feedback loops. A way is doing frequent releases of working software to the business starting early in the project.
I agree. When possible, involving the customers early and continuously in the project can be very beneficial.
A good architect should lead by example. He should be able to fulfill any of the positions within his team, from wiring the network and configuring the build process to writing the unit tests and running benchmarks. It's difficult to imagine how team members can have confidence in their architect if the architect doesn't understand the technology.
I believe that this is something theoretically true but practically extremely difficult to achieve.
"Fast" is not a requirement. Neither is "responsive". Nor "extensible". The primary reason why not is that you have no objective way to tell if they're met.
This sentence want to remember the importance of having requirements that can be measured (example: "Respond under 5 seconds").

Specifications alone have no value. The ultimate goal of a software project is a production system. A software architect must always keep an eye on this goal, and remember that design is merely a means to an end
Interesting. It seems that when you become an architect you love so much your design that you tend to consider it like the end result.


It is perfectly respectable for an architect to ask for help from the team. The team should feel it is part of the solution, but the architect should chair the discussion and identify the right solution(s).
The architect does not have to make the decision, he or she merely orchestrates the decision making process.
When I went to DevWeek 2012 I had the opportunity to discuss with a speaker (that was an senior architect) and I remember very well how much he underlined the importance of his team. As usual, it is all about trust.
Negotiating skills and a knack for influencing people can be valuable resources.
It is always good to learn more about psychology and it usually fascinate me.
Every software architect should know and understand that you can't have it all. It is virtually impossible to design an architecture that has high performance, high availability, a high level of security, and a high degree of abstraction all at the same time. There are several tools available to architects to determine what the tradeoffs should be when designing an architecture. Two popular methods are:
  • Architecture Tradeoff Analysis Method (ATAM)
  • Cost Benefit Analysis Method (CBAM)
I didn't know about this popular methods. Good to know.
Most software developers are optimists. Natural pessimists on development teams are often unpopular, even if they are consistently right.
I have one of my co-worker that is very defensive during programming. At the beginning I didn't understand some of his reasons but in the long term, I understood many things and he actually taught me a lot. If you want to design and develop rock solid products, you have to be a little bit paranoid (this is the word he like using), consider edge cases and test the system as much as possible. Never overlook the details!
Architects pour themselves into each design. Criticism of your creation feels like criticism of you. Defensiveness is easy. Learning to stop it is hard. Pride in our accomplishments is easy.
This is again obvious psychology. I think that it is extremely important to be able to accept constructive feedbacks and be open to suggestions.
How can we see quality? Aggregates large amounts of data and multiple metrics, such as method count, class fan out, cyclomatic complexity. Once a suitable view is available, software quality becomes a little less subjective.
Software quality is such an interesting topic and many organizations have lots to learn I think. I don't have strong knowledge about metrics but it is something I should look at more closely.

The post is getting longer than expected so I now simply share the remaining interesting quotes that are quite self-explanatory.
Accepting the fact that programming - or more precisely software development - is a processes of discovery and learning not a process of engineering and construction, is fundamental to bringing software practices forward.
As a developer you rarely get the time to sit back and really look at how the whole system fits together. AS an architect, this is your main focus. If you are doing a great job of being an architect, you really shouldn't have enough time to interfere with developers. You do need to watch closely enough to see that the design is being implemented as intended. It is reasonable to make suggestions when you see people struggling, but it's even better if you create the environment where they come and ask you for suggestions.
We say it to ourselves: keep it simple, stupid. We say it, but we don't do it. When an architect enters a project, there is an understandable desire to prove his or her worth. Showmanship, the act of appealing to your audience, is important in marketing, but it's counter-productive to leading a software development project.An architect must act in the best interests of his customer and not pander to the needs of his own ego. The simple problem-complex solution trap can be an easy on to fall into because we like to demonstrate our knowledge.
Never forget that you are playing with other people's money.
Software architecture is a craft, and it certainly takes practice and discipline to achieve success in the field.
Every time I make a decision about how a program behaves, I am really deciding what my users can and cannot do. It's not ethical to worsen the lives of others, even a small bit, just to make things easy for yourself. It's OK to release an application that only does a few things, as long as users value those things enough to pay for them. In fact, the earlier you release your application, the greater the net present value of the whole thing will be.
To be an effective software architect you must understand the basic architecture and design patterns, recognize when those patterns are being used, know when to apply the patterns, and be able to communicate to other architects and developers using them. It is also important to be aware and understand the various anti-patterns as well. Don't let your desire to exhibit design pattern knowledge could your pragmatic vision.
Sometimes the most important decisions are not about what you put in, but rather what you omit.
The architect should concede to good ideas and cultivate an atmosphere for ideas to grow. It is an open mind that will succeed in architecture. To the extent your responsibilities allow, you should do everything possible to empower your developers. Protect developers from non-essential parts of their job. Too much paperwork and too many office chores add overhead and reduce their effectiveness.
It should be made clear to you, your managers, developers, and other software stakeholders why one solution was chosen over another and what tradeoffs this entailed. Benefits:
  • It forces you to be explicit about your reasoning in order to verify that your foundations are solid. 
  • It can be used as a starting point to re-evaluate a decision when the conditions that influenced it have changed.
Assumptions should be visible and explicit for the sake of posterity and for future re-evaluation. It is even more critical to make sure that any assumptions that aren't based on relevant empirical evidence be validated before a decision is finalized.
The best and easiest way of working through it is to attempt to explain it to another person. We really want to share our knowledge and experience to help the industry progress; we also realize it helps us to understand and correct it.
Since over 80% of an application's life cycle is spent in maintenance, you should pay a lot of attention to the problems of support and maintenance when you're designing. Make the support lead a core part of the team. Involve a support lead with the planning for the application support. Design such that the learning curve for the support personnel is minimal. Traceability, auditing, and loggin are crucial.
Remember this: when you try to guess at future requirements, 50% of the time you're wrong and 49% of the time you're very very wrong. Get the application out the door on time and wait for feedback to generate real requirements.
Don't give in to the temptation to make your design, or your implementation, perfect! Aim for "good enough" and stop when you've achieved it.
The business is our reason for existence. Show the business domain experts the respect you expect to receive.
Don't use a pattern in your design that you haven't personally implemented before. Don't rely on a framework that you haven't coded against before. Don't use a server that you haven't configured before. If your architecture depends on design elements that you haven't personally used, there are a number of negative side effects: you won't be able to give good estimate, you will not know the pitfalls to avoid when using the elements and you will lose the confidence of your developers. When they ask questions about the design and you aren't able to give solid answers, they will quickly lose confidence in you and your design. Before anything, an architect is a developer.
Ingenuity is a key trait of successful architects. However, an equally important characteristic of the activities of a successful architect is diligence. It is an exercise in perseverance and paying the right amount of attention to each task and each architectural goal of the system.
You should not claim that an architectural decision has been made until the following two conditions are met:
  • A decision has been put in writing because architectural decisions are rarely trivial. They must be substantiated and traceable.
  • A decision has been communicated to the people who execute it and the people who will be affected directly or indirectly.
Clever software is expensive, hard to maintain, and brittle. Don't be clever. Be as dumb as you possibly can and still create the appropriate design.
You need to carefully select your development team and diligently protect it once assembled. Good developers are often strongly motivated by recognition. Use this fact to your advantage and acknowledge stellar performances. Finding great developers is difficult; letting people know they are valued is not. Don't miss simple chances to build morale and boost productivity.
I would like to finish with a quote from Grady Booch:
Grady Booch: "All architecture is design but not all design is architecture. Architecture represents the significant design decisions that shape a system, where significant is measured by cost of change".
An effective architecture is one that generally reduces the significance of design decisions.


Saturday, 1 September 2012

Goodbye to my technical paper books!

Since I moved in UK I never had the time to throw all my books from the big display cabinet in my living room in Italy. This mean that I forced my parents and my sister not to use the display cabinet for such a long time.

Today, I decided to select all the books that I can remove from there and put in the bin.

It is a little bit sad but this is the time when some cleaning is required. Any of these books in some way shaped me and my professional knowledge but all of these are obsolete and surely I don't plan to read them again or use them as a reference.


Hopefully, I will not have this problem any more in the future because I am now only buying eBooks. The Kindle is absolutely my favourite device and it changed my life radically. Now, I can brings thousands of books everywhere and access them any time.

There are some books, however, that have a special meaning for me and even if they are obsolete I could never throw them. In particular "Da Visual Basic a C#" is the book that introduced me to the C# language and the .NET Framework that is actually my favourite platform and where I invested professionally my last years. "Algoritmi in C" has been the book that I used to prepare myself to the  Italian Olympiad of Informatics in 2003 and to prepare my secondary school thesis about algorithms analysis. The other two books are the books that introduced me to VB when I was 13 years old.


Here other books that I want to keep for reference and that I will consider to bring in UK or simply buy a new digital version of them.



If you are still not sure to buying an eBook reader you should consider how the "weight" problem is brilliantly solved by these devices. In the future, I will always have access to my full books library and I will never have this problem.

Here you can access the list of all the books I read:
http://www.anobii.com/angellaa/books



Wednesday, 8 August 2012

Book - Software Craftsmanship: The New Imperative

As you probably know, I recently joined a new community called Cambridge Software Craftsmanship. I finished to read one of the movement inspiring book and in this post I would like to share the most interesting things I found in it.


Even if the book is quite old considering the speed at which the world of the computer programming change, I have to say that the book is still very actual.

The book start introducing the definition of software engineering from IEEE:
IEEE - Software engineering is the application of a systematic, disciplined, quantifiable approach to development, operation, and maintenance of software; that is, the application of engineering to software
The most successful project using a complete and robust software engineering approach was the space shuttle software. 
Space shuttle software was 420000 lines long with 1 error. It last 11 versions with a total of 17 errors. Commercial programs of equivalent complexity would have 5000 errors.
This is a proof that using a rigid and structured approach is very effective at developing safety critical systems. However the cost are usually exorbitant and in the average software development this approaches does not work very well. It is in this context the the term Craftsmanship has been introduced and compared/contrasted with the term software engineering.
Craftsmanship is a solution to the problem of delivering robust, high-quality applications to users in a relatively short time for reasonable cost. 
Software engineering is a solution to a different set of problems, involving life or safety-critical systems, real-time and embedded systems, and systems engineering projects. In these types of problems craftsmanship approach is not the best one. Incremental development and evolutionary delivery are not feasible strategies.
Other sentences about this topic:
Good enough software is a logical extension of the ideas of software engineering
Software engineering makes us forget that what really matters on a project is the skill, knowledge and experience of the individual software developers.
Craftsmanship is not a rejection of science and engineering, but rather a subtle blending of man, machine, and knowledge to create useful artifacts.
Software craftsmanship is a mindset and an attitude, rather than a body of knowledge.

This is the main point. At the foundation of everything, regardless of if you consider yourself a craftsman or engineer, there is the constant interest in improving yourself, in becoming better in what you do and learn from others and share with others. 

Learning and mentoring is a big topic and the following are significant sentences:
Working with masters is the best way to learn a craft.
Learning from each other is an essential part of software development.
Learn how to collaboratively deliver software is one of the key challenges new developers face when they start working on real projects.
Software development works best when the developer has a deep understanding of the requirements, design and source code.
Claims that good developers can pass the certification exams are made, but the hidden implication that passing the exam means you are a good developer is really the classical problem of confusing correlation with causality. The fact that a developer has passed a certification exam says nothing about that person's ability to develop a useful application, only that he has learnt how to pass the exam.
The concept of a single, responsible engineer signing off the complete work is not feasible for software.
If a person became an apprentice to a great developer instead of studying for a degree, maybe the outcome would be even better.
Rather than being known for their degrees, memberships, or certificates, the real credentials for developers consist of the applications on which they have worked.
Enthusiastic beginners not only renew the craftsmen, but also challenge the craftsmen by bringing in new ideas from outside. The power of this synergy has to be felt to be believed.
One of the traits associated with true mastery of any craft has been humility. Master craftsmen are always willing to learn and are able to admin their own mistakes.
Master practitioners ask lots of questions and then deliver what you really need (as opposed to what you actually asked for).
The key questions is: "Has he infected his colleagues with his enthusiasm and passion for the craft of software development?".
By reading and asking intelligent questions, apprentices will be able to pick up most skills without being formally taught.
Maintaining and enhancing live applications give journeymen the best environment for improving their craft.
Experiences developers should be involved in the creation of training courses for other developers.
Practise without feedback just reinforces errors.
In found particular interesting and challenging the following:
Software craftsmanship rejects the software engineering notion that it is impossible for one person to know the entire system. Instead, it celebrates virtuosity and talent.
One of the keys to high productivity is in-depth knowledge of the entire application
It is actually a fact that the most effective people on a team are usually the people that know a lot about the system. The problem here is how can you achieve this, how can you improve the communication across developers in order to achieve more productivity. The following sentences is an answer to this question but is it feasible?
Working in a closely knit team where everyone reviews one another's work on a daily basis means that, even without trying, a journeyman will gain a real breadth of experience about software development.
The software engineering metaphor makes us believe that software development is manual labor. It makes us believe that the division of labor is a good thing that should be used in software development. It makes us believe that there are standard best practises that everyone should adopt. This notion is not true, however.
By creating artificial specialities with narrow skill sets, software engineering makes it impossible for one person to understand the entire application. Rather than encouraging developers to cross-train so that they can understand all of an application, software engineering promotes the myth that what is needed instead is good documentation. Unfortunately, although documentation is very good for recording decisions and agreements, it is a very ineffective way of preserving and communicating detailed knowledge of how a software application actually works. Software engineering has given documentation a very bad name. Many projects practically run without any documentation because inexperienced developers rebel against this software engineering view.
I understood that the key here is to have small teams of great and passionate developers that are usually much more effective that a huge team with average developers.
Small teams produce better software.
Journeymen prefer to work in small team. There is little value in being part of a very large team, because their contributions are unlikely to stand out.
Software engineering fails to pay attention to the most important component of the software development process - the people. The most likely reason for this omission is that individuals show up only in small teams.
Technical knowledge is mush less important than the ability to integrate well with the rest of the development team. 
If co-location is impossible for your project as it often is for truly global projects, you need to pay special attention to communication. Make sure that you take the time to gather people together so that they can get to know one another. Although travel costs may be high, they will be offset by fewer misunderstandings and much smoother communication when people return to their normal locations.
One really good developer is more valuable to your project than five average developers.
It is a good practice to reward exceptionally productive developers, because they make the difference between success and failure.
An another important topic in the book is the relationship between users and developers:
It might seem counter-intuitive, but designing for a single user is the most effective way to satisfy a broad audience. Develop a close working relationship with a small number of users, and then create the best possible application for these users. Then the application will be ready for release to the mass market.
Customers just have to start insisting on high-quality, robust software and choosing their developers based on their reputation for delivering that kind of software.
Craftsmen enjoy being able to delight their users with the speed with which they can make changes.
A professional care about the quality of his job and base his reputation on that:
Craftsmen build their reputations based on the quality of what they deliver to their customers.
It is better to have a functional, rock-solid, minimal-feature release than an unstable, buggy release with features that don't quite work properly.
Good developers know how long things take and are rarely willing to sign up for delivering the impossible.
It is hard to find developers with 30 or more years of experience. Few remain as developers for a long time. This exodus is a real problem.
You should encourage you developers to get involved in local user groups and technical associations.
Once a developer is confortable presenting locally, the next step is to start presenting at conferences.
Technology is an another important topic related to the application lifecycle management:
Software craftsmanship values long-lived technologies and programming languages.
Very few applications have a planned life of less than five years, whereas few software development tools are designed to be stable over that time frame.
Why don't developers focus their attention on becoming really good at using the existing tools?
Think long and hard about why you want to use a new technology.
Treat software as capital. Make maintenance a priority during the initial development.
Start making your applications testable.
If you are going to build in flexibility, make sure that it will be needed. If you cannot predict how much flexibility will be needed, then make the application as easy to change as possible.
Consider whether your development tools are likely to remain stable for the lifetime of the application.
The major challenge when designing for testing and maintenance is to build sufficient diagnostics and instrumentation into an application.
The challenge the software craftsmen face is one of keeping up with all of the evolving technology so that they can create high-quality, robust applications even when using bleeding-edge technologies.
I would like to finish with some extra general sentences:
Good developers are more valuable than their managers.
Craftsmen take pride in completion.
Trust the craftsmen you know to recommend other craftsmen.
Evaluate Craftsmen based on their reputations and portfolio.
Creating an orphan application is not a good way to enhance one's reputation.
This book inspired me and I hope you found this summary useful and interesting. Everyone of this sentences is a good starting point for a discussion so feel free to add comments. I am eager to know your opinions on this topics.










Tuesday, 24 July 2012

My Green Band: Clean Code

Today, my green band is arrived :)




Do you know what is it?

The famous Uncle Bob (Robert C. Martin) wrote two brilliant books:

  • Clean Code
  • The Clean Coder

He is mission is to help raising the level the profession of the Software Engineers and surely one of the most important thing is learning how to write clean code.


He suggests to dress the green band as a way to remind yourself about the importance of writing clean code so that all the time you are in the process of submitting crap code you can feel bad about it. Evil? I will find out.


It is a little bit too tight but I hope will become more comfortable after a while.


You can "buy" the band and other gadgets at the following address:
http://butunclebob.com/ArticleS.UncleBob.GreenWristBand

Happy coding :)



Wednesday, 4 July 2012

Cambridge Software Craftsmanship community was born


Yesterday, a new great local community was born!


It is a pleasure for me to have taken part of the inaugural event and I would like to thanks the organizer Alastair Smith to believe in this initiative. I am a strong believer that communication, sharing of knowledge is a key part to be a better professional and a better person in any fields and for this reason I strongly believe that any initiative oriented in this direction can only be a success.

The main idea of the community is to follow the principles of the Software Craftsmanship movement and organize events in order to learn and master the craft. 

If you want to learn more about the movement Wikipedia is a great resource:

A another must is the interview to Robert C Martin:


Finally, there are some books that inspired the movement:

I still have to read the last two books but I will do it relatively soon.

The plan of the group is to organize every first Tuesday of the month a round table in order to discuss about various topics. We usually select various topics, we prioritize and then we discuss them.

In the future, once located a suitable venue, we would like to organize hands on lab when we can actually code in pairs. This is by far what I am most interested about. 

If you live in Cambridge or around the city and you would like to be involved in these initiatives please don't hesitate and join us. The more we are, the better.

This is a community for those who believe that being average is just not good enough.

Wednesday, 27 June 2012

A Snake game entirely written in assembler

Snake is always been for me my hello world program. I implemented it in many different languages Basic, C, C++, Java and Javascript. But I didn't limited myself at high level languages. At the second year of university (something like 7 years ago) I actually implemented it entirely in assembler MASM in roughly 600 lines of code. It is so old that the variables and the comments are in italian :)


Unfortunately I can't run it (and provide a screenshot of the game) because is using a library called compatib that I am not able to find. Friends can confirm that this code actually worked at the time :)



This is the main procedure:



This is the game loop:


This is the procedure that print the snake on the screen:


The entire code is available in my repository on copeplex.

This program is very old but I still remember the feeling after I implemented it in one evening and in particular the satisfaction of the following day when I showed it to my class mates. They were shocked!

This is what I call fun!



Sunday, 17 June 2012

BigInteger multiplication - A recursive approach

Recently in the Coursera course "Algorithms: Design and Analysis, Part I" I come across to an interesting introduction of the divide and conquer technique using the multiplication between big integers as an example. My hands started to itch immediately. I would have to try to write an implementation!

The Problem

Given two integers x and y of any size return the product of them.

The Idea

The simplest algorithm is what we are all used to do, writing down all the products and then add them together. This is know as the "Long Multiplication" algorithm.

Using a simple calculus is easy to understand that the problem can be solved using a recursive approach. 

It is always possible to write x and y in the following way:



So the product can be calculated as:


This means that we can calculate the product xy calculating 4 small products (ac, ad, bc, bd) in a recursive way.

More info:

The Implementation

For simplicity, I decided to represent a number using a string encapsulated in a class called MyBigInteger.

This is the implementation of the multiplication algorithm in C#:


In order to implement the algorithm I also had to implement the sum between two big numbers using the classic mathematical way:


The full code is available in my personal repository (BigIntegerMultiplication).

Tests


Improvements

In this example, we have a recursive tree with 4 branches. In reality it is possible to have only 3 branches using a simple trick (Karatsuba multiplication).

Instead of calculating ac and bd directly it is possible to calculate first:


and then calculate (ad + bc) using a subtraction:


In order to implement this slightly improved version of the algorithm is necessary to implement the subtraction of two big integers. I didn't wanted to do it, so I don't have an implementation to share.

Conclusion

The purpose of the exercise was to prove to myself that I was able to build the algorithm based on the original idea presented in the course. I would like to let the reader aware that the .NET framework already implement a comprehensive class that implement the operations on big integers in a quick way: BigInteger.