Software architecture – how vital is it to your organization?

I am biased. As a software architect I believe in the importance of this skill to the success of almost every software project.

I have seen myself how software projects become crippled when work is done without the help of a knowledgeable and experienced software architect.

Let’s do a quick summary on how Software Architecture can save your software project lots of money, time and effort. It may even determine success and failure for your organization.

What can Software Architecture do for you and your business?

  1. Reduce your cost of software development,
  2. Reduce the cost of software maintenance,
  3. Increase the speed in which you roll-out new features, and
  4. Reduce errors and possible bugs in your software.

All in all, it can make a difference between creating a solution that is unreliable, untrustworthy and hard to improve – vs. – a solution that provides consistent results, scales well and can be more easily updated when your business requirements change.

If you are building a software solution without an experienced software architect providing your development team with some architectural guidance, I would compare that to walking in the woods without a compass or a GPS. You may end up going in circles while making little progress in reaching your intended destination.

Adding custom filters to an MVC API OData query request

I needed to examine every OData request and add custom filters based on the specific business rules. The additional filters would be based on who is logged in (and their access levels), the properties of the entities requested at the root level and the properties of any entities that are being expanded.

My solution was to examine all entities (root and expanded) for their properties and then add any additional $filter options I needed at the root filter of the request ODataUri.

(OData v4 supports filtering in $expand clauses but the filterOption in the expanded entities is read only so you cannot modify the filter expressions for the expanded entities. You can only examine the filterOption contents at the expanded entities.)

Here is an example OData request Url:


Below is the same OData request Url after I updated it:

/RootEntity?$filter=OtherEntity/SomeOtherEntity/Id eq 3&$expand=OtherEntity($expand=SomeOtherEntity)

Steps I used to accomplish this:

1. Use ODataUriParser to parse the incoming Url into a Uri object

var parser = new ODataUriParser(model, new Uri(serviceRootPath), requestUri);
var odataUri = parser.ParseUri();

2. Create a method that will traverse down from the root to all expanded entities and pass the ODataUri by ref (so that you can update it as needed as you examine each entity)

The first method will examine the root entity and add any additional filters based on the properties of the root entity.

AddCustomFilters(ref ODataUri odataUri);

The AddCustomFilters method will the traverse the expanded entities and call the AddCustomFiltersToExpandedEntity which will continue to traverse down all expanded entities to add any necessary filters.

foreach (var item in odatauri.SelectAndExpand.SelectedItems)
   AddCustomFiltersToExpandedEntity(ref ODataUri odataUri, ExpandedNavigationSelectItem expandedNavigationSelectItem, string parentNavigationNameProperty)

The method **AddCustomFiltersToExpandedEntity** should call itself as it loops over the expanded entities at each level.

3. Update the root filter as you examine each entity

Create a new filter clause with your additional filter requirements and overwrite the existing filter clause at the root level. The $filter at the root level of the ODataUri has a setter so it can be overridden.

odataUri.Filter = new FilterClause(newFilterExpression, newFilterRange);

Note: I created a new filter clause using a **BinaryOperatorKind.And** so that any additional filter expressions are simply appended to any existing filter expressions already in the ODataUri

var combinedFilterExpression = new BinaryOperatorNode(BinaryOperatorKind.And, odataUri.Filter.Expression, newFilterExpression);
odataUri.Filter = new FilterClause(combinedFilterExpression, newFilterRange);

4. Use ODataUriBuilder to create a new Uri based on the updated ODataUri

var updatedODataUri = new Microsoft.OData.Core.UriBuilder.ODataUriBuilder(ODataUrlConventions.Default, odataUri).BuildUri();

5. Replace the request Uri with the updated Uri.

This allows the OData controller to complete processing the request using the updated OData Url which includes the additional filter options you just added to the root level filer.

ActionContext.Request.RequestUri = updatedODataUri;

This provided me with the capability to add any filtering options I need and I can be sure sure that I have not altered the OData Url structure incorrectly.

