2014년 5월 8일 목요일

무신론자는 모두 신을 싫어할까?



무신론자들에 대한 일반적 견해는 그들이 하나님 또는 신에 대해 일종의 '증오'나 '혐오'를 갖고 있을 것이란 생각이다.

지난 2011년 성격과사회심리학(Journal of Personality and Social Psychology)지에 소개된 한 연구 결과는 무신론자들이 신에 대한 '분노'의 감정을 품고 있는 경향이 있다고 밝히기도 했다.

그러나 모든 무신론자들이 이러한 성향을 갖고 있다는 것은 또 다른 편견일 뿐이다. 이를 입증하는 한 유명 무신론 블로거의 영상이 최근 미국에서 화제를 모으고 있다.

허먼트 머터(Hemant Mehta)란 이름의 이 무신론자는 "왜 무신론자는 신을 싫어하는가"라는 질문에 응답하고자 만든 영상에서, "믿지 못할지도 모르겠지만, 나는 신을 싫어하지 않는다. 다만 신이 존재한다고 생각하지 않을 뿐이다"고 답한다.

30세인 머터는 현재 시카고의 한 고등학교에서 수학 교사로 일하고 있으며, 블로그를 통해 젊은 무신론자들에게 상담과 조언을 제공하고 있다. 그는 자이나교를 믿는 집안에서 태어났지만, 14세 때 신의 존재에 대해 회의를 느끼고 무신론자로 돌아섰다.

머터는 영상에서 "기독교인을 포함해서 신앙인들은 우리가 마음 깊은 곳에 신에 대한 분노를 품고 있다거나 신에 대해 복수하고 싶어한다고 생각한다"며, "그것은 사실이 아니다. 나는 진리를 사랑하는 것 뿐이며, '초자연적'이라는 것은 없다는 것을 증명하는 것이 내 목표일 뿐이다"고 말한다.

이어 그는 "내가 신을 믿지 않는다는 것이 신을 싫어한다는 것을 의미하지는 않는다"며, "이는 마치 내가 산타 클로스의 존재를 믿지 않지만 그들을 싫어하지는 않는 것과 같다"고 강조한다.

머터가 올린 영상은 이처럼 신에 대한 적대감에 의해서가 아니라, 단순히 신의 존재에 대한 확신이 없어 무신론자가 된 이들도 많다는 점을 교회에 시사한다. 이들에게 교회는 어떻게 접근해야 할까?

머터에게는 뜻밖의 친구가 있다. 바로 랜디 프레이지(Randy Frazee) 목사다. 프레이지 목사는 텍사스 주의 대형교회인 오크힐스교회(Oak Hills Church)를 담임하고 있으며, 머터가 그의 설교를 인터넷에서 비판한 것이 두 사람의 만남의 시작이었다.

두 사람은 이후 수년간 우정을 쌓으며, 기독교와 무신론에 대한 대화를 이어가고 있다. 이러한 대화는 때로는 오크힐스교회의 교인들 앞에서 공개적으로 이뤄진다. 일부 교인들은 이를 달가워하지 않고, 이런 행사에 자리를 피하기도 한다.

그러나 프레이지 목사는 "교회가 우리가 믿는 바에 대해 의혹을 제기하는 이들에게 좀더 안전한 장소가 되어야 한다"고 믿고 있다. 그렇지 않으면 이들은 교회에서 더욱 멀어지게 되며, 동시에 이들이 변화될 수 있는 기회도 함께 사라지기 때문이다.

그는 "오늘날 많은 젊은이들이 교회에서 멀어지는 이유 중 하나는, 그들이 의심할 때에도 그들을 지지해 주고 사랑해 주는 장소가 되지 못하기 때문이다"며, "우리의 가정과 교회가 '젊은이들이 질문하는 것을 막는 장소'가 된다면 우리는 그들을 잃게 될 것"이라고 강조했다.

2014년 2월 27일 목요일

