Thursday, June 9, 2016

Test-driven development

Test-driven development (TDD a.k.a. test-first programming) represents an important change to the way most programmers think about writing code. The practice involves writing a test before each new piece of functionality is coded into the system. It is a software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only. This is opposed to software development that allows software to be added that isn't proven to meet requirements.
An interesting fact about bug-free code is that as the code is further developed, the bug count in it is less likely to increase than in code that is known to have bugs. Developers are more careful to ensure they do not introduce any errors to a solution that is bug free than they are when the solution is riddled with issues. It is what is known as "broken window syndrome". When code starts to fall into disrepair (has bugs), a typical belief follows that a few more bugs will not make any difference because the code is already broken. Therefore, it is important to keep the quality of the code high all the way through the process.
To develop zero-defect software, you need some tools and the correct way of thinking about quality. One of the most powerful tools is unit testing; and by developing the tests before writing the solution code, you are "turning the volume up." NUnit is a .NET Framework class library that can locate unit tests that have been written in your project. NUnit comes with a GUI windows application and a console-based application that both enable you to run the tests and see the results. Tests either pass or fail, as indicated by a green or red progress bar, respectively.
The tests were intended to increase your confidence in the code you are writing. The tests are driving the development process. By writing the tests first, you should find your focus on the code you are writing changes substantially. Your goal now is to define how the class will be used with a test method and then to get the tests to pass.

Tuesday, May 31, 2016

eCommerce : Structure, Information Architecture, SEO

Electronic commerce, commonly written as e-commerce or eCommerce, is the trading or facilitation of trading in products or services using computer networks, such as the Internet. Electronic commerce draws on technologies such as mobile commerce, electronic funds transfer, supply chain management, Internet marketing, online transaction processing, electronic data interchange (EDI), inventory management systems, and automated data collection systems. Modern electronic commerce typically uses the World Wide Web for at least one part of the transaction's life cycle, although it may also use other technologies such as e-mail.

Information Architecture (IA) may sound dull but it’s a critical component of ecommerce and helps put the right data structures and standards in place to enable, amongst other things:
  • Site & catalogue structure
  • Core processes & functions e.g. site search
  • Business reporting & web analytics
  • SEO
Search Engine Optimization (SEO) is really just a series of educated guesses. It is educated guessing mixed with data-driven decisions that lead to more educated guesses and more data-driven decisions. Fear not though because even within all this guessing remain some basic principles and best practices. The most important SEO consideration for an eCommerce website is the website’s categorical structure / website architecture.

nopCommerce - ASP.NET open-source ecommerce software
nopCommerce is the leading open source shopping cart, allowing anyone to set up an online store quickly and easily.
One key feature of the nopCommerce is its pluggable modular/layered architecture which allows additional functionality and presentation elements to be dynamically added to the application at run-time. This pluggable modularized architecture makes it easy to create and manage your web sites.
 

Topshelf : Easy to create a Windows service

Topshelf is a Windows service framework for the .NET platform. Topshelf makes it easy to create a Windows service, test the service, debug the service, and ultimately install it into the Windows Service Control Manager (SCM). Topshelf does this by allowing developers to focus on service logic instead of the details of interacting with the built-in service support in the .NET framework. Developers don’t need to understand the complex details of service classes, perform installation via InstallUtil, or learn how to attach the debugger to services for troubleshooting issues.
Topshelf works with Mono, making it possible to deploy services to Linux. The service installation features are currently Windows only, but others are working on creating native host environment support so that installation and management features are available as well.

Reference Link: http://topshelf-project.com/

Friday, April 22, 2016

Comparison of RabbitMQ, ActiveMQ, and ZeroMQ Message Brokers

RabbitMQ ZeroMQ ActiveMQ
RabbitMQ is one of the leading implementation of the AMQP protocol (along with Apache Qpid). Therefore, it implements a broker architecture, meaning that messages are queued on a central node before being sent to clients. This approach makes RabbitMQ very easy to use and deploy, because advanced scenarios like routing, load balancing or persistent message queuing are supported in just a few lines of code. However, it also makes it less scalable and “slower” because the central node adds latency and message envelopes are quite big.

