High qualify coding and delivery

https://smallbusinessprogramming.com/the-one-chart-every-developer-must-understand/

High-quality software is not expensive. High-quality software is faster and cheaper to build and maintain than low quality software, from initial development all the way through total cost of ownership

Advertisements

ES6 destructing and spread

http://www.typescriptlang.org/docs/handbook/variable-declarations.html#destructuring

destructuring is to auto map the source to the assigned variable, whether being array or object or tuple.


const [a,b,c] = ...

const {a,b,c} = …

const [a,b,c]= …

spread is to auto map any number of items in the array to a spread variable, vice versa. basically to repsent array as one (spread) variable.


const [a, ...b] = ...
const x = [a, ...b]

and in order to destruct array of objects

let o = [
{
a: "foo",
b: 12,
c: "bar"
},
{
a: "test",
b: 20,
c: "check"
}];

let [{a}] = o ====> “foo”

let [{a: a1},{a: a2}] = o ====> “foo”, test

publish vscode extension with bundled in images/gif

its by default vscode expect a public git repository for referring the code and even images to be shown in the markdown.

an alternative, workable solution to enable for the bundled in images is through publish a pre-packaged vsix.

You can override that behavior and/or set it by using the –baseContentUrl and –baseImagesUrl flags when running vsce package. Then publish the extension by passing the path to the packaged .vsix file as an argument to vsce publish.

https://code.visualstudio.com/api/working-with-extensions/publishing-extension

: in typescript destructing

tsc keep complaning about this code of implicit any type:

const updateFile = (type: any, { fsPath: filepath }) => {
.....
}

turns out the : within the destructing is for aliasing.

so the code need to change to

const updateFile = (type: any, { fsPath: filepath }: {fsPath: any}) => {
...
}

quote:

As you can see, component is implicitly any. The : inside of your destructuring assignment in the function arguments is aliasing rather than functioning as a type signature. You could correct it by doing the following:

不要浪费时间写完美代码(你认同么?)

An interesting read: clean code vs perfect code vs pragmatic coding vs refactoring.

I guess one point missing from the article is: It’s easier for a good developer to write a near perfect coding than an average developer to write clean code.

And the dilemma is, without advocating for high quality coding, developer’s skill wont improve.

Utlimately, it’s the coding skills.

https://mp.weixin.qq.com/s/YTLn8EaDfojS9s5rgbw2ow

http://swreflections.blogspot.com/2014/11/dont-waste-time-writing-perfect-code.html?m=1

https://martinfowler.com/articles/workflowsOfRefactoring/#tension