Will the upcoming ‘modular’ Mac Pro be easily expandable?

It’s been rumored for a while now that a new upcoming Mac Pro, likely to be announced at WWDC 2019, will be ‘modular’. The last generation Mac Pro, usually referred to as the ‘trashcan’ because it looks just like a trash can, is anything but modular compared to previous generations.

This is what my 2008 Mac Pro looks like in the inside:

I have a mix of SSDs and HDDs in there, and I boot MacOS, Windows 10, Linux and run Proxmox to virtualize the hardware. I have 2 GPUs, one Mac native AMD and one generic nvidia .

I don’t think ‘modular’ means the same as expandable. My 2008 Mac Pro does everything I need as a daily driver desktop, and if I need it to do something different I can easily pull parts out and put new parts in.

I want the new Mac Pro to be as expandable as this, but I think ‘modular’ more likely refers to an ability to link multiple units together to add capacity and features, but that sounds like an expensive approach, and nowhere near as flexible as the expandability of prior generation Mac Pros. Fingers crossed, I’m looking forward to see what will be announced, but I don’t think the new Mac Pro will be as expandable as the previous generations.

Weblogic 12c (12.1.3) Datasource for MySQL 8.0.15 getting error: Unable to load authentication plugin ‘caching_sha2_password’

When creating a new Datasource on Weblogic 12.1.3 to MySQL 8.0.15, I got this error:

Unable to load authentication plugin 'caching_sha2_password'.
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)

A quick search found this question, and the solution is to switch the password encryption back to the approach used in prior MySQL versions with:

ALTER USER 'youruserid'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpassword';

What defines ‘simple’ code?

Simple code is not complex code. Ok, well what does complex code looks like? We don’t like or want complex code because it is:

  • hard to read
  • hard to understand
  • difficult to update and maintain

Ok, so simple code therefore is:

  • easy to read
  • easy to understand
  • easy to update and maintain

As a result of the above, other benefits become more easily within reach. For example, simple code is easier to unit test.

What can we do to ensure we write simple code? Many of the commonly known (but not commonly applied) industry best practices lead to simpler code. For example:

  • Single Responsibility Principal: Bob Martin defines this as a ‘single reason to change‘. A class should have a single responsibility, one feature that it is responsible for. If there is more than one reason that would require changes to this class, it has more than one responsibility, and therefore is doing ‘too much’.
  • A class or a method should do one thing and do that one thing well. Not 10 things, not 5, just one thing. Limiting to just one thing reduces the opportunity for complexity to creep in (this is really the same idea as the Single Responsibility Principal).
  • A single method short be short enough that you can easily read it and grasp the whole intent. Too long is when you have to scroll page after page, and at that point, it’s difficult to grasp the entire purpose of the method, without scrolling around and re-reading. If it takes you too long to read to the end of a method, and by the time you get there you’ve already forgotten what it was doing at the start, and the start of the method is already several pages off the top of your screen, your method is too long.
  • Clearly named variables, methods and class names: a clear name that describes what the variable is for (it’s purpose, what does it represent), what a method does, what a class does, helps to convey it’s purpose and improve understanding. A method that does something else other that what it’s name describes it not simple and it not easy to understand. We don’t like surprises.
  • Clear documentation. In Java we use JavaDoc. Your JavaDoc should describe what the Class does, what each public (at least) method does. It should NOT state the obvious, it shouldn’t repeat what is already implied from your clear class and method names. If you’re just repeating what the method name says, you’re not aiding readability, you’re adding more content that I have to read, but for no gain. For example, this is not useful documentation, although many developers do this:
/**
* This method creates a new account.
*/
public Account createAccount(){
...
}

… I know it’s a method because I am a developer, you don’t need to tell me that. I know this method creates an account, because the method name says so. This JavaDoc adds no additional value, and if there’s no additional detail to be added, it would be best just left out.

If you set out from the start to create simple code, it’s more easily achievable than creating something too complex and then trying to simplify. Refactoring is your friend, and you should always invest time to refactor when you’ve finished your first iteration of getting your code working. However, by aiming to avoid complexity from the start you can make your job easier in the long run.

What does ES6’s spread operator (…) do and what can you use it for?

Some language features are easy to guess what they do even if you’re unfamiliar with them, but it’s not immediately obvious what the ES6 spread operator ‘…’ does.

Here’s a great article that gives some practical examples of how you can use the spread operator, for example, to:

  • insert one array into another
  • copy the contents of an array
  • convert a String into an array of chars