We have already had little introductions to UML in the preceding lessons. Now we will dive deeper into conceptual data modeling and programming. These technologies are similar to Esri's Model Builder. In Model Builder, you can drop entities such as data, tools, inputs and outputs, parameters, functions, and relationships. When the model is complete, you can run it. By doing this, it compiles the underlying Python code, checks it and, if complete, will run it. This is Computer Aided Programming, also known as Computer Aided Software Engineering (CASE). You do not need to remember that. But to make Esri's zonal statistics you need the following code:
# Name: ZonalStatistics_Ex_02.py
# Description: Calculates statistics on values of a raster # within the zones of another dataset. # Requirements: Spatial Analyst Extension
# Import system modules import arcpy from arcpy import env from arcpy.sa import *
# Set environment settings env.workspace = "C:/sapyexamples/data"
# Set local variables inZoneData = "zone" zoneField = "value" inValueRaster = "valueraster"
# Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial")
# Execute ZonalStatistics outZonalStatistics = ZonalStatistics(inZoneData, zoneField, inValueRaster, "RANGE", "NODATA")
# Save the output outZonalStatistics.save("C:/sapyexamples/output/zonestatout2")
Example code above from Esri Online Help.
Instead of this complex writing, you can just drag an input raster and output raster, the zone data, drag the zonal statistics tool out of the toolbox, set a couple of parameters, and then hit run. The code will be checked and executed. There are no dangers of typos or forgetting the correct format. A simple example of building a model can be found on Esri Online Help.
Along with running tools, Esri Model Builder techniques can also be used to develop conceptual models. These are a lot more like UML problem modeling. Here is another example from Esri Online Help regarding school placement. Many other data models are available. Here is one for a Global Base Map from Esri Data Models, where many more can be found.
UML, being an open standard, has fully understandable drawing conventions. There are many, so do not try to learn them all here. But do take a look at the list of specifications at omg.org. Besides Model Builder in Esri, there are many other companies that have used UML ideas for CASE. One is IBM, which offers their Introduction to UML. Read this through and you will have a good background on UML.
The next step is to think about how development would take place from a design to the implementation process. This, too, can be diagrammed visually much more successfully than it can be described as a narrative. It has the advantage that some tools can import it and turn it into scripts or complete designs. It also has the open standard advantage of not being understood properly (provided that the UML is well done and known). Lastly, humans, being primates, think oftentimes in a more visual way. Connections and relationships are better understood in terms of a diagram than they are as a written description. This is not to say that UML or code does not need to be documented and annotated to make sure that it is clear. This, like metadata, is often left to the end and then just gets left. This can decrease the value of a program and can ruin a design. Teams break up, funding moves on, and participants die and leave. Documenting as you go is the safest policy. Here is another IBM link to a more complex and well designed application of their UML designed Rational Software for WebLink.
Such a complex model should be developed with the best practices in mind. Here is a set of Best Practices from IBM.
Joining the Discussion
Post a comment in the Lesson 7 Technology Trends Discussion in Canvas.
Lesson 7 Writing and UML Drawing Exercise
Complete this exercise in Canvas.