성능개선 정렬 알고리즘 ( Bubble Sort )

public class SearchUtil {

private static void bubbleSort(int[] source){
int length = source.length;
for(int i=0; i< length-1; ++i){
for(int j=0; j< length - 1 - i; ++j){
if(source[j] > source[j+1]){
int tmp = source[j];
source[j] = source[j+1];
source[j+1] = tmp;
}
}
}
}

private static void bubbleSort(ArrayList<Integer> source){
int length = source.size();
for(int i=0; i< length-1; ++i){
for(int j=0; j< length - 1 - i; ++j){
if(source.get(j) > source.get(j+1)){
int tmp = source.get(j);
source.set(j, source.get(j+1));
source.set(j+1, tmp);
}
}
}
}
}







O b s e r v e r ( PureMVC )

/*
 PureMVC Java port by Frederic Saunier <frederic.saunier@puremvc.org>
 
 Adapted from sources of thoses different authors :
  Donald Stinchfield <donald.stinchfield@puremvc.org>, et all
  Ima OpenSource <opensource@ima.eu>
  Anthony Quinault <anthony.quinault@puremvc.org>
 
 PureMVC - Copyright(c) 2006-10 Futurescale, Inc., Some rights reserved. 
 Your reuse is governed by the Creative Commons Attribution 3.0 License
*/
package org.puremvc.java.interfaces;

/**
 * The interface definition for a PureMVC Observer.
 * 
 * <P>
 * In PureMVC, <code>IObserver</code> implementors assume these
 * responsibilities:
 * <UL>
 * <LI>Encapsulate the notification (callback) method of the interested object.</LI>
 * <LI>Encapsulate the notification context (this) of the interested object.</LI>
 * <LI>Provide methods for setting the interested object' notification method
 * and context.</LI>
 * <LI>Provide a method for notifying the interested object.</LI>
 * </UL>
 * 
 * <P>
 * PureMVC does not rely upon underlying event models such as the one provided
 * with Flash, and ActionScript 3 does not have an inherent event model.
 * </P>
 * 
 * <P>
 * The Observer Pattern as implemented within PureMVC exists to support event
 * driven communication between the application and the actors of the MVC triad.
 * </P>
 * 
 * <P>
 * An Observer is an object that encapsulates information about an interested
 * object with a notification method that should be called when an </code>INotification</code>
 * is broadcast. The Observer then acts as a proxy for notifying the interested
 * object.
 * 
 * <P>
 * Observers can receive <code>Notification</code>s by having their <code>notifyObserver</code>
 * method invoked, passing in an object implementing the <code>INotification</code>
 * interface, such as a subclass of <code>Notification</code>.
 * </P>
 * 
 * @see org.puremvc.java.interfaces.IView IView
 * @see org.puremvc.java.interfaces.INotification INotification
 */
public interface IObserver
{

/**
 * Set the notification method.
 * 
 * <P>
 * The notification method should take one parameter of type
 * <code>INotification</code>
 * </P>
 * 
 * @param notifyMethod
 *            the notification (callback) method of the interested object
 */
public void setNotifyMethod( IFunction notifyMethod );

/**
 * Set the notification context.
 * 
 * @param notifyContext
 *            the notification context (this) of the interested object
 */
public void setNotifyContext( Object notifyContext );

/**
 * Notify the interested object.
 * 
 * @param notification
 *            the <code>INotification</code> to pass to the interested
 *            object's notification method
 */
public void notifyObserver( INotification notification );

/**
 * Compare the given object to the notificaiton context object.
 * 
 * @param object
 *            the object to compare.
 * @return boolean indicating if the notification context and the object are
 *         the same.
 */
public boolean compareNotifyContext( Object object );
}








