Contribution:
javaSyb
Headline
SYB-style generic programming with reflection in Java
Characteristics
When implementing operations for totaling or cutting salaries in a regular object-oriented fashion (such as in the case of Contribution:javaComposition), it occurs that the implementations are unnecessarily concerned with the detailed object model. In contrast, some XML-based implementations (such as in the case of Contribution:javaDom) are much more concise because they can leverage extra query facilities, in fact, axes, such as the descendants axis of XPath. The SYB style of generic programming also provides such conciseness on the grounds of functional programming idioms. In particular, queries and transformations are supported by customizable traversal schemes. Conceptually, these are higher-order functions that are to be parametrized by essential, problem-specific first-order functions. The present implementation applies SYB to Java. The implementation includes a simple SYB-style library for object traversals. The library relies on reflection, in fact, introspection--as provided by Java's reflection approach.
Illustration
The data model is implemented with object composition. For example Companies:
Feature:Closed serialization is implemented using Language:Java Technology:Object Streams:
Feature:Total, Feature:Cut and Feature:Depth are implemented using functions. For example Total:
public class Total extends Parser {
private double total = 0;
public double getTotal() {
return total;
}
protected void handleEmployee(boolean isFinal, String name, String address, Double salary) {
total += salary;
}
}
Test cases are implemented for all Namespace:Features.
Relationships
For basic OO without inheritance see Contribution:javaComposition.
For basic OO with inheritance see Contribution:javaInheritance.
For modular OO programming with static methods see Contribution:javaStatic.
For use of Java reflection see Contribution:javaReflection (data processing) and Contribution:javaSyb (SYB-style generic programming).
For design patterns see Contribution:javaTemplate (template design pattern), Contribution:javaVisitor (visitor design pattern) and Contribution:javaExorcism (excessive illustration of design patterns).
Architecture
The contribution follows a standardized structure:
- inputs contains input files for tests
- src/main/java contains the following packages:
- javaf.prelude for function patterns.
- javaf.syb for query patterns.
- org.softlang.company.features for implementations of Functional requirements.
- org.softlang.company.model for implementations of Feature:Company.
- src/test/java contains the following packages:
- org.softlang.company.tests for Technology:JUnit test cases for Namespace:Features.
Usage
This contribution uses Technology:Gradle for building. Technology:Eclipse is supported.
See https://github.com/101companies/101simplejava/blob/master/README.md
There are no revisions for this page.
User contributions
User edits
Syntax for editing wiki
For you are available next options:will make text bold.
will make text italic.
will make text underlined.
will make text striked.
will allow you to paste code headline into the page.
will allow you to link into the page.
will allow you to paste code with syntax highlight into the page. You will need to define used programming language.
will allow you to paste image into the page.
is list with bullets.
is list with numbers.
will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.
will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.
will allow your to insert code snippets from @worker.
Syntax for editing wiki
For you are available next options:will make text bold.
will make text italic.
will make text underlined.
will make text striked.
will allow you to paste code headline into the page.
will allow you to link into the page.
will allow you to paste code with syntax highlight into the page. You will need to define used programming language.
will allow you to paste image into the page.
is list with bullets.
is list with numbers.
will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.
will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.
will allow your to insert code snippets from @worker.
