标识参数丑陋不堪,向函数传入布尔值简直就是骇人听闻的说法。这样做,方法签名立刻变得复杂起来,大声宣布本函数不止做一件事。如果标识为true将会这样做,标识为false则会那样做!
Robert C. Matin - Clean Code


#batman#dc#dc comics#tim drake#dick grayson#dc fanart#batfam#batfamily




seen from United States
seen from United States
seen from Brazil
seen from China

seen from Canada

seen from United States
seen from Philippines
seen from United Kingdom

seen from Russia
seen from United States

seen from United States

seen from United Kingdom

seen from United States
seen from China

seen from United States

seen from Russia
seen from United States

seen from United States

seen from Malaysia

seen from United Kingdom
标识参数丑陋不堪,向函数传入布尔值简直就是骇人听闻的说法。这样做,方法签名立刻变得复杂起来,大声宣布本函数不止做一件事。如果标识为true将会这样做,标识为false则会那样做!
Robert C. Matin - Clean Code
MATLAB: Unpack cell array to function arguments
I recently found myself needing to pass the contents of a variable length cell array as arguments to a function that accepted a variable number of arguments (via Matlab's varargin functionality). I thought this would be a real problem, but was astonished at how easy it was.
Assuming we have a cell array defined as follows:
my_cell_array = {'You', 'Say', 'Aloha', 'I', 'Say', 'Aloha'};
And that we're trying to call Matlab's load() function with the following form:
load(filename, varargin)
All we have to do is the following:
load('some_random_matlab_file.mat', my_cell_array{:})
And that's all it takes. Just in case you're curious, the particular use case that led me to need this functionality was that I needed to load a list of user specified variables from a .mat file in a toolbox I'm working on.