/*
 PureMVC Java port by Frederic Saunier <frederic.saunier@puremvc.org>
 
 Adapted from sources of thoses different authors :
  Donald Stinchfield <donald.stinchfield@puremvc.org>, et all
  Ima OpenSource <opensource@ima.eu>
  Anthony Quinault <anthony.quinault@puremvc.org>
 
 PureMVC - Copyright(c) 2006-10 Futurescale, Inc., Some rights reserved. 
 Your reuse is governed by the Creative Commons Attribution 3.0 License
*/
package org.puremvc.java.patterns.observer;

import org.puremvc.java.interfaces.IFunction;
import org.puremvc.java.interfaces.INotification;
import org.puremvc.java.interfaces.IObserver;

/**
 * A base <code>IObserver</code> implementation.
 * 
 * <P>
 * An <code>Observer</code> is an object that encapsulates information about
 * an interested object with a method that should be called when a particular
 * <code>INotification</code> is broadcast.
 * </P>
 * 
 * <P>
 * In PureMVC, the <code>Observer</code> class assumes these responsibilities:
 * <UL>
 * <LI>Encapsulate the notification (callback) method of the interested object.</LI>
 * <LI>Encapsulate the notification context (this) of the interested object.</LI>
 * <LI>Provide methods for setting the notification method and context.</LI>
 * <LI>Provide a method for notifying the interested object.</LI>
 * </UL>
 * 
 * @see org.puremvc.java.core.View View
 * @see org.puremvc.java.patterns.observer.Notification Notification
 */
public class Observer implements IObserver
{

private Object context;

private IFunction notify;

/**
 * Constructor.
 * 
 * <P>
 * The notification method on the interested object should take one
 * parameter of type <code>INotification</code>
 * </P>
 * 
 * @param notify
 *            the notification method of the interested object
 * @param context
 *            the notification context of the interested object
 */
public Observer( IFunction notify, Object context )
{
setNotifyContext( context );
setNotifyMethod( notify );
}

/**
 * Compare an object to the notification context.
 * 
 * @param object
 *            the object to compare
 * @return boolean indicating if the object and the notification context are
 *         the same
 */
public boolean compareNotifyContext( Object object )
{
return context == object;
}

/**
 * Notify the interested object.
 * 
 * @param notification
 *            the <code>INotification</code> to pass to the interested
 *            object's notification method.
 */
public void notifyObserver( INotification notification )
{
getNotifyMethod().onNotification( notification );
}

/**
 * Set the notification context.
 * 
 * @param notifyContext
 *            the notification context (this) of the interested object.
 */
public void setNotifyContext( Object notifyContext )
{
context = notifyContext;
}

/**
 * Set the notification method.
 * 
 * <P>
 * The notification method should take one parameter of type
 * <code>INotification</code>.
 * </P>
 * 
 * @param notifyMethod
 *            the notification (callback) method of the interested object.
 */
public void setNotifyMethod( IFunction notifyMethod )
{
notify = notifyMethod;
}

/**
 * Get the notification method.
 * 
 * @return the notification (callback) method of the interested object.
 */
public IFunction getNotifyMethod( )
{
return notify;
}

/**
 * Get the notification context.
 * 
 * @return the notification context (<code>this</code>) of the
 *         interested object.
 */
public Object getNotifyContext( )
{
return context;
}

}




C o n t r o l l e r ( PureMVC )

/*
 PureMVC Java port by Frederic Saunier <frederic.saunier@puremvc.org>
 
 Adapted from sources of thoses different authors :
  Donald Stinchfield <donald.stinchfield@puremvc.org>, et all
  Ima OpenSource <opensource@ima.eu>
  Anthony Quinault <anthony.quinault@puremvc.org>
 
 PureMVC - Copyright(c) 2006-10 Futurescale, Inc., Some rights reserved. 
 Your reuse is governed by the Creative Commons Attribution 3.0 License
*/
package org.puremvc.java.interfaces;

