Arrays and Sequences

Improve your programming skills by learning about more advanced programming with arrays and sequences. The concepts explored form the basis for functional programming.

When we start with arrays we learn about loops, the for loop, the while loop, the do until loop. Each iteration of the loop going through the same tightly-tied processing logic. A number of typical iterative processing gets reformed into patterns that become array methods. And when we try these array methods they offer a way of refactoring away the actual loop so our code says more about the processing rather than the mechanism for doing that processing.

As practitioners of Clean Code can use functional programming concepts to improve the readability of our code. By using functional programming concepts the code we write is more understandable, and more testable. Testable and readable code is the primary basis of maintainable code.

Whether our language of choice is JavaScript, Python or PHP, there's a multitude of techniques from functional languages that we can adopt and improve the quality of our craft. Python's list and dictionary comprehensions offer a glimpse towards the next-level of development. JavaScript's embrace of promises and async operations open up a different way of writing code. Every language strives to be Lisp-like.

(And Lisp, since the clue is in the name, is about List processing. Arrays and sequences, they're just lists that need processing.)

Functional programming

As we explore array processing methods we start to unearth techniques and approaches that underpin functional programming.

Given the same inputs a function should always return the same outputs, and be free of outside state.

Many developers dismiss functional programming as an academic language that is impossible to use in real-world applications. Yet the fundamentals of functional programming support concurrent programming. Erlang is one such programming language, and the systems developed in Erlang are recognised to be very stable and performant, and robustly highly concurrent. For example, the message queue RabbitMQ.

Concepts and topics

  • Clean code: How to write readable, testable and maintainable code.
  • Array methods: Exploring the library of neat array-based methods, along with practical examples.
  • Composable functions: Building reusable functions that can be composed in different ways.
  • Immutable values: How to simplify code by adopting immutable values.
  • Promises: Avoiding callback nesting and creating composable asynchronous flows.
  • Scalable code (distributed and concurrent): How functional programming can enable parallelisation of code.
  • Big data: How to process more data that can fit into one server (e.g. map-reduce)