devicemap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Volkan Yazıcı <volkan.yaz...@gmail.com>
Subject bol.com Hackathon
Date Thu, 16 Apr 2015 20:30:17 GMT
Hello,

As I might have mentioned before, we internally use a slightly enhanced
version of Apache DeviceMap at bol.com. Tomorrow there will be an all day
long in-company Hackathon. There I plan to build a website
whatismyuseragent.nl, where visitors are displayed the list of attributes
returned by Apache DeviceMap. Further, they will be able to submit their
enhancements by just updating the displayed values and hitting enter. The
submission will end up as a GitHub issue. While the visuals still suck (the
design is on the way), mechanics are more or less complete and the source
code is accessible at https://github.com/vy/what-is-my-user-agent address.
I believe this will bring some visibility to the project and have a
potential to improve the DDR data. (Would Apache DM be willing to host such
an application officially and connect it to their own JIRA system?)

Within the project, I had employed the following mechanics that I also want
to incorporate into Apache DeviceMap:

1. In addition to a *DeviceAttributes*
<https://github.com/vy/what-is-my-user-agent/blob/master/src/main/java/com/vlkan/whatismyuseragent/devicemap/DeviceAttributes.java>
class consisting of a generic *Map<String,String>* field (as is the case
for DM), I also implemented a *ApacheDeviceAttributes*
<https://github.com/vy/what-is-my-user-agent/blob/master/src/main/java/com/vlkan/whatismyuseragent/devicemap/apache/ApacheDeviceAttributes.java>
subclass such that all known device attributes (manually collected from DDR
sources) are represented as fields. This allows the programmer to replace






*if (attrs.containsKey("ajaxSupportJavaScript")) {
boolean ajaxSupportJavaScript =
Boolean.parseBoolean(attrs.get("ajaxSupportJavaScript"));    ...}*
like boilerplate with an

*Optional<Boolean> ajaxSupportJavaScript*.

*Optional<T>* introduces a Java 8 dependency. Hence, we might want to
replace it with a custom *Attribute<T>* class. But the attributes as a
statically typed class field still holds its type-safe promise, I believe.

2. Used enums for representing attributes with a fixed set of values, that
is, *DeviceOs*
<https://github.com/vy/what-is-my-user-agent/blob/master/src/main/java/com/vlkan/whatismyuseragent/devicemap/attribute/DeviceOs.java>,
*InputDevice*
<https://github.com/vy/what-is-my-user-agent/blob/master/src/main/java/com/vlkan/whatismyuseragent/devicemap/attribute/InputDevice.java>,
and *MobileBrowser*
<https://github.com/vy/what-is-my-user-agent/blob/master/src/main/java/com/vlkan/whatismyuseragent/devicemap/attribute/MobileBrowser.java>.
(Values are collected from DDR.)

3. Added a *DeviceType*
<https://github.com/vy/what-is-my-user-agent/blob/master/src/main/java/com/vlkan/whatismyuseragent/devicemap/DeviceType.java>
class for classifying a User-Agent into the following categories:

   - Mini: head up displays, smart watches, -3”, minimal controls
   - Mobile: smart phone, phablet, -6”, game device, touch enabled
   - Tablet: touch enabled, 7”-13”
   - E-Reader: greyscale, e-Ink, fixed fonts, -10”
   - Desktop: PC, laptop, notebook mouse/keyboard, 11”-
   - TV: smart TV, set top box, streaming device, 40”-
   - Maxi: cinema, tv walls, 100”-, minimal controls
   - SEO Agent: search bots

This is a work in progress and as of now, only Mobile, Tablet, Desktop, and
SEO Agent options are supported.

4. Introduced a two-phased parsing pipeline to determine the *DeviceType*.
One that depends on the User-Agent (for instance, you can easily
differentiate a Googlebot without the need for DM attribute extraction to
kick in), and another one that depends on both the User-Agent and extracted
attributes.

5. Enriched the bot database using *BuilderDataSourcePatch.xml*
<https://github.com/vy/what-is-my-user-agent/blob/master/src/main/resources/com/vlkan/whatismyuseragent/devicemap/apache/devicedata/BuilderDataSourcePatch.xml>
file. (Actually, I had already submitted the very same bots as a JIRA
issue, but had no effect so far.)

6. Treated Googlebot Mobile as a *DeviceType.MOBILE*
<https://github.com/vy/what-is-my-user-agent/blob/master/src/main/java/com/vlkan/whatismyuseragent/devicemap/DeviceProfilerService.java#L46>
rather than a *DeviceType.SEO_AGENT*. This is of crucial importance, since
Googlebot Mobile needs to spider the website and determine whether it is
mobile-friendly or not, which has a direct impact in the Google rankings.

We can directly implement some of these changes in the existing code base,
and some will preferably require a new (and probably backward incompatible)
API. Maybe this will also be a good motivation for a separate 2.0 version
as Reza recommended. (I hope I got Reza's intention after long
discussions.) Put another way, or as Werner said there is no harm in
maintaining two separate drivers/DDRs. Ideas?

Best.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message