Skip to content

Instantly share code, notes, and snippets.

View aparnachaudhary's full-sized avatar

Aparna Chaudhary aparnachaudhary

View GitHub Profile

DC/OS Notes

  • DC/OS does not need odd number of master nodes for leader election. It needs half+1 (quorum) nodes in communication.

  • Mesos DNS (L4 loadbalancer) is not recommended because (https://mesosphere.com/blog/dcos-marathon-lb/)

    • It does not offer real time service discovery

    • Issues with DNS caching

  • With Minuteman (L4 loadbalancer) it is possible to use the same port as part of VIP for different services. This can reduce the port administration.

  • Marathon LB (L7 loadbalancer) expects service ports to be unique.

  • Linkerd solves the problem of port administration. Next to that it also offers stability patterns.

  • Understanding Marathon CPU allocation behavior - https://zcox.wordpress.com/2014/09/17/cpu-resources-in-docker-mesos-and-marathon/

CodeMotion Amsterdam

How to write maintainable code?

  • https://github.com/Droogans/unmaintainable-code

  • How much time to invest in code refactoring?

    • Typically for new projects, assuming you are curating code well, no dedicated effort

    • Second year of the projects - start investing 10% of team effort on code refactoring

    • Increase this effort by 10% every upcoming year

  • Spagetti codebase

@aparnachaudhary
aparnachaudhary / change-log-level.cli
Created July 22, 2015 13:49
WildFly Change Log Level in Domain Mode at runtime
/profile=full/subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=TRACE)
layout title author
post
Context Dependency Injection - Are you doing it right?
aparnachaudhary

CDI specification allows Field, Property (aka setter) and constructor injection. Like many developers out there, I also habitually use field injection. I must admit I never gave enough thought about it. But recently I saw a bean with more than 10 injection points and started to ponder over Dependency Injection.

The following blog post discusses why you should prefer constructor injection over field or setter injection. In the later part of the post, we will see how jQAssistant can be used to find beans with too many injection points or to enforce use of constructor injection.

@aparnachaudhary
aparnachaudhary / jQA-CDI.asciidoc
Last active August 29, 2015 14:02
jqassistant CDI Plugin

Concepts

Bean

Managed Bean

  • Concrete POJO

    • No-arg constructor

    • Constructor with @Inject

  • Objects returned by Producers

@aparnachaudhary
aparnachaudhary / JAX-RS-Resource.asciidoc
Created April 30, 2014 15:45
JAX-RS Resource specification and implementation conflicts

JAX-RS Resource and use of @Path

Based on JAX-RS specification; @Path annotation is not mandatory on Resource classes. But many implementations seem to deviate from the specification. But shouldn’t reference implementation adhere to the specification?

JAX-RS 2.0 spec:

Resource classes are POJOs that have at least one method annotated with @Path or a request method designator.

RESTEasy:

@aparnachaudhary
aparnachaudhary / jQA-Constraints.asciidoc
Last active August 29, 2015 13:57
jqassistant JavaEE constraints

Constraints

JPA2

FieldAccess

Verifies that entities prefer field access over property access.