/**
 * The interface definition for a PureMVC Controller.
 * 
 * <P>
 * In PureMVC, an <code>IController</code> implementor follows the 'Command
 * and Controller' strategy, and assumes these responsibilities:
 * <UL>
 * <LI> Remembering which <code>ICommand</code>s are intended to handle which
 * <code>INotifications</code>.</LI>
 * <LI> Registering itself as an <code>IObserver</code> with the
 * <code>View</code> for each <code>INotification</code> that it has an
 * <code>ICommand</code> mapping for.</LI>
 * <LI> Creating a new instance of the proper <code>ICommand</code> to handle
 * a given <code>INotification</code> when notified by the <code>View</code>.</LI>
 * <LI> Calling the <code>ICommand</code>'s <code>execute</code> method,
 * passing in the <code>INotification</code>.</LI>
 * </UL>
 * 
 * @see org.puremvc.java.interfaces INotification
 * @see org.puremvc.java.interfaces ICommand
 */
public interface IController
{

/**
 * Register a particular <code>ICommand</code> class as the handler for a
 * particular <code>INotification</code>.
 * 
 * @param notificationName
 *            the name of the <code>INotification</code>
 * @param command
 *            the Class of the <code>ICommand</code>
 */
public void registerCommand( String notificationName, ICommand command );

/**
 * Execute the <code>ICommand</code> previously registered as the handler
 * for <code>INotification</code>s with the given notification name.
 * 
 * @param notification
 *            the <code>INotification</code> to execute the associated
 *            <code>ICommand</code> for
 */
public void executeCommand( INotification notification );

/**
 * Remove a previously registered <code>ICommand</code> to
 * <code>INotification</code> mapping.
 * 
 * @param notificationName
 *            the name of the <code>INotification</code> to remove the
 *            <code>ICommand</code> mapping for
 */
public void removeCommand( String notificationName );
/**
 * Check if a Command is registered for a given Notification 
 * 
 * @param notificationName
 * @return whether a Command is currently registered for the given <code>notificationName</code>.
 */
public boolean hasCommand( String notificationName);
}







/*
 PureMVC Java port by Frederic Saunier <frederic.saunier@puremvc.org>
 
 Adapted from sources of thoses different authors :
  Donald Stinchfield <donald.stinchfield@puremvc.org>, et all
  Ima OpenSource <opensource@ima.eu>
  Anthony Quinault <anthony.quinault@puremvc.org>
 
 PureMVC - Copyright(c) 2006-10 Futurescale, Inc., Some rights reserved. 
 Your reuse is governed by the Creative Commons Attribution 3.0 License
*/
package org.puremvc.java.core;

import java.util.HashMap;
import java.util.Map;

import org.puremvc.java.interfaces.ICommand;
import org.puremvc.java.interfaces.IController;
import org.puremvc.java.interfaces.IFunction;
import org.puremvc.java.interfaces.INotification;
import org.puremvc.java.patterns.observer.Observer;

/**
 * A Singleton <code>IController</code> implementation.
 * 
 * <P>
 * In PureMVC, the <code>Controller</code> class follows the
 * 'Command and Controller' strategy, and assumes these 
 * responsibilities:
 * <UL>
 * <LI> Remembering which <code>ICommand</code>s 
 * are intended to handle which <code>INotifications</code>.</LI>
 * <LI> Registering itself as an <code>IObserver</code> with
 * the <code>View</code> for each <code>INotification</code> 
 * that it has an <code>ICommand</code> mapping for.</LI>
 * <LI> Creating a new instance of the proper <code>ICommand</code>
 * to handle a given <code>INotification</code> when notified by the <code>View</code>.</LI>
 * <LI> Calling the <code>ICommand</code>'s <code>execute</code>
 * method, passing in the <code>INotification</code>.</LI> 
 * </UL>
 * 
 * <P>
 * Your application must register <code>ICommands</code> with the 
 * Controller.
 * <P>
 * The simplest way is to subclass </code>Facade</code>, 
 * and use its <code>initializeController</code> method to add your 
 * registrations. 
 * 
 * @see org.puremvc.java.core.View View
 * @see org.puremvc.java.patterns.observer.Observer Observer
 * @see org.puremvc.java.patterns.observer.Notification Notification
 * @see org.puremvc.java.patterns.command.SimpleCommand SimpleCommand
 * @see org.puremvc.java.patterns.command.MacroCommand MacroCommand
 */
