Software Development Craftsmanship with Java

Simeon Iliev
6 min readFeb 18, 2020
Image source: https://pixabay.com/illustrations/java-software-software-development-2327538/

Intro

To give initial context, Software craftsmanship is an approach to software development that emphasises on the coding skills of the software developers. It came as a response by software developers to the perceived problems of the mainstream software industry, including the prioritisation of financial concerns over developer accountability and quality.
Here are some manifesto principles from the Software Craftsmanship website: http://manifesto.softwarecraftsmanship.org/

As aspiring Software Craftsmen we are raising the bar of professional software development by practicing it and helping others learn the craft. Through this work we have come to value:
Not only working software, but also well-crafted software
Not only responding to change, but also steadily adding value
Not only individuals and interactions, but also a community of professionals
Not only customer collaboration, but also productive partnerships

So having that in mind, when building software we want to write code that is easy to read, that is highly maintainable, written with automated testing in mind and reusable. To achieve that we should use and adhere to industry wide Coding Best Practices, Software Design Principles, Software Design Patterns and in most of the cases while building software solutions currently we should be designing our software solutions to be reusable services following Service Oriented Design Principles (a.k.a. results in Micro-Services). And In the context of Micro-Services based applications, we should follow the 12 factor app manifesto and cloud native patterns whenever applicable and possible. As a disclaimer this post is in the context of building software with Object Oriented paradigms in mind, and from Java programming language software craftsmanship.

In this post I will try to make a short basic intro to what are coding best practices, what are software design principles, what are software design patterns and what are service oriented design principles. Also please do have in mind that this is just a short intro to a vast domain, so in the future if I have time I may make a series out of this topic and write few more posts.

What are Coding Best Practices

Coding Best Practices are a set of informal rules (thus practices) that the software development community has learned over time and which can help improve the quality of software. These practices were obtained by trial and error by numerous software developers over quite a substantial period of time.

What are Software Design Principles

Software design principles represent a set of guidelines that helps us to avoid having a bad design. The design principles are associated to Robert Martin who gathered them in “Agile Software Development: Principles, Patterns, and Practices”. According to Robert Martin there are 3 important characteristics of a bad design that should be avoided:

  • Rigidity — It is hard to change because every change affects too many other parts of the system.
  • Fragility — When you make a change, unexpected parts of the system break.
  • Immobility — It is hard to reuse in another application because it cannot be disentangled from the current application.

In object-oriented computer programming, we try to adhere to SOLID principles. SOLID is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible and maintainable. SOLID comes from the first letter of the following five design principle names: Single Responsibility Principle, Open Close Principle, Liskov Substitution Principle, Interface Segregation Principle and Dependency Inversion Principle.

What are Software Design Patterns

In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem in the software design. It is not a finished design that can be transformed directly into source or machine code. Rather, it is a description or template for how to solve a problem that can be used in many different situations. Design patterns are formalised best practices that the programmer can use to solve common problems when designing an application or system.

Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Patterns that imply mutable state may be unsuited for functional programming languages, some patterns can be rendered unnecessary in languages that have built-in support for solving the problem they are trying to solve, and object-oriented patterns are not necessarily suitable for non-object-oriented languages.
List of the most common design patterns in Java: Strategy, Decorator, Factory Method, Observer, Chain of Responsibility, Singleton, Flyweight, Adapter, Façade, Template, Builder, Iterator, Composite, Command, Mediator, State, Proxy, Abstract Factory, Bridge, Interpreter, Memento, Prototype, Visitor etc…

What are Service-Orientation Design Principles

Service-orientation design principles are proposed principles for developing the solution logic of services within Service-Oriented Architectures (SOA).

A SOA is an architectural pattern in computer software design in which application components provide services to other components via a communications protocol, typically over a network. The principles of service-orientation are independent of any product, vendor or technology.

SOA just makes it easier for software components over various networks to work with each other.

A Service-Oriented Architecture (SOA) is essentially a collection of services on Enterprise level. These services communicate with each other. The communication is achieved through a communication protocol over a network. The communication can involve either simple data passing or it could involve two or more services coordinating some activity. A service is a function that is well-defined, self-contained, and does not depend on the context or state of other services.

Microservices are collection of services on Application level, aka microservice architecture, is an architectural style that structures an application as a collection of small autonomous services modeled around a business domain.
SOA defines four basic service types: Enterprise Services, Business Services, Application Services and Infrastructure Services.

12 factor App Manifesto

The twelve-factor app is a methodology for building software-as-a-service apps. It consists of 12 factors manifesto, so here are the twelve factors (not all applicable to all java based solutions):
I. Codebase: One codebase tracked in revision control, many deploys
II. Dependencies: Explicitly declare and isolate dependencies
III. Config: Store config in the environment
IV. Backing services: Treat backing services as attached resources
V. Build, release, run: Strictly separate build and run stages
VI. Processes: Execute the app as one or more stateless processes
VII. Port binding: Export services via port binding
VIII. Concurrency: Scale out via the process model
IX. Disposability: Maximize robustness with fast startup and graceful shutdown
X. Dev/prod parity: Keep development, staging, and production as similar as possible
XI. Logs: Treat logs as event streams
XII. Admin processes: Run admin/management tasks as one-off processes

For full reference and further read about the 12 factor app manifesto: https://12factor.net/

Cloud Native Patterns

Cloud native is an approach for building applications as micro-services and running them on a containerised and dynamically orchestrated platforms that fully exploits the advantages of the cloud computing model. Cloud-native is about how applications are created and deployed, not where (as far it supports containers ). Here are some of the most referenced cloud native patterns: Request/Response, Event-Driven, CQRS, Multiple services instances, Horizontal scaling, Stateless and stateful services, Configuration as code & Externalising configuration, Zero-downtime upgrades (rolling, blue/green, health checks, liveness probes), Server-side vs client side load balancing, Service discovery, Reliability (idempotency, retries, fallback, circuit breakers), API gateways, Service Mesh, Distributed tracing

Software Development Craftsmanship with Java part 2: “The DevOps”

If you like this post, check part 2 of my Software Development Craftsmanship with Java journey: Software Development Craftsmanship with Java: “The DevOps”

Recommended books

In the end I would like to finish this post with some of the recommended books to read on the topic (or maybe the books part of the history of this domain).
(If you know other good books reads on the topics, that Imiss, please refer them in the comments)

Books for Coding Best Practices:
McConnell, Steve (2004). Code Complete (Second ed.). Microsoft Press.

Books for Software Design Principles:
Robert C. Martin. “Principles Of OOD”. butunclebob.com.
Robert C. Martin. “Getting a SOLID start”. objectmentor.com.
Robert C. Martin. “Agile Software Development, Principles, Patterns, and Practices”. Pearson

Books for Software Design Patterns:
Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. “Design Patterns: Elements of Reusable Object-Oriented Software”. Addison-Wesley

Books for Service Oriented Design Principles:
Thomas Erl.”SOA Principles of Service Design”. Prentice Hall

Cloud Native Patterns
Cornelia Davis. “Cloud Native Patterns: Designing Change-tolerant Software”, Manning Publications

--

--

Simeon Iliev

Software Engineer, Husband and Father, Dedicated Christian Believer