![Page 1: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/1.jpg)
1© 2017 The MathWorks, Inc.
Advanced Software Development with MATLAB
From research and prototype to production…
![Page 2: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/2.jpg)
2
What Are Your Software Development Concerns?
▪ Accuracy
▪ Compatibility
▪ Cost
▪ Developer Expertise
▪ Development Time
▪ Documentation
▪ Ease of Collaboration
▪ Effective Testing
▪ Integration
▪ Legacy Code
▪ Liability
▪ Maintainability
▪ Model Risk
▪ Reusability
▪ Robustness
▪ Software Speed
▪ Software Stack Complexity
▪ …?
![Page 3: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/3.jpg)
3
Development Process
Production Deployment
Prototype to Production
▪ Migrate design to production
▪ Deploy / Integrate / Test
▪ Formalize design & testing
▪ Optimize performance
Research & Discovery
▪ Explore and evaluate ideas
▪ Weigh alternatives, trade-offs
Te
st &
Ve
rifica
tion
ElaborateImplementDocument
PrototypeDiscover
Verify
.NET
Java
.dll
.exeWeb C/C++
DBMS
Python
![Page 4: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/4.jpg)
4
Case Study: Energy Load Forecasting System
▪ Current State
– Software developed by ex-colleague
– System entirely undocumented
– Stability issues take a long time to debug
– Days of downtime after security threat
disrupted server
▪ Future State
– Backward compatible for legacy applications
– Reusable, extensible, and documented
components
– Testing and support for test environments
![Page 5: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/5.jpg)
5
▪ Architecture and Design
▪ Code Quality
▪ Writing Code
▪ Testing Code
▪ Integration
▪ Additional Resources
Agenda
![Page 6: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/6.jpg)
6
Progression of Programming Techniques
Algorithm
Data
function
script
command line
value
variable
structure
Level of Abstraction / Sophisticationclass
(properties)
(methods)
![Page 7: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/7.jpg)
7
Object Oriented Design
▪ Modularity ▪ Encapsulation
Data CleaningData Access
ChartsReporting
Model
DevelopmentUser Interface
Portfolio
Constraint
Matrices
Price Series
Constraints
Plot Frontier
Asset Weights
Compute Risks
Price Series
Constraints
Optimization
Algorithm
Compute
Metrics
Historical
StatisticsSimulation
![Page 8: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/8.jpg)
8
Object Oriented Class Hierarchy
▪ Reusable pieces through
inheritance and composition
▪ Consistent interfaces
▪ Easily testable
▪ Source control
Developed by MathWorks Consulting Services
![Page 9: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/9.jpg)
9
File Structure
▪ Namespaces
(+packages)
▪ Separation of
Tests from Source
▪ Source control
managed
![Page 10: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/10.jpg)
10
Interface Control Document
▪ Agree on interface
between external software
and production server
▪ Separate development of
front end and back end
▪ Allows for trivial updating
![Page 11: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/11.jpg)
11
Source Control
▪ Current Folder,
Simulink Projects,
outside of MATLAB
▪ Text files, MAT files,
live scripts, et al.
![Page 12: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/12.jpg)
12
Requirements Management
▪ Link between source, test,
and requirements
▪ Identify which requirements
have been met
![Page 13: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/13.jpg)
13
▪ Architecture and Design
▪ Code Quality
▪ Writing Code
▪ Testing Code
▪ Integration
▪ Additional Resources
Agenda
![Page 14: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/14.jpg)
14
Flexible, Extensible Interfaces
▪ inputParser
– Parameter / Value Pairs
▪ Inheritance
![Page 15: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/15.jpg)
15
Exceptions, Errors, Warnings
▪ MException
▪ error
▪ assert
▪ warning
▪ try / catch
▪ onCleanup
![Page 16: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/16.jpg)
16
Polymorphism & Weak Typing
▪ Attribute Validation
▪ Property Validation
▪ Access Restriction
![Page 17: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/17.jpg)
17
Preferences
▪ Add preferences to your application that persist to customize application
▪ Allows for configuration in compiled applications
![Page 18: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/18.jpg)
18
Debugging
▪ Conditional breakpoints stop
when something happens
▪ Test fixes by running code while
paused
▪ Code analyzer to find quick fixes
▪ Use unit tests to set up state
![Page 19: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/19.jpg)
19
Execution Performance
▪ Profiler
▪ Performance testing framework
▪ Parallel computing
▪ Automatic C / C++ / CUDA Code
generation
![Page 20: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/20.jpg)
20
Documentation
▪ Functions, classes self document
▪ Full markup documentation that
can be included in Help Browser
![Page 21: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/21.jpg)
21
Code Complexity
Untestable program, very high risk
Moderate risk
1 10
10 20
2050
50+
Simple program, low risk
High risk
idxGroupedByLevel = {};
done = false;
findHole = false; % start with an object boundary
while ~done
if (findHole)
I = FindOutermostBoundaries(holes);
holes = holes(~I); % remove processed boundaries
idxGroupedByLevel = [idxGroupedByLevel, {holeIdx(I)}];
holeIdx = holeIdx(~I); % remove boundaries
else
I = FindOutermostBoundaries(objs);
idxGroupedByLevel = [idxGroupedByLevel, {objIdx(I)}];
end
if (processHoles)
findHole = ~findHole;
end
if ( isempty(holes) && isempty(objs) )
done = true;
end
end
![Page 22: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/22.jpg)
22
Code Complexity
▪ checkcode –cyc
▪ Include test cases for complexity
![Page 23: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/23.jpg)
23
Why use Automated Testing?
▪ Improve quality
▪ Understand and document code
▪ Reduce and not introduce risk
▪ Catch bugs early and often
Four Phase Test
![Page 24: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/24.jpg)
24
Authoring Tests
▪ Script, function, and class
based tests
▪ Setup and teardown for four
phase testing
▪ Rich qualifications and
diagnostics
▪ Parameterization to build
combinations of inputs
![Page 25: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/25.jpg)
25
Mocking
▪ Framework to
emulate software or
hardware that is
inaccessible or slow
▪ Spy on mock usage
for testing
![Page 26: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/26.jpg)
26
Testing Infrastructure
▪ Run suites of tests from
many files, directories,
and packages
▪ Select tests based on
tags or parameters
▪ Shared fixtures (e.g. path
management, temporary
folders)
![Page 27: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/27.jpg)
27
Test Outputs
▪ Coverage report
![Page 28: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/28.jpg)
28
Test Outputs
▪ Test results report
![Page 29: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/29.jpg)
29
Continuous Integration
▪ Runs tests after code
changes to track
development progress
▪ Support for TAP, jUnit XML
![Page 30: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/30.jpg)
30
▪ Architecture and Design
▪ Code Quality
▪ Writing Code
▪ Testing Code
▪ Integration
▪ Additional Resources
Agenda
![Page 31: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/31.jpg)
31
Integrating with Other Languages, Frameworks, Databases
▪ Calling Out
– C / C++
– Python
– .NET
– REST / HTTP
– WSDL / SOAP
– Java
– System
– FORTRAN
– Perl
– Verilog / VHDL (HDL Verifier)
– Databases ODBC / JDBC / Some NoSQL (Database Toolbox)
– OPC / Historian (OPC Toolbox)
– CUDA (Parallel Computing Toolbox or GPU Coder)
▪ Calling In
– C / C++
– Python
– .NET
– Java
– Excel
– REST (MATLAB Production Server)
– FORTRAN
– System
– COM
![Page 32: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/32.jpg)
32
Getting out of MATLAB
MATLAB
Runtime
C, C++ HDL PLC
Embedded Hardware
C/C++ ++ExcelAdd-in Java
Hadoop/
Spark.NET
MATLABProduction
Server
StandaloneApplication
Enterprise Systems
PythonCUDA
![Page 33: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/33.jpg)
33
What is Production Server?
▪ Enterprise class framework
for running packaged
MATLAB programs
▪ Server software– Manages packaged MATLAB
programs and worker pool
– Single server can use runtimes from
different releases
▪ Lightweight client libraries
for: C/C++, .NET, Python,
Java, and RESTful JSON
interface
MATLAB Production Server
MATLAB
Runtime
Request Broker
&
Program
Manager
Enterprise
Application RESTful
JSON
Enterprise
Application
MPS Client
Library
![Page 34: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/34.jpg)
34
Development
Production
MATLAB Production Server
Deployable
Archive
(CTF)
Web
Application
...Function Calls
MATLAB
Algorithm
MATLAB
Compiler SDK
Initial Test
Application
Debug Algorithm
Verify data
handling and
initial behavior
MATLAB Production Server Workflow
![Page 35: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/35.jpg)
35
Databases
Cloud
Storage
IoT &
Big Data
Visualization
Web
Custom App
Public Cloud Private Cloud
Platform
Data Business System
Azure
Blob
Azure
SQL Request
Broker
MATLAB Production Server
MDCS
Azure
IoT Hub
MATLAB
Integration of MATLAB Based Analytics with your IT infrastructure
![Page 36: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/36.jpg)
36
▪ Architecture and Design
▪ Code Quality
▪ Writing Code
▪ Testing Code
▪ Integration
▪ Additional Resources
Agenda
![Page 37: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/37.jpg)
37
MATLAB Answers
Blogs
Cody
File Exchange
and more…
Answers Blogs
ThingSpeak
Every month, over 2 million MATLAB & Simulink users visit MATLAB Central to get questions answered,
download code and improve programming skills.
MATLAB Central Community
MATLAB Answers: Q&A forum; most questions get
answered in only 60 minutes
File Exchange: Download code from a huge repository of
free code including tens of thousands of open source
community files
Cody: Sharpen programming skills while having fun
Blogs: Get the inside view from Engineers who build
and support MATLAB & Simulink
ThingSpeak: Explore IoT Data
And more for you to explore…
Learn ConnectContribute
![Page 38: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/38.jpg)
38
Training: MATLAB Programming Techniques
After this 2-day course you will be able to:
▪ Ensure code correctness.
▪ Create robust and user-friendly
application interfaces.
▪ Optimize performance by choosing
appropriate function and data types.
▪ Create custom toolboxes.
![Page 39: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/39.jpg)
39
Commerzbank Develops Production Software System for
Calculating Derived Market Data
ChallengeCompute a variety of derived market data from raw market data
SolutionUsed MATLAB to read data from a data management system in a
Windows and Linux architecture, perform analyses and optimizations,
visualize results, and deploy mission-critical calculations.
Working with MathWorks consultants, Commerzbank business
analysts developed a proof-of-concept implementation of the cross-
platform architecture.
Results▪ Integration with existing system simplified
▪ Implementation time reduced by months
▪ Updates made in days, not weeks
“Our solution required a Windows
client and Linux server software. We
used MATLAB to rapidly develop
both by taking advantage of
distributed computing, a MEX-file
interface to access our financial
data, and fast, built-in functions for
optimization, regression, and more.”
Julian Zenglein
Commerzbank
Commerzbank headquarters in
Frankfurt.
![Page 40: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/40.jpg)
40
Want to Learn More?
Marshall Alphonso
Senior Finance Engineer, New York
Mike DeLucia
Senior Account Manager
Chuck Castricone
Account Manager
Account ManagersEngineers
Sean de Wolski
Senior Application Engineer
![Page 41: From research and prototype to production… · 3 Development Process Production Deployment Prototype to Production Migrate design to production Deploy / Integrate / Test Formalize](https://reader036.vdocuments.us/reader036/viewer/2022070801/5f029a867e708231d4051674/html5/thumbnails/41.jpg)
41© 2017 The MathWorks, Inc.