public class Controller implements IController
{

/** 
 * Reference to the singleton instance
 */
protected static Controller instance;
/**
 * Mapping of Notification names to Command Class references
 */
protected Map<String,ICommand> commandMap;

/**
 * Local reference to View
 */
protected View view;

/**
 * Constructor.
 * 
 * <P>
 * This <code>IController</code> implementation is a Singleton, so you
 * should not call the constructor directly, but instead call the static
 * Singleton Factory method <code>Controller.getInstance()</code>
 * 
 */
protected Controller()
{
instance = this;
commandMap = new HashMap<String,ICommand>();
initializeController();
}

/**
 * Initialize the Singleton <code>Controller</code> instance.
 * 
 * <P>Called automatically by the constructor.</P> 
 * 
 * <P>Note that if you are using a subclass of <code>View</code>
 * in your application, you should <i>also</i> subclass <code>Controller</code>
 * and override the <code>initializeController</code> method in the 
 * following way:</P>
 * 
 * <listing>
 * // ensure that the Controller is talking to my IView implementation
 * override public function initializeController(  ) : void 
 * {
 * view = MyView.getInstance();
 * }
 * </listing>
 */
protected void initializeController( )
{
view = View.getInstance();
}

/**
 * <code>Controller</code> Singleton Factory method.
 * 
 * @return the Singleton instance of <code>Controller</code>
 */
public synchronized static Controller getInstance()
{
if (instance == null)
instance = new Controller();

return instance;
}

/**
 * If an <code>ICommand</code> has previously been registered to handle a
 * the given <code>INotification</code>, then it is executed.
 * 
 * @param note
 *  The notification to send associated with the command to call.
 */
public void executeCommand( INotification note )
{
//No reflexion in GWT
//ICommand commandInstance = (ICommand) commandClassRef.newInstance();
ICommand commandInstance = (ICommand) this.commandMap.get( note.getName() );
if(commandInstance!=null){
commandInstance.execute( note );
}
}

/**
 * Register a particular <code>ICommand</code> class as the handler for a
 * particular <code>INotification</code>.
 * 
 * <P>
 * If an <code>ICommand</code> has already been registered to handle
 * <code>INotification</code>s with this name, it is no longer used, the
 * new <code>ICommand</code> is used instead.
 * </P>
 * 
 * The Observer for the new ICommand is only created if this the 
 * first time an ICommand has been regisered for this Notification name.
 * 
 * @param notificationName
 *            the name of the <code>INotification</code>
 * @param command
 *            an instance of <code>ICommand</code>
 */
public void registerCommand( String notificationName, ICommand command )
{
if( null != this.commandMap.put( notificationName, command ) )
return;
view.registerObserver
(
notificationName,
new Observer
(
new IFunction()
{
public void onNotification( INotification notification )
{
executeCommand( notification );
}
},
this
)
);
}

/**
 * Remove a previously registered <code>ICommand</code> to
 * <code>INotification</code> mapping.
 * 
 * @param notificationName
 *            the name of the <code>INotification</code> to remove the
 *            <code>ICommand</code> mapping for
 */
public void removeCommand( String notificationName )
{
// if the Command is registered...
if ( hasCommand( notificationName ) )
{
// remove the observer
view.removeObserver( notificationName, this );
commandMap.remove( notificationName );
}
}
/**
 * Check if a Command is registered for a given Notification 
 * 
 * @param notificationName
 * The name of the command to check for existance.
 *
 * @return whether a Command is currently registered for the given <code>notificationName</code>.
 */
public boolean hasCommand(String notificationName )
{
return commandMap.containsKey(notificationName);
}
}