Compactness vs. Tooling

Inhaltsverzeichnis
Zuletzt aktualisiert
by Anonym (13 Aug)
Re: XPath of Node (Software Development)

Code with Tooling Support:

package de.jawiki;

import java.util.HashSet;

public class Customer {

	private long id;
	private String name;
	private Collection<Order> orders = new HashSet<Order>();
	private Set<PhoneNumber> phones = new HashSet<PhoneNumber>();
	
	@Id
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany
	public Collection<Order> getOrders() {
		return orders;
	}

	public void setOrders(Collection<Order> orders) {
		this.orders = orders;
	}

	@ManyToMany
	public Set<PhoneNumber> getPhones() {
		return phones;
	}

	public void setPhones(Set<PhoneNumber> phones) {
		this.phones = phones;
	}

	public Customer() {
		// TODO Auto-generated constructor stub
	}
}

All informations are marked explizt.

Compact Code (DSLized):

entity Customer {
  String name
  Address address
  Order[] orders
  PhoneNumber[] phones
}

Code is using a lot of implizt informations like conventions:

  • every entity has an ID
  • every entity has getter and setters for their properties

But: It's difficult for tools to resolve those kind of implizit conventions, but they will hopefully do in the future.

Stichwörter:

Geben Sie Stichwörter ein, die dieser Seite hinzugefügt werden sollen:
Wait Image 
Sie suchen ein Stichwort? Beginnen Sie einfach zu schreiben.