6. Hierarchy is a Meta-Compiler Pure Java file public class MyClass { public void myMethod() { String myVar = MyMatrix:>SomeData; } } Embedded Java file Hierarchy public class MyClass { public void myMethod() { String myVar = MyMatrix.get_FieldSet() .getField_SomeData(); } }
7.
8.
9.
10.
11. News_Schema.schema News_Schema.schema package com.williespetstore; SCHEMA News.Schema { DESCRIPTOR +:%NEWS { FIELD.NAMES: { +:%NewsSectionName }; FIELD.TYPES: { :String }; DESCRIPTOR +:%NEWS.STORY { FIELD.NAMES: { +:%StoryDate, +:%Title, +:%StoryContent }; FIELD.DESC: { "The date of the story", "The title of the story", "The content of the story" }; FIELD.TYPES: { +:"java.util.Date", :String, :String }; } } } AVAILABLE ON HANDOUT
12. News_Schema.schema News_Schema.schema package com.williespetstore; SCHEMA News.Schema { DESCRIPTOR +:%NEWS { FIELD.NAMES: { +:%NewsSectionName }; FIELD.TYPES: { :String }; DESCRIPTOR +:%NEWS.STORY { FIELD.NAMES: { +:%StoryDate, +:%Title, +:%StoryContent }; FIELD.DESC: { "The date of the story", "The title of the story", "The content of the story" }; FIELD.TYPES: { +:"java.util.Date", :String, :String }; } } } * Notice Field definitions line up vertically Field Set Definitions Descriptor Definitions
17. Part 2 – The Benefits of Using Hierarchy in Your Systems …also, techniques to use hierarchical data effectively in system architectures
18.
19.
20.
21.
22.
23. Next usage of Hierarchical Data: Universal Data Definition Questions?
24.
25. Fields defined in multiple places DB hibernate.cfg.xml public class MyClass { String firstName; String lastName; } JSF or JSP or HTML page Javascript JSON object
26.
27. Another look at previous slide… DB hibernate.cfg.xml public class MyClass { String firstName; String last Name } JSF or JSP or HTML page Javascript JSON object
41. N-Dimensional Architecture Sample Control Layer Execution Layer Services Layer News Settings – contains settings across entire app Presentation Cross-Section Business Logic Cross-Section NewsGatherer Service Gathers news from collections HTML Table Renderer Displays news in tables View-Related Services Data-Related Services NewsView Worker Displays news as HTML News Scheduler Schedules news gathering News – wrapper for entire news service
42.
43.
44. Thank You Q & A and Discussion About Taking on your Own Software Ideas Peter Joh [email_address] www.unconventionalthinking.net
Notas del editor
Relax, Breath, Smile Briefly introduce yourself, what you’re going to talk about, and when it’s appropriate to ask questions. Talk about your dev background
FIRST summarize your talk: Created extensions to Java for hierarchical data Even though we’re talking about specific tool today that you may never use, you should still find value in this talk: Also talk about how to better use Hierarchical Data in your apps. Even if you never use Hierarchy, these are concepts you can still use in your own development.
(don’t advance text yet) Hierarchy is a compiler that extends Java. Hierarchy compiles code written in the extended Java syntax we created. (show code) This is an embedded Java file with a special extension. Mjava Simple way to think of it is we’ve the Java language much bigger Hierarchy is not really a compiler It’s translator similar to Perl Actually, more like CoffeeScript and actually does the same thing that Eclipse Xtend does…
And, not to confuse you, but even though Hierarchy is a translator, we call it a metacompiler Explain why We’ll refer to Hierarchy as a Metacompiler from now on.
Hierarchical Data – is very similar to XML In fact, most XML file types have Hierarchy equivalents XML file types (QUESTIONS?) (NEXT SLIDE INTRO) At this point, the easiest way to show you how hierarchy works is to go through a simple example Willie’s Petstore, running example from website.
Go over the home page NEXT SLIDE Next, let’s create a matrix file with the news events stored in it.
Point out how the web page news items correspond to the elements in the matrix. (LET PEOPLE LOOK OVER CODE AND HANDOUT)
Identify parts! Besides small syntax changes, can anyone see any differences between .matrix file and .xml files? Describe differences between .matrix and xml. NO ATTRIBUTE FIELD NAMES Can use Java So how do we know which field a value is in? Using Hierarchy, you Must have a schema defined! Schema defines what field each value has in a field set. Done by position
Describe the schema Point out how the position of the field definitions define what field it is in the matrix. So, since StoryDate is the first field defined for the fieldset in the schema, that means it is the first field in the fieldset in the matrix. (Take a look at your hand out of the mapping of fields) Notice is the position of a Descriptor Definition determines the descriptor’s position when used in a matrix. Also notice that field types are Strongly Typed. Allow primitives, so fieldsets are very small and high performance. They could just take the Java Object (QUESTIONS?) (NEXT SLIDE) Nearly done with the first part of this quick tutorial on how hierarchy works. The last thing to look at is how we use the matrix we created in a special Java file. We’ll print out print out the news items to the console
Describe the schema Point out how the position of the field definitions define what field it is in the matrix. So, since StoryDate is the first field defined for the fieldset in the schema, that means it is the first field in the fieldset in the matrix. (Take a look at your hand out of the mapping of fields) Notice is the position of a Descriptor Definition determines the descriptor’s position when used in a matrix. Also notice that field types are Strongly Typed. Allow primitives, so fieldsets are very small and high performance. They could just take the Java Object (QUESTIONS?) (NEXT SLIDE) Nearly done with the first part of this quick tutorial on how hierarchy works. The last thing to look at is how we use the matrix we created in a special Java file. We’ll print out print out the news items to the console
Has .mjava extension This embedded Java file looks like a regular Java file except for it has extra instructions for accessing matrices Go over them Note, even though called “embedded” file, it’s not like the old SQL pre-processors that did simple text replacement…
(QUESTIONS?)
Takes much less time to create Hierarchical Data in Hierarchy compared to JAXB (explain) Metacompiler catches your mistakes! Start using Hierarchical Data in ways you never would have before
JSON is: Provides extension to Javascript for creation of Simple Data structures For those that are unfamiliar, it’s an xml-like technology for Javascript JS programmers not just use it for exchanging data, but use it to organize their entire code, putting all the major settings and content for code in JSON objects
LINQ is: adds native data querying capabilities to .NET languages Based on SQL Really centered around querying
[Technology with lots of Potential] Same, simple, flexible data structure as JSON But, also makes it easy to work with Database data and other datasources. We’ll talk about more of the benefits later, but I hope you see, this technology has hit somewhat of a sweet spot, combining the best of both and has the potential to have even a greater impact than either of these two.
Describe the parts of this matrix Describe benefits of UDD Much easier to maintain. You don’t have to search the sys to find all the different usages. Becomes a map to all the different usages of the field in the system. Tends to promote automation Could do something similar with Java Annotations, but this doesn’t tend towards automation, and more towards hard coding
I said that we could define each field in only one spot, but even with matrices, there is actually still one spot where you’d have to define the fields again. Anybody see where?
One technology for multiple uses, For instance, you start with static fields… (NEXT SLIDE) This leads us into the future of hierarchy
*** Between the primitive types and classes, there’s a middle ground that seems to have been missing for years. Javascript found it with JSON, MS found it with LINQ. Hierarchy combines the best of these two into something that is in my opinion has more possibilities than either of these two.
This is a simplified version of the website – talk about the website
(NEXT SLIDE) What is this type of architecture called?
In the past, when we programmed in procedural languages like C and Cobol: Organized by abstraction – elements of your software that were closer to the underlying system lower, top level conceptual elements higher up Now a days, we organize using Object Oriented, general more by behavior Explain how MVC is more by behavioral characteristics. PETER, CREATE HANDOUT OF Procedural, OO and N-Dim version of the architecture Describe benefits of both types of architecture
Procedural systems had a tendency to be very well organized in a top-down fashion, making them in certain ways easier to learn and navigate. But tend not to be as well organized with larger systems. Not as natural to group the functions into modules compared to OO.
In the past, when we programmed in procedural languages like C and Cobol: Organized by abstraction – elements of your software that were closer to the underlying system lower, top level conceptual elements higher up Now a days, we organize using Object Oriented, general more by behavior Explain how MVC is more by behavioral characteristics. PETER, CREATE HANDOUT OF Procedural, OO and N-Dim version of the architecture Describe benefits of both types of architecture
Explain how it works Pros: Visually, it’s easier to understand. Because the different parts of the system are “things,” we can easily see what something is and based on its name, have a good sense of what it does without looking at the code. Objects tend to better define what their responsibilities are then just using methods and modules – so things naturally to group together forming components and subsystems, which means better with larger systems. Because of encapsulation, maintenance is usually easier: easier to find where you need to make changes, and less “ripple-effect” when you do make a change Cons It’s easy to get lost – OO systems can sometimes feel like there’s no overall order for the system. When you follow use case through system, can feel like a lot of bouncing around between objects and components. It’s hard to know what happened before, what happened now, and what’ll happen later Ripple Effect still happens, where you sometimes have to make changes up and down the system to make simple changes.
(NEXT SLIDE) What if we had an architecture that combined the benefits of both? Structural - Conceptually well-organized OO – Benefits of real world objects N-Dimensional Architecture does this Uses matrices as its overall control panel into the entire system
Actually, one of the original motivations for creating the Hierarchy metacompiler was to be used in N-Dimensional architectures. (NEXT SLIDE) Another technique that’s used in N-Dimensional Architecture is something called, “Universal Data Definition”
Actually, one of the original motivations for creating the Hierarchy metacompiler was to be used in N-Dimensional architectures. (NEXT SLIDE) Another technique that’s used in N-Dimensional Architecture is something called, “Universal Data Definition”