Wednesday, December 26, 2012

Microsoft WebMetrix

This is what Wikipedea says about Microsoft WebMetrix,

“Microsoft WebMatrix is a free, all-in-one, extensible web development application for Windows, developed by Microsoft. WebMatrix lets web developers build websites using built-in templates or popular open source applications, with full support for ASP.NETPHPNode.js and HTML 5.”
Here you can find more information about WebMetrix,


With WebMetrix we can develop web sites or applications from the scratch or Templates or by using the famous Open Source Applications like Wordpress, Joomla, DotNetNuke,mojoPortal, BlogEngine.NET and etc. It supports almost all the .NET and PHP Application platforms.

Most importantly it has removed the burden of configuring and setting up these Web Development Platforms and it’s just a few clicks to have everything ready. 

Saturday, May 26, 2012

Roslyn – C#, VB Compilers as APIs


I started developing software in  C language for the first time in my life and then did use Java language especially in university times.  Java, I used to write in notepad earlier days and then compile and run the Program using the command line (“javac” for compile and “java” for run the compiled program code).

But Java also has IDEs like NetBeens, Eclipse, JBuilder and etc, but I quite used to write the Programs in Notepad and that made me so competent in Java those daysJ. After moving to Microsoft Technologies, life was so easy of using the Programming Languages and Visual Studio is been providing numerous support for the developers for past few years. And that’s a great thing and that will give lots of time think about Program logics instead wasting lots of time learning the Program languages.

Just think about, how Microsoft does this, these huge set of features in Visual Studio?

They have been investing lots of money for this and it’s matured a lot too. With Roslyn what Microsoft does is expose those implementations for outside developers as APIs and so then they can use themselves those features in their system implementations.

That’s a huge benefit, because we were struggling lot in making things so dynamic in some business scenarios and wanted generate, compile and run the code on the fly. Earlier we did this with Code Dom library which is also delivered by Microsoft, but this time it has more features than earlier. And the Project name is “Roslyn”. Enjoy it.
Roslyn Project White Paper
Roslyn Project Home
If you google on this subject, “Microsoft Roslyn Project”, you will find more resources.
Lakmal

Friday, May 25, 2012

GUIDs


Uniqueness, hmm, how we can achieve the uniqueness?, that something depends on the environment you work on. We can have various algorithms to achieve uniqueness in different environments, but if you think of achieving uniqueness in globally, it’s a bit complex story. But Eric Lippert explains the things in simple way…

GUID Part one
GUID part 2
GUID Part 3

Lakmal

Sunday, April 22, 2012

.NET Attributes


.NET attributes can be used in different perspectives in .NET Programming.
  1.     Manage object meta data
  2.   Handle Help information
  3.   And more
When it’s come to the implantation of the .NET attributes, we have to know three key things,
  1. How we can declare attributes
  2. How we can use declared attributes in our implementation
  3. How we can access them at run time
How we can declare the custom .NET attributes
.NET attribute itself is a class that we have to implement. While implementing an Attribute, we have to make sure we do two things,
  1. Inheriting our attribute class from that Attribute class which is exists under the “System” namespace.
  2. Specify which types of elements can use the attribute that we are going to implement. This we have to do with AttributeUsage attribute, which is coming with the .NET framework. 


Please find an example of attribute implemented,
using System;
[AttributeUsage(AttributeTargets.All)]
public class HelpAttribute : System.Attribute
{
   public readonly string Url;

   public string Topic               // Topic is a named parameter
   {
      get
      {
         return topic;
      }
      set
      {

        topic = value;
      }
   }

   public HelpAttribute(string url)  // url is a positional parameter
   {
      this.Url = url;
   }

   private string topic;
}

I’m not going to explain things in details of these implementation of this .NET custom Attributes and we know the basics and lets jump into the next step.
How we can use the declared Attributes
If you are a .NET programmer, surely you have used .NET attributes already, because we have lots of .NET attributes coming with .NET framework that we have to deal with day today programming works. Since we have already implemented an attribute called “HelpAttribute”, unknowingly (maybe) we have used an attribute, which is coming with .NET framework, called “AttributeUsage”.
Using Attributes is simple; Let’s use the custom attribute we declared, called “HelpAttribute”,
[HelpAttribute("http://localhost/MyClassInfo")]
class MyClass 
{
}

So we used the attribute and provided a value for its parameter called “url”.
Now it’s time to access the attribute that used in MyClass class.
How we can access the attributes
Accessing the attributes at runtime has to be done with .NET Reflection. Here is a sample code that is used to access the values of attribute “HelpAttribute”.
class MainClass 
{
   public static void Main() 
   {
      System.Reflection.MemberInfo info = typeof(MyClass);
      object[] attributes = info.GetCustomAttributes(true);
      for (int i = 0; i < attributes.Length; i ++)
      {
         System.Console.WriteLine(attributes[i]);
      }
   } 
} 