RabbitMQ is a Message Queue Server in Erlang

It stores jobs in memory (message queue)
ZeroMQ is a very lightweight messaging system specially designed for high throughput/low latency scenarios like the one you can find in the financial world. Zmq supports many advanced messaging scenarios but contrary to RabbitMQ, you’ll have to implement most of them yourself by combining various pieces of the framework (e.g : sockets and devices). Zmq is very flexible but you’ll have to study the 80 pages or so of the guide (which I recommend reading for anybody writing distributed system, even if you don’t use Zmq) before being able to do anything more complicated that sending messages between 2 peers.

The socket library that acts as a concurrency framework

Faster than TCP, for clustered products and supercomputing

Carries messages across inproc, IPC, TCP, and multicast

Connect N-to-N via fanout, pubsub, pipeline, request-reply

Asynch I/O for scalable multicore message-passing apps
ActiveMQ is in the middle ground. Like Zmq, it can be deployed with both broker and P2P topologies. Like RabbitMQ, it’s easier to implement advanced scenarios but usually at the cost of raw performance.

ActiveMQ is an open source message broker in Java

Supports many advanced featuressuch as Message Groups, Virtual Destinations, Wildcards and Composite Destinations.

Wednesday, April 20, 2016

Object Modeling

The goal in object modeling is to render a precise, concise, understandable object-oriented model, or "blueprint," of the system to be automated. This model will serve as an important tool for communication:
  • To the future users of the system that we are about to build, an object model communicates our understanding of the system requirements.
  • To the software development team, an object model communicates the structure and function of the software that needs to be built in order to satisfy those requirements. This benefits not only the software engineers themselves, but also the folks who are responsible for quality assurance, testing, and documentation.
  • Long after the application is operational, an object model lives on as a "schematic diagram" to help the myriad folks responsible for supporting and maintaining an application understand its structure and function.
The design of complex systems invariably changes during their construction, so care should be taken to keep the object model up-to-date as the system is built.
Modeling Methodology = Process + Notation + Tool
According to Webster's dictionary, a methodology is
    A set of systematic procedures used by a discipline (to achieve a particular desired outcome).
A modeling methodology, ideally involves three components:
  • A process: The "how to" steps for gathering the requirements and determining the abstraction to be modeled
  • A notation: A graphical "language" for communicating the model
  • A tool: An automated way of rendering the notation, typically in "drag-and-drop" fashion
Although these constitute the ideal components of a modeling methodology, they are not all of equal importance.
  • Adhering to a sound process is certainly critical.
  • However, we can sometimes get by with a narrative text description of an abstraction without having to resort to portraying it with formal graphical notation.
  • And, when we do choose to depict an abstraction formally via a graphical notation, it isn't mandatory that we use a specialized tool for doing so.
Object modeling tools fall under the general heading of Computer-Aided Software Engineering, or CASE, tools. CASE tools afford us with many advantages, but aren't without their drawbacks.

The Advantages of Using CASE Tools:
  • Ease of Use - CASE tools provide a quick drag-and-drop way to create visual models.
  • Added Information Content - CASE tools produce "intelligent" drawings that enforce the syntax rules of a particular notation. This is in contrast to a generic drawing package, which will pretty much let you draw whatever you like, whether it adheres to the notational syntax or not.
  • Automated Code Generation - Most CASE tools provide code generation capabilities, enabling you to transition from a diagram to skeletal C# (or other) code with the push of a button.
  • Project Management Aids - Many CASE tools provide some sort of version control, enabling you to maintain different generations of the same model.
  • Flexibility - Some CASE tools support multiple graphical notations, enabling you to initially create a diagram in one notation but to then convert the diagram to another notation quickly and effortlessly.

Some Drawbacks of CASE Tools:
  • CASE tools can be expensive; it's not unusual for a high-end CASE tool to cost hundreds or even thousands of dollars per "seat."
  • It's easy to get caught up with form over substance! This is true of any automated tool - even a word processor tends to lure people into spending more time on the cosmetics of a document than is warranted, long after the substantive content is rock solid.

