Best Practices for better RESTful API Design

For this guide, I’m assuming you’re familiar with very basics concepts of HTTP, JSON or API and this guide won’t cover its fundamentals or other types of API’s like SOAP or RPC.

Designing RESTful API’s can be tricky because there are a tons of possibilities to build it. Also, REST is an architectural style and not a strict standard and so it puts flexibility and freedom of structure on designing. However, following the best practices you can raise your chances to get succeed.

A well-designed web API should aim to support a platform independence, it means your application clients should be able to consume the API without requiring how it’s physically implemented and service consistency, where your service should be able to evolute regardless your client applications.

The topics listed below covers the developments standards that I’m used to follow to design and implement successful API solutions.

Continue reading

Object oriented principles for a good software design

If you are a developer, you must have at least a basic idea about Object Oriented Programming. But, if you are a willing to become an OOP programmer, it’s a requirement to you putting enough efforts on learning the concepts of Object Oriented Design Principles to create clean and modular designs. And it’s curious how things raised more than decades ago can be still updated.

Patterns of Enterprise Application Architecture” – Martin Fowler.

Principles Of Object Oriented Design“, compiled by Uncle Bob.

Principles about class design (SOLID):

SRP The Single Responsibility Principle A class should have one, and only one, reason to change.
OCP The Open Closed Principle You should be able to extend a classes behavior, without modifying it.
LSP The Liskov Substitution Principle Derived classes must be substitutable for their base classes.
ISP The Interface Segregation Principle Make fine grained interfaces that are client specific.
DIP The Dependency Inversion Principle Depend on abstractions, not on concretions.

Principles about package cohesion:

REP The Release Reuse Equivalency Principle The granule of reuse is the granule of release.
CCP The Common Closure Principle Classes that change together are packaged together.
CRP The Common Reuse Principle Classes that are used together are packaged together

Principles about the couplings between packages:

ADP The Acyclic Dependencies Principle The dependency graph of packages must have no cycles.
SDP The Stable Dependencies Principle Depend in the direction of stability.
SAP The Stable Abstractions Principle Abstractness increases with stability

Besides that, there are a bulck of others object oriented design principles that are equally important:

  1. DRY (Don’t repeat yourself) — avoids duplication in code.
  2. Encapsulate what changes — hides implementation detail, helps in maintenance.
  3. Favor Composition over Inheritance — code reuse without cost of inflexibility.
  4. Programming for Interface — helps in maintenance, improves flexibility.
  5. Delegation principle — don’t do all things by yourself, delegate it.

Dicas sobre como escrever bons READMEs

Eu acredito que muita gente já se perguntou sobre quais seriam as boas práticas para se construir um bom README para seus projetos, e existem diversos posts na internet descrevendo como fazer isso de uma forma concisa e organizada.

Eu recomendo a leitura do texto “Art of README“, o qual coloca de uma forma bastante interessante, dicas sobre como escrever um bom README. Inclusive você pode colaborar com a tradução desse texto para o nosso português.

E então, os seus READMEs estão de acordo com essa lista:

Continue reading

Logging: ASP.NET MVC e Elmah

Como fazer logging de aplicações .NET utilizando ELMAH

ELMAH é uma ferramenta open source sensacional para logar erros em aplicações .NET, e tem como principal característica a facilidade na instalação, não exigindo que seu projeto seja recompilado ou tenha que ser publicado novamente.

Uma das coisas mais bacanas é que você pode reproduzir, em ambiente de produção, as temidas telas amarelas ou Yellow Screens of Death.

A ferramenta é grátis e possui funcionalidades como filtro de erros, possibilidade de listar os erros de uma aplicação web assinando um RSS ou fazer o download no formato CSV. É uma das mais populares do NuGet, com mais de 1 milhão e meio de downloads.

O que ELMAH pode fazer?

Continue reading