I didn’t need to go in detail, but just wanted to give an idea about the .NET attributes, which is a powerful feature coming with .NET framework.
Please go through this MSDN tutorial for more information, if you are interested to learn more.
Lakmal

Wednesday, February 8, 2012

What is Software Architecture?


 “Perfect is enemy of good enough”, that is one of the phrase I always trying to remember when I got things to finished on time. Finishing things perfectly will take unimaginable time, but make it good enough will take the time that has to take truly. This I wanted to remind at the start of this article, because of , this is 100% true concept for the Software Architecting too.  
Knowing the basics will always put you on behind the safe margin always. Before going to look at what we can do with the “Software Architecture”, let’s see what the actual mean of it is,

Software application architecture is the process of defining a structured solution that meets all of the technical and operational requirements, while optimizing common quality attributes such as performance, security, and manageability. It involves a series of decisions based on a wide range of factors, and each of these decisions can have considerable impact on the quality, performance, maintainability, and overall success of the application.

This definition is not a one that I wrote myself, but I copied it from Microsoft web site, where you can find lots of resources on software architecture. There are lots of definitions that have been published by different peoples and organizations, for the Software Architecture. You can take time to Google and see more definitions.

Why is architecture important?
Like any other structure, Software also needs to have architecture itself to make sure few key requirements,

    ·         How will the users be using the application?
    ·         How will the application be deployed into production and managed?
    ·         What are the quality attribute requirements for the application, such as security, performance, concurrency, internationalization, and configuration?
    ·         How can the application be designed to be flexible and maintainable over time?
    ·         What are the architectural trends that might impact your application now or after it has been deployed?


The Goal of Architecture
What Architecture is trying do is, build a bridge between business requirements and technical requirements by understanding the Use Scenarios (Use Cases or User stories). In generally Architecture should,
·         Expose the structure of the system but hide the implementation details.
·         Realize all of the use cases and scenarios.
·         Try to address the requirements of various stakeholders.
·         Handle both functional and quality requirements.

The Architecture Landscape
It is always better to keep in touch with the architectural trends that shape the Software Architecture today.  There are key forces that demands to change this area of Software development,
 1.       Users and Business demands for faster results
 2.       Better support for varying work styles and workflows
 3.       Improved adaptability of software design


These are few of  key trends in Software Architecting,
 1.       User Empowerment
 2.       Market Maturity
 3.       Flexible design
       4.       Future Trends

The Principle of Architecture Design
Architecting and Designing the things upfront is almost impossible. Things are getting improved stage by stage as you learn more. These are the question that we have to consider while we create an Architecture Design,
·         What are the foundational parts of the architecture that represent the greatest risk if you get them wrong?
·         What are the parts of the architecture that are most likely to change, or whose design you can delay until later with little impact?
·         What are your key assumptions, and how will you test them?
·         What conditions may require you to refactor the design?
Always we have to keep options open for future changes.

Key Architecture Principles
These are the few of key architecture principles which I found,
·         Build to change instead of building to last. Consider how the application may need to change over time to address new requirements and challenges, and build in the flexibility to support this.
·         Model to analyze and reduce risk. Use design tools, modeling systems such as Unified Modeling Language (UML), and visualizations where appropriate to help you capture requirements and architectural and design decisions, and to analyze their impact. However, do not formalize the model to the extent that it suppresses the capability to iterate and adapt the design easily.
·         Use models and visualizations as a communication and collaboration tool. Efficient communication of the design, the decisions you make, and ongoing changes to the design, is critical to good architecture. Use models, views, and other visualizations of the architecture to communicate and share your design efficiently with all the stakeholders, and to enable rapid communication of changes to the design.
·         Identify key engineering decisions. Use the information in this guide to understand the key engineering decisions and the areas where mistakes are most often made. Invest in getting these key decisions right the first time so that the design is more flexible and less likely to be broken by changes.
It’s is always need to use incremental and iterative approach to refine the architecture.

Testing the Architecture
We can consider answering following questions while we are testing the architecture,
·         What assumptions have I made in this architecture?
·         What explicit or implied requirements is this architecture meeting?
·         What are the key risks with this architectural approach?
·         What countermeasures are in place to mitigate key risks?
·         In what ways is this architecture an improvement over the baseline or the last candidate architecture?

Conclusion
This is just an overview of what Software Architecture is. This is not complete coverage of the topic, but I wanted to remember and write things that I leaned from few sources. Most of time it’s Microsoft web site.  Hope to continue this discussion further with few key topics of Software Architecture.

Regards

Lakmal