I hope this helps someone else when facing this same issue.

Love Github? Bring it into your organization.

I love using GIT as a source control tool.
When I pair it with the GitHub site, it is just simply computer programming at its most efficient!

GitHub provides a great way for me to easily:

  • track project commits,
  • review the changes that everyone else had added to a project,
  • comment and discuss on specific changes,
  • add Wiki-style documentation to every project,
  • give customers access to their source code, and
  • allow customers to see progress and review the changes made in every commit

I use GitHub for almost every one of my projects
– but sometimes I work on projects where top management does not trust having their source code stored in a repository that is not hosted in their own internal servers.

Enter Github for Enterprise!

It has a steep price (min. $5,000) and it is priced by users. But if you love GitHub and you think (as I do) that it is important to have a source code repository that is powerful and flexible, then this might be a very valuable tool for you to examine for your organization.


Great resources for computer programmers

Looking for examples of open-source solutions that you can examine to learn better ways of programming? Check out some of my favorites:

All of these have hundreds of small, medium and large projects that are freely available for you to download and study their source code.

By studying someone else’s work you will learn new techniques, concepts and practices that will improve your own projects.

Let’s get more kids learning computer programming

Computer programming sounds incredibly boring to most kids (and adults) – that is, until they try it.

For some people it can be an incredibly addictive and challenging experience. Once they being to understand that a computer is a tool that they can control and that it will obey everything that they tell it to do – they begin to understand the power that they hold in their hands. They can turn their ideas into real working games and they can create programs that can accomplish complex tasks.

I myself started to write computer programs when I was 8-10 years old. My dad bought a TRS-80 computer which came only with a simple BASIC commands. Once I learned a few commands and I realized that I could get this thing to do anything I wanted it to do – I was hooked. It became a challenge to see what kind of things I could create on it – from games to school projects.

Best part of it all is that – if someone really enjoys this challenge – it can easily become a fulfilling and lucrative career. Computer programming is already one of the most well-paid opportunities in today’s job market. Kids right out of college with solid computer programming skills are easily getting salaries that are above 40K/year to start.

If you are a parent or a student looking to learn more about programming for a teen or a young professional, visit the following site for more info:

If you have a child that is not yet a teen and wish to introduce them to the world of computer programming, check out the following article for some great ideas that may get young kids interested in this area of technology.

Also check out the following related article:

“Everyone should learn programming”

Want to clear up your memory usage?

I use an AlienWare Quad-core i7 laptop with 16GB of RAM and an SSD. Even with this much hardware on my side my memory utilization may go near 100%. I am usually running numerous apps at the same time (code editors, photo editors, databases, web hosts, programming tools, etc.).

The strange thing is that if I start closing down apps, the memory utilization may not go down as much as I would expect. It seems that some of the programs I use do not always release the memory they allocated properly so even though I shut down the app, the memory it allocated still shows as tied up and is unavailable for my remaining running programs.

Then I discovered RAMMAP!

This is a tool by Sysinternals that will help you to release the allocated memory that these programs did not release. To use it, simply download it and run it (it is a single EXE that does not require an install).

Menu -> Empty -> Empty Working Sets

As soon as you select this option, you will see a dramatic drop on the amount of utilized memory in your computer.

Best of all this tool it FREE! If you want a copy of RAMMAP go to:

PluralSight is training for all serious developers

PluralSight is training for all serious developers

Lately I am addicted to this site. Technology moves at an incredible pace. It feels that it is almost impossible to keep up with all of the latest new ideas in software development.

PluralSight training provides me a good amount of knowledge in any new area of interest I may have or that I may need for an specific project. PluralSight helps me to quickly add new skills into my bag of tricks. Once I complete a PluralSight training I can then look for books, blog postings or other resources that may dive deeper into the concepts and ideas I just picked up.

Technology moves fast – as a software engineer we need to move even faster!