Thursday, March 31, 2016

Few C# Terms

Accessor
An accessor is a method which provides access to the value managed within a class. Effectively the access is read only, in that the data is held securely in the class but code in other classes may need to have access to the value itself. An accessor is implemented as a public method which will return a value to the caller. Note that if the thing being given access to is managed by reference the programmer must make sure that it is OK for a reference to the object is passed out. If the object is not to be changed it may be necessary to make a copy of the object to return to the caller.

Coupling
If a class is dependent on another the two classes are said to be coupled. Generally speaking a programmer should strive to have as little coupling in their designs as possible, since it makes it harder to update the system. Coupling is often discussed alongside cohesion, in that you should aim for high cohesion and low coupling.

Mutator
A mutator is a method which is called to change the value of a member inside an object. The change will hopefully be managed, in that invalid values will be rejected in some way. This is implemented in the form of a public method which is supplied with a new value and may return an error code.

Stream
A stream is an object which represents a connection to something which is going to move data for us. The movement might be to a disk file, to a network port or even to the system console. Streams remove the need to modify a program depending on where the output is to be sent or input received from.

Subscript
This is a value which is used to identify the element in an array. It must be an integer value. Subscripts in C# always start at 0 (this locates, the first element of the array) and extend up to the size of the array minus 1. This means that if you create a four element array you get hold of elements in the array by subscript values of 0,1,2 or 3. The best way to regard a subscript is the distance down the array you are going to move to get the element that you want. This means that the first element in the array must have a subscript value of 0.

Typesafe
Type-safe code accesses only the memory locations it is authorized to access. For example, type-safe code cannot read values from another object's private fields. It accesses types only in well-defined, allowable ways. When code is type safe, the common language runtime can completely isolate assemblies from each other. This isolation helps ensure that assemblies cannot adversely affect each other and it increases application reliability. Type-safe components can execute safely in the same process even if they are trusted at different levels.

Continuous Delivery

Continuous delivery (CD) is a software engineering approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time. It aims at building, testing, and releasing software faster and more frequently. The approach helps reduce the cost, time, and risk of delivering changes by allowing for more incremental updates to applications in production. A straightforward and repeatable deployment process is important for continuous delivery.
"Continuous Delivery is a software development discipline where you build software in such a way that the software can be released to production at any time" — Martin Fowler
Continuous integration (CI) is the practice, in software engineering, of merging all developer working copies to a shared mainline several times a day. Continuous Integration provides a framework for efficiently validating software in a predictable way. But to get the most out of it, you need to look at how it fits into the overall process of delivering software. In an agile project, you want to deliver working software at every iteration. Unfortunately, this is easier said than done; it often turns out that even if you implement CI and get the build process to produce a new installation package in a few minutes, it takes several days to get a new piece of software tested and released into production. To make this work better, the key is process. In order to deliver working software faster, you need a good cohesive set of tools and practices. So you need to add planning, environment management, deployment, and automated validation to get a great solution for your product, and this is just what Continuous Delivery is about.
Continuous Deployment is the practice of continuously pushing to production new versions of software under development. So Continuous Integration is all about quick feedback and validation of the commit phase, and Continuous Delivery is about establishing a mindset where you can deliver features at customer demand. Continuous Deployment is a third term that’s sometimes confused with both Continuous Integration and Continuous Delivery. Continuous Deployment can be viewed as the next level of Continuous Delivery. Where Continuous Delivery provides a process to create frequent releases but not necessarily deploy them, Continuous Deployment means that every change you make automatically gets deployed through the deployment pipeline. When you have established a Continuous Delivery solution, you are ready to move to Continuous Deployment if that’s something your business would benefit from.

Summary:
Continuous Integration is a software development practice in which you build and unit-test software every time a developer checks in new code.
Continuous Delivery (CD) is a software development practice in which continuous integration, automated testing, and automated deployment capabilities allow software to be developed and deployed rapidly, reliably and repeatedly with minimal manual overhead.
Continuous Deployment is a software development practice in which every code change goes through the entire pipeline and is put into production, automatically, resulting in many production deployments every day.