- 博客(39)
- 收藏
- 关注
原创 业务逻辑处理顺序
业务处理逻辑示意图Validator的break in time表示只要碰到一个validator不满足条件就退出,pass through all 表示所有的validator都验证完。processor chain的separate表示每个processor都是独立处理的,composite表示所有的processor是一个整体,要一起成功或一起失败。
2012-09-10 12:27:41 699
转载 MONGODB Best Practices
Summary of Best Practices"First class" objects, that are at top level, typically have their own collection.Line item detail objects typically are embedded.Objects which follow an object mode
2012-09-04 00:42:57 441
转载 Designing MongoDB Schemas with Embedded, Non-Embedded and Bucket Structures
With the rapid adoption of schema-less, NoSQL data stores like MongoDB, Cassandra and Riak in the last few years, developers now have the ability enjoy greater agility when it comes to their applicati
2012-09-04 00:35:21 786
转载 IO Models
原文地址,可见异步IO才真正的强悍。Before describing select and poll , we need to step back and look at the bigger picture, examining the basic differences in the five I/O models that are available to us u
2011-12-10 19:23:09 517
原创 ThreadLocal学习笔记
首先来看一下Lock和ThreadLocal的区别,Lock是用来协调多个线程之间数据共享的,ThreadLocal是用来解决多个线程之间数据隔离的。下面就ThreadLocal做一下具体的分析,看它是如何做到线程之间数据隔离的,先来看它的set方法源码: public void set(T value) { Thread t = Thread.currentThr
2011-12-10 19:17:12 1875
转载 Oracle取月份,不带前面的0
今天碰到只要取月份和天数,如果月份前面有0要去掉0.比如说2010-01-08 ,需要的结果是1-8.引出了一系列的sql语句第一: 利用to_number的函数转换自动截0select to_number(to_char(sysdate,'mm'))||'-'||to_number(to_char(sysdate,'dd')) from dual;第二: 利用ltrim函数加固定
2011-11-29 14:26:02 1699
转载 Comet
Comet is a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it.[1][2] Comet is an umbrella term, e
2011-11-27 00:18:53 672
转载 Asynchronous Servlets
IntroductionWhy Asynchronous Servlets ?Not Asynchronous IOThe concept of Asynchronous Servlets is often confused with Asynchronous IO or the use of NIO. However, Asynchronous Servlets
2011-11-27 00:06:54 1951
原创 AJAX浏览器兼容性问题
JavaScript编程的最大问题来自不同的浏览器对各种技术和标准的支持。XmlHttpRequest对象在不同浏览器中不同的创建方法,以下是跨浏览器的通用方法:// Provide the XMLHttpRequest class for IE 5.x-6.x:// Other browsers (including IE 7.x-8.x) ignore this//
2011-11-26 23:47:09 594
转载 Cron Quartz
上一文中提到 Cron触发器可以接受一个表达式来指定执行JOB,下面看看这个表达式的语法。 cron 表达式的格式 Quartz cron 表达式的格式十分类似于 UNIX cron 格式,但还是有少许明显的区别。区别之一就是 Quartz 的格式向下支持到秒级别的计划,而 UNIX cron 计划仅支持至分钟级。许多我们的触发计划要基于秒级递增的(例如,每45秒),因此这是一个非常好
2011-11-09 09:56:04 1188
转载 Common Code Smell
Duplicated code: identical or very similar code exists in more than one location.Long method: a method, function, or procedure that has grown too large.Large class: a class that has grown too la
2011-11-07 23:10:12 661
原创 事件驱动架构要点
设计组件领域事件定义(DomainEvent)领域模型支持领域事件处理(Domain)事件池(EventRepository-> Persistence)事件分发(EventDispatcher)事件处理器 ->领域模型(Event Processor -> Domain)事件同步处理(等待超时控制--如何在超时时取消事件防止超时后事件被处理)、异步处理(EventSy
2011-11-07 01:21:12 1221
转载 Strom Tutorial
PreliminariesThis tutorial uses examples from the storm-starter project. It's recommended that you clone the project and follow along with the examples. Read Setting up development environment
2011-11-07 01:13:10 733
转载 Strom Concepts
This page lists the main concepts of Storm and links to resources where you can find more information. The concepts discussed are:TopologiesStreamsSpoutsBoltsStream groupingsReliabilit
2011-11-07 01:10:53 568
转载 Temporal Property
A property that changes over timeUsually when we see properties on a class, they represent questions we can ask of an object now. However there are times when we don't want to just ask quest
2011-11-06 14:38:05 658
转载 Parallel Model
Allow an alternative representation of the state of an application, either at a different time or in a hypothetical state.Enterprise Applications are information systems which capture data about t
2011-11-06 14:35:32 1205
转载 Retroactive Event
Automatically correct the consequences of a incorrect event that's already been processed.Enterprise applications are about capturing information from the world, doing various computations on th
2011-11-06 14:32:12 571
转载 Event Collaboration
Multiple components work together by communicating with each other by sending events when their internal state changes.When we have components that collaborate with each other, whether they be a
2011-11-06 14:30:59 1071
转载 Agreement Dispatcher
Structure a processor for Domain Events around business agreements.In a system driven by Domain Events its important to be able to easily find and change the processing rules that react to t
2011-11-06 14:30:01 664
转载 Event Sourcing
Capture all changes to an application state as a sequence of events.We can query an application's state to find out the current state of the world, and this answers many questions. However there
2011-11-06 14:28:01 1364
转载 Domain Event
Captures the memory of something interesting which affects the domainExample: I go to Babur's for a meal on Tuesday, and pay by credit card. This might be modeled as an event, whose event type
2011-11-06 14:26:43 724
转载 Refining Uncle Bob’s Clean Code(四)
And another one …01import java.util.regex.Pattern;02import com.mgi.util.args.ArgsException.ErrorCode;03 04pu
2011-10-27 10:50:20 949
转载 Refining Uncle Bob’s Clean Code(三)
But now, let’s take a closer look at the new interface of ArgumentMarshaler:01public interface ArgumentMarshaler {02 03 public
2011-10-27 10:49:22 1332
转载 Refining Uncle Bob’s Clean Code(二)
Looking back at the Args example, i would see class Args as the root of its ‘application’, thus responsible for bringing the different parts into life and statisfying their needs. Under this view, A
2011-10-27 10:47:59 1260
转载 Refining Uncle Bob’s Clean Code(五)
Symmetry of abstractionIf you look at the original code (like method parseArgument() and some of its called methods) you might detect a mix of levels of abstraction. For example, deciding if the c
2011-10-27 10:46:37 661
转载 Refining Uncle Bob’s Clean Code(一)
December 3, 2008 — Mario GleichmannI’ve just finished reading ‘Uncle Bob’s’ new book ‘Clean Code‘. I fully agree with most of the statements and it was a pleasure to read, especially because U
2011-10-27 10:42:18 2325
原创 前后UML图对比 - Refining Uncle Bob’s Clean Code
Refining Uncle Bob’s Clean Code 这篇文章对类职责划分和扩展性做了很好的阐释,主要体现了SRP, OCP,下面贴出重构前后的UML类图,情况自然一目了然。重构前:重构后:
2011-10-27 10:33:09 735
转载 GC - 垃圾回收器相关参数汇总
A5.1 Heap LayoutOptionDefault valueMax ValueDescription-XX:NewSize2MbControls the initial size of young generation-XX:MaxNewSize Controls the maximum size
2011-10-26 16:39:21 938
转载 GC - Category of Garbage Collector
2.1 Low Pause Collectors2.1.1 Parallel Copying CollectorThe Parallel Copying Collector is similar to the Copying Collector [1], but instead of using one thread to collect young generation ga
2011-10-26 16:04:32 589
转载 GC - The Garbage Collector
The Garbage CollectorNote that the discussions of garbage collectors, the various GC algorithms, and modeling in the following sections focus on Sun's implementations of the Java Virtual Machine
2011-10-25 10:54:40 706
转载 GC - Our Collectors
Our CollectorsBy jonthecollector on Feb 01, 2008I drew this diagram on a white board for some customers recently. They seemed to like it (or were just being very polite) so I thought I redraw
2011-10-25 10:37:52 509
转载 GC - More of a Good Thing
More of a Good ThingBy jonthecollector on Aug 30, 2006The throughput collector is getting more parallel.In our J2SE 6 release there is an option in the throughput collector to collect the te
2011-10-25 10:15:57 526
原创 编程价值观和需要注意的原则
日常工作中编写的代码是用来给人看的,给维护的人,给使用代码的人看,所以,代码的质量直接影响到别人的效率,需要在编码中多思考,其实很多事情没那么复杂,很简单的,Implementation Patterns这本书中提到的下面这些东西可以给些启发,值得记录价值观:沟通 Communication 简单 Simplicity灵活 Flexibility原则:局部化影响 L
2011-10-18 23:21:55 987
原创 Spring Batch(一)
最近因为工作需要抽空学习了一下Spring Batch,本次学习基于Spring Batch2.1.8。Spring Batch是一个进行批处理的框架,系统中可能会有需要在后台执行的不需要人工干预的任务处理要求,比如说定时计算报表数据,定时抽取数据等。先来看Spring Batch官方给出的两张图: 从图中可以看到Spring Batch被划分为三个模块,Appli
2011-09-12 00:10:21 1453
原创 由Adapter模式引起的联想
大家知道Adapter的实现分两种方式,一种是继承方式,一种是组合方式。假定我们原来有类层次结构如下图:现在我们需要RM和MPEG具备resize的能力,我们定义接口继承的实现方式如下图:组合的实现方式如下图:其实Extension Object模式完全可以实现Adapter模式的功能,对于像eclipse这样的应
2011-09-04 20:25:02 433
原创 Extension Object Pattern
We need a mechanism that allows us toAdd a service interface to a type without exposing it in that typeAdd behavior to preexisting types such as IFileThe pattern is called Extension Object
2011-09-04 17:41:58 913
转载 优秀程序设计的18大原则
1.避免重复原则(DRY - Don’t repeat yourself)编程的最基本原则是避免重复。在程序代码中总会有很多结构体,如循环、函数、类等等。一旦你重复某个语句或概念,就会很容易形成一个抽象体。2.抽象原则(Abstraction Principle )与DRY原则相关。要记住,程序代码中每一个重要的功能,只能出现在源代码的一个位置。3.简单原则(Kee
2011-09-04 11:16:10 481
原创 关于Groovy里面元编程(MetaProgramming)的一点总结
Groovy的元编程有两种方式,EMC(支持为类的某个实例或所有实例添加动态行为,主要是依托delegate),CATEGORY支持为特定的一些实例动态添加类行为,并且能够很好的集成目前java中存在的工具类方法。具体如以下代码所示:EMC方式: // 为所有对象添加动态行为 String.metaClass.shout = {->ret
2011-09-03 01:51:04 2173
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人