<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5676695826944219979</id><updated>2011-12-26T08:54:30.618-08:00</updated><category term='Application Design'/><category term='Design principles'/><category term='Struts'/><category term='Design patterns'/><category term='Enums'/><category term='IA'/><category term='Filosofía'/><category term='Logs'/><category term='Informatica'/><category term='Linux'/><category term='Procesadores de Lenguajes'/><category term='Sistemas Operativos'/><category term='Threads'/><category term='Java'/><category term='Exceptions'/><category term='JEE'/><category term='Test'/><category term='Ingeniería Software'/><category term='Java Reflection'/><title type='text'>Entropy utopy</title><subtitle type='html'>Entropic utopic Univers in expansion by Mohammed Marouane Ajraoui</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-8888292995825303808</id><published>2011-08-19T08:53:00.001-07:00</published><updated>2011-08-23T15:50:04.998-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Test'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Reflection'/><title type='text'>Java reflection</title><content type='html'>&lt;div&gt;How to test private methods? One solution is using java reflection, here is a utility class defining a static method, wich allows invocation to the private mehods we want to test.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;package org.marwan.alephn.test.utilities;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;import java.lang.reflect.Method;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt; * A class with reflection utilities for testing private methods&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt; */&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;public class ReflectUtilities&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt; /**&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  * To be used in case of need to test private methods with &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  * return type, a cast to the type&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  * @param aClass&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  *          Name of the class witch declares the method to be invoked&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  * @param instance&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  *          An instance of a aClass&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  * @param aMethod&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  *          Name of the method to invoke&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  * @param params&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  *          Class type of the parameter of the method to invoke&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  * @param args&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  *          Arguments for the method to invoke&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  * @return Object to be cast to the return type of the method invoked&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  * @throws Exception&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  *           If error&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  */&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  public static Object invoke(final Class&lt;!--?--&gt; aClass, final Object instance,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  final String aMethod, final Class&lt;!--?--&gt;[] params, final Object[] args)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  throws Exception&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;Object o = null;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;try&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/span&gt;final Method m = aClass.getDeclaredMethod(aMethod, params);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/span&gt;m.setAccessible(true);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/span&gt;o = m.invoke(instance, args);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;catch (final Exception e)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/span&gt;throw e;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return o;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Good and quick reference to check for java reflection uses:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;a href="http://www.java2s.com/Code/Java/Reflection/CatalogReflection.htm"&gt;http://www.java2s.com/Code/Java/Reflection/CatalogReflection.htm&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-8888292995825303808?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/8888292995825303808/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2011/08/java-reflection.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/8888292995825303808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/8888292995825303808'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2011/08/java-reflection.html' title='Java reflection'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-1334346392876065061</id><published>2011-08-11T07:24:00.000-07:00</published><updated>2011-08-18T10:42:50.440-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Basic modifiers you should know before programming in Java</title><content type='html'>&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;The static keyword can be used in 4 scenarios&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style="font-size: 12px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;1)&lt;/strong&gt; static variables&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;It is a variable which &lt;strong&gt;belongs to the class&lt;/strong&gt; and &lt;strong&gt;not &lt;/strong&gt;to &lt;strong&gt;object&lt;/strong&gt;(instance)&lt;/li&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;Static variables are &lt;strong&gt;initialized only once&lt;/strong&gt; , at the start of the execution . These variables will be initialized first, before the initialization of any instance variables&lt;/li&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;A &lt;strong&gt;single copy&lt;/strong&gt; to be shared by all instances of the class&lt;/li&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;A static variable can be &lt;strong&gt;accessed directly &lt;/strong&gt;by the &lt;strong&gt;class name&lt;/strong&gt; and doesn’t need any object&lt;/li&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;Syntax : &amp;lt;&lt;strong&gt;&lt;em&gt;class-name&amp;gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 16px; "&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;2)&lt;/strong&gt; static methods&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="color: rgb(104, 99, 98); font-size: 12px; line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;It is a method which &lt;strong&gt;belongs to the class &lt;/strong&gt;and &lt;strong&gt;not &lt;/strong&gt;to the &lt;strong&gt;object&lt;/strong&gt;(instance)&lt;/li&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;A static method &lt;strong&gt;can access only static data&lt;/strong&gt;. It can not access non-static data (instance variables)&lt;/li&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;A static method &lt;strong&gt;can call&lt;/strong&gt; &lt;strong&gt;only&lt;/strong&gt; other &lt;strong&gt;static methods &lt;/strong&gt;and can not call a non-static method from it.&lt;/li&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;A static method can be &lt;strong&gt;accessed directly &lt;/strong&gt;by the &lt;strong&gt;class name&lt;/strong&gt; and doesn’t need any object&lt;/li&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;Syntax : &amp;lt;&lt;strong&gt;&lt;em&gt;class-name&amp;gt;.&lt;method-name&gt;&lt;/method-name&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;A static method cannot refer to "this" or "super" keywords in anyway&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;3)&lt;/strong&gt; static blocks of code.&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;The static block, is a block of statement inside a Java class that will be executed when a class is first loaded in to the JVM&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;class Test{&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;span style="color: rgb(51, 153, 102); "&gt;&lt;span style="font-family: tahoma, arial, helvetica, sans-serif; "&gt;static {&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;span style="color: rgb(51, 153, 102); "&gt;&lt;span style="font-family: tahoma, arial, helvetica, sans-serif; "&gt;//Code goes here&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;span style="color: rgb(51, 153, 102); "&gt;&lt;span style="font-family: tahoma, arial, helvetica, sans-serif; "&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;strong&gt;4) &lt;/strong&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;static&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt; Inner class.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;Make an inner class top-level class&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; "&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: 20px; font-weight: 800; letter-spacing: -1px; line-height: 25px; "&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="color: rgb(104, 99, 98); font-size: 12px; line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;/p&gt;&lt;h1 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 4px; padding-bottom: 4px; padding-left: 4px; font-size: 20px; line-height: 25px; letter-spacing: -1px; color: rgb(66, 115, 146); "&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/h1&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;/pre&gt;&lt;pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;/pre&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;The final keyword can be used in 4 scenarios&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style="font-size: 12px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;1)&lt;/strong&gt; final variables&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;It is a variable which &lt;b&gt;can not change its value&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 16px; "&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;2)&lt;/strong&gt; final method&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;It is a method which &lt;b&gt;can not be overriden and dinamically looked up (Polymorphism)&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 16px; "&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;3)&lt;/strong&gt; final field&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;It is a variable which &lt;b&gt;can not change its value. Static final fields are compile-time constants.&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 16px; "&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;4)&lt;/strong&gt; final class&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;It is a calss which &lt;b&gt;can not be subclassed&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 15px; "&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;b&gt;Modifiers keyword for access levels&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "&gt;&lt;table border="1" summary="This table defines levels of access conferred by a modifier"&gt;&lt;caption id="accesscontrol-levels"&gt;&lt;b&gt;Access Levels&lt;/b&gt;&lt;/caption&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th id="h1"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;&lt;/th&gt;&lt;th id="h2"&gt;      Class&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;&lt;/th&gt;&lt;th id="h3"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;   &lt;/span&gt;Package&lt;/th&gt;&lt;th id="h4"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;   &lt;/span&gt;Subclass&lt;/th&gt;&lt;th id="h5"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;   &lt;/span&gt;World&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td headers="h1"&gt;&lt;code&gt;public&lt;/code&gt;&lt;/td&gt;&lt;td headers="h2"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;td headers="h3"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;td headers="h4"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;td headers="h5"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td headers="h1"&gt;&lt;code&gt;protected&lt;/code&gt;&lt;/td&gt;&lt;td headers="h2"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;td headers="h3"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;td headers="h4"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;td headers="h5"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;N&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td headers="h1"&gt;&lt;i&gt;no modifier&lt;/i&gt;&lt;/td&gt;&lt;td headers="h2"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;td headers="h3"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;td headers="h4"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;N&lt;/td&gt;&lt;td headers="h5"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;N&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td headers="h1"&gt;&lt;code&gt;private&lt;/code&gt;&lt;/td&gt;&lt;td headers="h2"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;Y&lt;/td&gt;&lt;td headers="h3"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;N&lt;/td&gt;&lt;td headers="h4"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;N&lt;/td&gt;&lt;td headers="h5"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;	&lt;/span&gt;N&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;The transient keyword can be used for a field&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style="font-size: 12px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;1)&lt;/strong&gt; transient field&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;It is a field to not to be serialized with the object serialization. &lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="font-size: 12px; color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;The synchronized keyword can be used for a method&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style="font-size: 12px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;1)&lt;/strong&gt; synchronized method&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; "&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); line-height: normal; "&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;For a static method, a lock for the class is acquired before executing the method. For a non-static method, a lock for the specific object instance is acquired.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-size: 12px; font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; "&gt;&lt;span class="Apple-style-span" style="line-height: 16px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 12px; font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; "&gt;&lt;span class="Apple-style-span" style="line-height: 16px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;The native keyword can be used for a method&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style="font-size: 12px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; line-height: 15px; background-color: rgb(239, 239, 221); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; "&gt;&lt;strong&gt;1)&lt;/strong&gt; native method&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;ul class="checklist" style="line-height: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: inside; list-style-image: initial; "&gt;&lt;li style="padding-left: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://www.javatutorialhub.com/templates/js_jamba/images/style2/checklist.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; list-style-type: none; list-style-image: initial; line-height: 16px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; list-style-position: outside; background-position: 0% 50%; background-repeat: no-repeat no-repeat; "&gt;It is a method witch is platform-dependent. It doesn't have body, only signature.&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; font-size: 12px; background-color: rgb(239, 239, 221); "&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); background-color: rgb(239, 239, 221); "&gt;&lt;span class="Apple-style-span" style="color: rgb(104, 99, 98); background-color: rgb(239, 239, 221); "&gt;&lt;div style="font-size: 12px; font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; "&gt;&lt;span class="Apple-style-span" style="line-height: 16px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 12px; font-family: Geneva, 'Trebuchet MS', Lucida, Arial, sans-serif; "&gt;&lt;span class="Apple-style-span" style="line-height: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-1334346392876065061?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/1334346392876065061/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2011/08/basic-modifiers-you-should-know-before.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/1334346392876065061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/1334346392876065061'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2011/08/basic-modifiers-you-should-know-before.html' title='Basic modifiers you should know before programming in Java'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-8798232757606067839</id><published>2011-07-24T17:18:00.001-07:00</published><updated>2011-08-18T17:25:35.949-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Exceptions'/><category scheme='http://www.blogger.com/atom/ns#' term='Enums'/><category scheme='http://www.blogger.com/atom/ns#' term='Logs'/><title type='text'>Le potentiel des enum  pour les Logs et messages d'erreur</title><content type='html'>&lt;div&gt;&lt;div style="text-align: justify;"&gt;Dernièrement j'ai travaillé sur la gestion des erreurs et des logs dans un très grand projet. Une des bonnes pratiques que j'ai pu connaître, est de regrouper tous les messages de logs, exceptions ou autres de la librairie en développement dans un Enum. Ceci permet de forcer les développeurs a définir toutes les propriétés requises, et de respecter la structure des messages de log et d'exception établit, ainsi que l'utilisation de ces derniers dans les logs et exceptions.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Un bon exemple d'un message descriptif, bien structuré, à produire dans la log ou pour décrire une exception peut être le suivant. Un message qui contient son code, son libellé, l'impact et l'action, sous la forme : code - libellé | impact | action.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Le code du message peut être préfixé par le package ou composant qui produit l'erreur.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Le code source java doit référencer l'une des valeurs énumérées de notre classe de Log, (donc pour un nouveau message créer une nouvelle valeur) ; cela permet ensuite de pouvoir trouver où sont utilisés chaque message (Référence / Workspace), de les renommer sans risque, ...&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;La déclaration de la valeur est en fait un appel à un constructeur à qui l'on passe le code du message, le libellé du message, l'impact de la cause du message (sous forme de valeur d'une énumération), et l'action à entreprendre suite au message (sous forme de valeur d'une énumération).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Pour raison de performance, on n'utilise pas de fichier de propriétés pour associer le libellé au code, ceci est fait directement dans la classe. L'impact et l'action sont des énumérations internes, qu'il convient d'utiliser ou de compléter. Leurs déclarations de valeurs sont aussi des constructeurs auxquels on passe une description courte et une description longue, la première devant être incluse dans le message de log.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Les valeurs énumérées et les descriptions sont en français. On peut créer une interface de cette classe Log, Ilog, est écrire une implementation pour chaque langue supporté par notre application. Après par fichier de configuration on pourrait désigner une implementation ou une autre à instancier pour notre application installé.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Se référer à &lt;a href="http://download.oracle.com/docs/cd/E17476_01/javase/1.5.0/docs/guide/language/enums.html"&gt;Enums&lt;/a&gt; pour une explication sur l'utilisation avancée des énumérations.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-8798232757606067839?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/8798232757606067839/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2011/07/enum-potential-pour-les-logs.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/8798232757606067839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/8798232757606067839'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2011/07/enum-potential-pour-les-logs.html' title='Le potentiel des enum  pour les Logs et messages d&apos;erreur'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-5088647982800218627</id><published>2011-07-24T17:13:00.000-07:00</published><updated>2011-08-18T11:07:20.636-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='Application Design'/><category scheme='http://www.blogger.com/atom/ns#' term='Design principles'/><title type='text'>Design principles</title><content type='html'>&lt;div&gt;Fancy words are beeing used by many software developpers. I can hear in my office many people discussing design patterns. I find it curious that most of those developpers knows many of design patterns but don't know anything about design principles. It is usual in our entropic world to do and talk about things without knowing why.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here are the five design principles u should know, before designing Object Oriented applications.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(34, 34, 34); font-family: Verdana; font-size: 13px; background-color: rgb(217, 219, 210); "&gt;&lt;h2 style="font-family: Georgia; color: black; "&gt;&lt;a href="http://www.oodesign.com/open-close-principle.html" style="color: rgb(0, 0, 0); "&gt;Open Close Principle&lt;/a&gt;&lt;/h2&gt;&lt;i&gt;&lt;ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "&gt;&lt;li style="line-height: 15px; padding-left: 15px; padding-top: 0px; background-image: url(http://www.oodesign.com/templates/oodesign7/images/arrow.png); background-position: 0px 3px; background-repeat: no-repeat no-repeat; "&gt;Software entities like classes, modules and functions should be &lt;b&gt;open for extension&lt;/b&gt; but &lt;b&gt;closed for modifications.&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 15px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(34, 34, 34); font-family: Verdana; font-size: 13px; background-color: rgb(217, 219, 210); "&gt;&lt;h2 style="font-family: Georgia; color: black; "&gt;&lt;a href="http://www.oodesign.com/dependency-inversion-principle.html" style="color: rgb(0, 0, 0); "&gt;Dependency Inversion Principle&lt;/a&gt;&lt;/h2&gt;&lt;i&gt;&lt;ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "&gt;&lt;li style="line-height: 15px; padding-left: 15px; padding-top: 0px; background-image: url(http://www.oodesign.com/templates/oodesign7/images/arrow.png); background-position: 0px 3px; background-repeat: no-repeat no-repeat; "&gt;High-level modules should not depend on low-level modules. Both should depend on abstractions.&lt;/li&gt;&lt;li style="line-height: 15px; padding-left: 15px; padding-top: 0px; background-image: url(http://www.oodesign.com/templates/oodesign7/images/arrow.png); background-position: 0px 3px; background-repeat: no-repeat no-repeat; "&gt;Abstractions should not depend on details. Details should depend on abstractions.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(34, 34, 34); font-family: Verdana; font-size: 13px; background-color: rgb(217, 219, 210); "&gt;&lt;h2 style="font-family: Georgia; color: black; "&gt;&lt;a href="http://www.oodesign.com/interface-segregation-principle.html" style="color: rgb(0, 0, 0); "&gt;Interface Segregation Principle&lt;/a&gt;&lt;/h2&gt;&lt;i&gt;&lt;ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "&gt;&lt;li style="line-height: 15px; padding-left: 15px; padding-top: 0px; background-image: url(http://www.oodesign.com/templates/oodesign7/images/arrow.png); background-position: 0px 3px; background-repeat: no-repeat no-repeat; "&gt;Clients should not be forced to depend upon interfaces that they don't use.&lt;/li&gt;&lt;/ul&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(34, 34, 34); font-family: Verdana; font-size: 13px; background-color: rgb(217, 219, 210); "&gt;&lt;h2 style="font-family: Georgia; color: black; "&gt;&lt;a href="http://www.oodesign.com/single-responsibility-principle.html" style="color: rgb(0, 0, 0); "&gt;Single Responsibility Principle&lt;/a&gt;&lt;/h2&gt;&lt;i&gt;&lt;ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "&gt;&lt;li style="line-height: 15px; padding-left: 15px; padding-top: 0px; background-image: url(http://www.oodesign.com/templates/oodesign7/images/arrow.png); background-position: 0px 3px; background-repeat: no-repeat no-repeat; "&gt;A class should have only one reason to change.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(34, 34, 34); font-family: Verdana; font-size: 13px; background-color: rgb(217, 219, 210); "&gt;&lt;h2 style="font-family: Georgia; color: black; "&gt;&lt;a href="http://www.oodesign.com/liskov-s-substitution-principle.html" style="color: rgb(0, 0, 0); "&gt;Liskov's Substitution Principle&lt;/a&gt;&lt;/h2&gt;&lt;i&gt;&lt;ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "&gt;&lt;li style="line-height: 15px; padding-left: 15px; padding-top: 0px; background-image: url(http://www.oodesign.com/templates/oodesign7/images/arrow.png); background-position: 0px 3px; background-repeat: no-repeat no-repeat; "&gt;Derived types must be completely substitutable for their base types.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;For more details, check for ur own benefit, this reference:&lt;/div&gt;&lt;a href="http://www.oodesign.com/design-principles.html"&gt;http://www.oodesign.com/design-principles.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-5088647982800218627?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/5088647982800218627/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2011/07/design-principle.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/5088647982800218627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/5088647982800218627'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2011/07/design-principle.html' title='Design principles'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-7666669477843094151</id><published>2010-06-30T18:12:00.000-07:00</published><updated>2011-08-23T16:26:43.743-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Threads'/><category scheme='http://www.blogger.com/atom/ns#' term='Application Design'/><title type='text'>Designing thread safety</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;Java language and API supports multi-threading, so let's discuss briefly the key points, we should consider designing thread safe.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); "&gt;&lt;strong style="font-weight: bold; "&gt;Why do we need thread-safe?&lt;/strong&gt;&lt;/span&gt; Well, because multithreading is built into Java, it is possible that any class you design eventually may be used concurrently by multiple threads. You needn't (and shouldn't) make every class you design thread-safe, because thread safety doesn't come for free. But you should at least &lt;em&gt;think &lt;/em&gt;about thread safety every time you design a Java class.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;Given the architecture of the JVM, &lt;b&gt;you need only be concerned with instance and class variables when you worry about thread safety. Because all threads share the same heap, and the heap is where all instance variables are stored, multiple threads can attempt to use the same object's instance variables concurrently.&lt;/b&gt; Likewise, because all threads share the same method area, and the method area is where all class variables are stored, multiple threads can attempt to use the same class variables concurrently.  When you do choose to make a class thread-safe, your goal is to guarantee the integrity -- in a multithreaded environment -- of instance and class variables declared in that class.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;Y&lt;span class="Apple-style-span"&gt;ou needn't worry about multithreaded access to local variables, method parameters, and return values, because these variables reside on the Java stack. In the JVM, each thread is awarded its own Java stack. No thread can see or use any local variables, return values, or parameters belonging to another thread.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;Given the structure of the JVM, local variables, method parameters, and return values are inherently "thread-safe."  But instance variables and class variables will only be thread-safe if you design your class appropriately.&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); "&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="text-align: justify;"&gt;&lt;span&gt;&lt;strong style="font-weight: bold; "&gt;How to make an object thread-safe?&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;There are basically three approaches you can take to make an object thread-safe:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol&gt;&lt;li style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;Synchronize critical sections: For this approach is essential to make all fields that you need to coordinate multithreaded access to, private. (only the fields involved in  any temporarily invalid states). Otherwise it may be possible for other classes and objects to ignore your critical sections and access the fields directly. Then,  you need to mark the object's critical sections as synchronized. A &lt;em style="font-style: italic; "&gt;critical section &lt;/em&gt;is a bit of code that must be executed atomically, that is, as a single, indivisible operation. (use the Syncronized modifier).&lt;/span&gt;&lt;/li&gt;&lt;li style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;Make it immutable: An &lt;em style="font-style: italic; "&gt;immutable object&lt;/em&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt; is one whose state can't be changed once the object is created.Immutable objects are, by their very nature, thread-safe simply because threads have to be able to write to an object's instance variables to experience a read/write or write/write conflict. Because no methods (only the constructor) of an immutable object actually write to the object's instance variables, the object is by definition thread-safe.In this approach to making an object thread-safe, you don't mark critical sections as synchronized. Instead, you separate out the critical sections that read instance variables from those that write to instance variables. The critical sections that read are left as-is. The critical sections that write must be changed so that, instead of altering the current object's instance variables, they create a new object that embodies the new state and returns a reference to that object.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;Use a thread-safe wrapper: &lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-size: medium; "&gt;The third approach to making an object thread-safe is to embed that object in a thread-safe wrapper object. In this approach you leave the original class (which isn't thread-safe) unchanged and create a separate class that is thread-safe. Instances of the new class serve as thread-safe "front ends" to instances of the original class.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: large; "&gt;&lt;strong style="font-weight: bold; "&gt;Why not just synchronize everything?&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: medium; "&gt;&lt;p&gt;thread safety may involve a performance penalty. For example:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Synchronized method invocations generally are going to be slower than non-synchronized method invocations. In Sun's current JVM, for example, synchronized method invocations are 4 to 6 times slower than non-synchronized method invocations.&lt;p&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;Unnecessary synchronized method invocations (and synchronized blocks) can cause unnecessary blocking and unblocking of threads, which can hurt performance.&lt;p&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;Synchronization gives rise to the possibility of deadlock, a severe performance problem in which your program appears to hang.&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: medium; "&gt;&lt;strong style="font-weight: bold; "&gt;Using immutable objects&lt;/strong&gt;&lt;br /&gt;Achieving thread safety by making objects immutable (Approach 2) works well when objects are small and represent values of a simple abstract data type. The Java API includes several examples of immutable objects, including &lt;code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; "&gt;String&lt;/code&gt; and the primitive type wrappers such as &lt;code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; "&gt;Integer&lt;/code&gt;, &lt;code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; "&gt;Long&lt;/code&gt;, &lt;code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; "&gt;Float&lt;/code&gt;, &lt;code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; "&gt;Boolean&lt;/code&gt;, &lt;code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; "&gt;Character&lt;/code&gt;, and so on. &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: medium; "&gt;If the overhead of immutability (excessive creation of short-lived objects) may at times be too inefficient, you can define a mutable companion class that can be used when the immutable version isn't appropriate.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: medium; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: medium; "&gt;&lt;strong style="font-weight: bold; "&gt;Using wrapper objects&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: medium; "&gt;The wrapper object approach to thread safety makes the most sense when you want to give clients a choice between a version of a class that is thread-safe and one that isn't. This approach also makes sense when you're a client of someone else's class that isn't thread-safe, but you need to use the class in a multithreaded environment. Once you define your own thread-safe wrapper for the class, you can safely use the class in a multithreaded environment by going through your wrapper.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: large; "&gt;&lt;strong style="font-weight: bold; "&gt;When to make classes thread-safe&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: large; "&gt;&lt;strong style="font-weight: bold; "&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-size: medium; "&gt;Your thread-safety decision should be based simply on whether or not your class will be exposed to potential write/write or read/write conflicts by your programs. To know whether or not such conflicts are possible, you just have to know how your program will work.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: large; "&gt;&lt;strong style="font-weight: bold; "&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-size: medium; "&gt;If, instead of creating classes for an applet or application, you are creating classes for a library, either one that will be shared in-house or will serve as a product in its own right, you have a different problem. You may not know exactly how the classes will be used. In such cases, it may be a good idea to give clients a choice via the thread-safe wrapper approach.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; font-size: large; "&gt;&lt;strong style="font-weight: bold; "&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-size: medium; "&gt;&lt;p&gt;&lt;a name="resources"&gt;&lt;strong style="font-weight: bold; "&gt;Resources&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name="resources"&gt;&lt;strong style="font-weight: bold; "&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-size: medium; "&gt;Resources and discussion forum.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(33, 35, 36); font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-size: medium; "&gt;&lt;p&gt;&lt;a name="resources"&gt;&lt;strong style="font-weight: bold; "&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong style="font-weight: bold; "&gt;&lt;a href="http://www.artima.com/designtechniques/"&gt;http://www.artima.com/designtechniques/&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-7666669477843094151?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/7666669477843094151/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2010/06/designing-thread-safety.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/7666669477843094151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/7666669477843094151'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2010/06/designing-thread-safety.html' title='Designing thread safety'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-4179032737726472856</id><published>2009-11-02T04:02:00.000-08:00</published><updated>2011-08-23T15:06:18.583-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JEE'/><category scheme='http://www.blogger.com/atom/ns#' term='Struts'/><title type='text'>¿Porque usar los tags de struts de la librería html si lo que me genera es codigo HTML?</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;Dépues&lt;/span&gt; de plantear la &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;cuestión&lt;/span&gt; de ¿Porque usar los &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;tags&lt;/span&gt; de &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;struts&lt;/span&gt; de la &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_5"&gt;librería&lt;/span&gt; html si lo que me genera es &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_6"&gt;código&lt;/span&gt; HTML?&lt;br /&gt;He averiguado que los &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;tags&lt;/span&gt; de struts HTML, te &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;rendrizan&lt;/span&gt; el HTML y &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_9"&gt;además&lt;/span&gt; te enlazan los campos de HTML con las propiedades de tu &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;actionForm&lt;/span&gt;. Por lo cual te ahorra en la &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;action&lt;/span&gt; hacer el &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;getParameter&lt;/span&gt; de todos y cada uno de los elementos de tu &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;form&lt;/span&gt; para asignarlos a tu &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;actionForm&lt;/span&gt;. Otra de las ventajas es que permiten recuperar "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;resources&lt;/span&gt;" del fichero de recursos según el idioma predeterminado de navegador (i18n). Para un &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;tag&lt;/span&gt; "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;img&lt;/span&gt;" por ejemplo los valores de "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;altkey&lt;/span&gt;" se recogería de los ficheros de recursos según el idioma del cliente,como es el caso para &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;titlekey&lt;/span&gt;. Cabe mencionar que se puede poner “&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;alt&lt;/span&gt;” ó “&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;title&lt;/span&gt;” en el tag, sin problemas.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-4179032737726472856?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/4179032737726472856/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/11/porque-usar-los-tags-de-struts-de-la.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/4179032737726472856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/4179032737726472856'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/11/porque-usar-los-tags-de-struts-de-la.html' title='¿Porque usar los tags de struts de la librería html si lo que me genera es codigo HTML?'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-4478152310324902880</id><published>2009-10-29T07:25:00.001-07:00</published><updated>2009-10-29T10:00:01.829-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Filosofía'/><category scheme='http://www.blogger.com/atom/ns#' term='Ingeniería Software'/><title type='text'>¿Como surgió OOP?</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: justify;"&gt;Vamos a frikear un poco y hablar del punto de vista de metodología de la ciencia como surgió OOP. Déspues de haber leído el siguiente artículo: "Existe una bala de plata" de Brad J. Cox. sobre la crisis del software, que podréis encontrar en &lt;a href="http://www.virtualschool.edu/cox/index.html"&gt;el site de Cox&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Junto a los artículos titulados 'No Silver Bullet, Essence and Accidents of Software Engineering' y 'No silver buller revisited' se dibuja una buena perspectiva acerca de la crisis del software que vivimos en un pasado y qué seguimos viviendo de vez en cuando, todavía existen muchas funcionalidades y APIs que deberían ser cajas negras para nostros, pero sin embargo, siempre acabamos investigando un buen rato hasta verlas grises, ó blancas del todo, para su manejo.&lt;br /&gt;&lt;br /&gt;En 1968, la Conferencia sobre Ingeniería de Software de la OTAN acuño la expresión  "Crisis"  para indicar que el software era escaso, caro, de insuficiente calidad, difícil de planificar y casi imposible de gestionar.&lt;br /&gt;&lt;br /&gt;De otra parte, algunas publicaciones de Fred Brooks especialmente No Silver Bullet: Essence and Accidents of Software Engineering aducen que las dificultades son inevitables, ya que surgen de la esencia ineludible del software. ¿Como explica Brad j. cox esta crisis? ¿Qué son los criterios que nos permiten reconocer que efectivamente vivimos una crisis de software?&lt;br /&gt;&lt;br /&gt;Muy bien, notamos que los componentes del dominio del software obedecen unas leyes específicas de un caso único, no existen directrices generales que pongan orden en el ámbito del software, no podemos evitar la confusión en clasificarlos ni en definir con precisión los conceptos usuales en este dominio.&lt;br /&gt;&lt;br /&gt;La comunidad del software mantiene su encaprichamiento con los procesos que utilizamos para la construcción de objetos, persiguiendo la perfección, en vez de centrarse en hacer software tangible y dúctil ante la manipulación del sentido común facilitando a los consumidores de software que cada uno resuelva sus propios problemas especializados de software de la misma forma que se resuelven los problemas de fontanería: montando soluciones a partir de un robusto mercado de componentes reutilizables y fácilmente asequibles que, a su vez son suministrados por múltiples grados de producción de nivel inferior.&lt;br /&gt;&lt;br /&gt;El desarrollo de un mercado robusto y muy detallado de componentes de software reutilizables en el cual podemos encontrar piezas estándar implica una arquitectura multinivel de software análoga a la arquitectura multinivel de hardware.&lt;br /&gt;&lt;br /&gt;Al leer estos textos se refleja claramente una corriente de metodología científica que converge y corresponde con los paradigmas de Thomas S. Kuhn.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Fases del desarrollo científico de acuerdo con los paradigmas de khun:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Pues tenemos una etapa précientifica: Después de la revolución industrial, que había provocado suficientes avances, produciendo importantes logros en el transporte, las comunicaciones y la informática. La era de la información, el recurso crítico para convertir datos en bruto en información útil, estaba empezando.&lt;br /&gt;&lt;br /&gt;Luego tenemos la fase de Constitución de paradigmas: El modelo centrado en los procesos&lt;br /&gt;&lt;br /&gt;Otro componente de los paradigmas de Khun que se cumple; Ciencia Normal: Los programadores no se cuestionan el paradigma ni sus realizaciones. Esta fase se caracterizó con una gran productividad. Sin embargo, esto no quita la existencia de anomalías que han ido apareciendo al marco del paradigma.&lt;br /&gt;&lt;br /&gt;Anomalías: Plazos incumplidos y presupuestos que se podían disparar en el desarrollo de algunas aplicaciones, llevando en algunas ocasiones a productos fallidos.&lt;br /&gt;&lt;br /&gt;Crisis: El software era escaso, caro, de insuficiente calidad, difícil de planificar y casi imposible de gestionar.&lt;br /&gt;&lt;br /&gt;Revolución científica: Una revolución industrial del software basada en piezas reutilizables e intercambiables.&lt;br /&gt;&lt;br /&gt;Nuevo paradigma: Tecnologías orientadas a objetos&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Este suceso de la crisis de software se puede explicar tambien de acuerdo a una metodología científica elaborada por Imre Lakatos, el falsacionismo refinado.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Falsacionismo refinado:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Una Teoría T es falseada por otra T’ si y solo si:&lt;br /&gt;1) T’ tiene un exceso de contenido teórico respecto a T.&lt;br /&gt;2) T’ explica todo el éxito previo de T.&lt;br /&gt;3) Una parte del exceso de contenido de T’ resulta corroborado.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lakatos plantea con el falsacionismo refinado una crítica al criterio irracional de sustitución de teorías y al concepto de revolución científica. Aplicando dicha metodología, el cambio de paradigma estructurado centrado en procesos por el paradigma orientado a objetos no resulta coherente. Pues, no se cumplen las condiciones para poder falsear el modelo antiguo y aducir el cambio de paradigma.&lt;br /&gt;&lt;br /&gt;Otro hecho en la historia de informática que planteó un cambio de paradigma es por ejemplo: la aparición de los computadores personales y su encuentro con las redes. Esto ha introducido cambios radicales en la práctica informática, ya que el modelo al cual se aspiraba antes era que con unas pocas de aquellas enormes máquinas como el ENIAC se suplirían las necesidades computacionales de la época.&lt;br /&gt;&lt;br /&gt;Aquello supuso cambios auténticos humanos y empresariales, tanto en la industria tecnológica (arquitecturas de ordenador, modelos de programación, arquitecturas de sistemas operativos…) como en la sociedad.&lt;br /&gt;&lt;br /&gt;Seguiremos viviendo procesos de evolución entre entropías tendiendo a utopías.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-4478152310324902880?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/4478152310324902880/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/10/vamos-frikear-un-poco-y-hablar-del.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/4478152310324902880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/4478152310324902880'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/10/vamos-frikear-un-poco-y-hablar-del.html' title='¿Como surgió OOP?'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-3436553958814012228</id><published>2009-10-29T04:06:00.000-07:00</published><updated>2009-10-29T05:41:59.077-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JEE'/><title type='text'>Diferencias entre forward y redirect</title><content type='html'>&lt;p class="MsoNormal"  style="line-height: normal; text-align: justify;font-family:arial;"&gt;&lt;span lang="ES"  style="font-size:100%;"&gt;Un redirect implica enviar un codigo http 300 con la url de redirección al cliente, y será este ultimo quien realizará una nueva petición a esa url. En cambio un forward es un mecanismo interno del servidor de aplicaciones que sirve para seguir gestionando la misma petición con otro elemento (otro jsp, otro servlet, etc) pero, en cualquier caso, no hay comunicación con el cliente.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify; font-family: arial;"&gt;  &lt;/div&gt;&lt;p class="MsoNormal"  style="line-height: normal; text-align: justify;font-family:arial;"&gt;&lt;span lang="ES"  style="font-size:100%;"&gt;Si haces un forward, el objecto que gestione la solicitud a partir de ese momento tendrá acceso a la misma instancia de HttpServletRequest que antes del forward (ya que es la misma peticion). Un ejemplo claro de forward que aparece en struts y en cualquier mvc es entre el controlador (tu Action) y la vista (tu jsp).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="color: rgb(0, 153, 0); font-weight: bold;font-family:arial;font-size:100%;"  &gt;&amp;lt;send:Redirect to="/supagina.html" /&amp;gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-family:arial;font-size:100%;"  &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 153, 0); font-weight: bold;font-family:arial;font-size:100%;"  &gt;&amp;lt;send:forward to="/supagina.html" /&amp;gt;&lt;/span&gt;&lt;p class="MsoNormal"  style="line-height: normal; font-weight: bold;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span lang="ES"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal; text-align: justify;font-family:arial;"&gt;&lt;span lang="ES"  style="font-size:100%;"&gt;Es mas común y eficiente usar un forward, el redirect tiene sentido si necesitas que el nuevo recurso del redirect que va a atender la petición sepa cual es la url del cliente. &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;u&gt;&lt;span style="" lang="ES"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span lang="ES"  style="font-size:100%;"&gt;En scriptlet un redirect, se invoca directamente sobre el objeto impliticto response, sería algo así:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"  style="line-height: normal; font-weight: bold; color: rgb(0, 153, 0);font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;response.sendRedirect("/suPagina.html");&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span lang="ES"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span lang="ES"  style="font-size:100%;"&gt;El scriptlet para hacer un forward, se invoca sobre un objeto RequestDispatcher que primero habrá que instanciar:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"  style="line-height: normal; color: rgb(0, 153, 0); font-weight: bold;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;RequestDispacher rd = request.getRequestDispacher("/resource.jsp");&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: rgb(0, 153, 0); font-weight: bold;"&gt;rd.forward(request,response); &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style="" lang="ES"&gt;Otro metodo util del request dispatcher es&lt;span style=""&gt;  &lt;/span&gt;el include, permite incluir el texto de un fichero dentro de la página:&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="" lang="ES"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal; color: rgb(0, 153, 0); font-weight: bold;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;RequestDispacher rd = request.getRequestDispacher("/resource.jsp");  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal; color: rgb(0, 153, 0); font-weight: bold;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;rd.&lt;/span&gt;&lt;span style="font-size:100%;"&gt; include&lt;/span&gt;&lt;span style="font-size:100%;"&gt;      (request,response);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:100%;"  lang="ES" &gt;&lt;br /&gt;&lt;br /&gt;La forma de hacerlo con un tag sería la siguiente:&lt;/span&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 153, 0);font-size:100%;" &gt;&amp;lt;jsp:include page="sub_botonera.jsp" flush="true"&amp;gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Tambien se le puede pasar parametros, que se pueden recoger de la "request.getParameter":&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: rgb(0, 153, 0); font-weight: bold;"&gt;&amp;lt;jsp:include page="scripts/login.jsp"&amp;gt; &lt;/span&gt;&lt;span style="color: rgb(0, 153, 0); font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: rgb(0, 153, 0); font-weight: bold;"&gt;           &amp;lt;jsp:param name="username" value="jsmith" /&amp;gt; &lt;/span&gt;&lt;span style="color: rgb(0, 153, 0); font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: rgb(0, 153, 0); font-weight: bold;"&gt;&amp;lt;/jsp:include&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="line-height: normal;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Un include tambien puede hacerse de esta foram pero tiene menos juego:&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 153, 0);font-size:100%;" &gt;&amp;lt;%@ page include="/pagina.jsp" %&amp;gt;&lt;/span&gt;  &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-3436553958814012228?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/3436553958814012228/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/10/diferencias-entre-forward-y-redirect.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/3436553958814012228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/3436553958814012228'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/10/diferencias-entre-forward-y-redirect.html' title='Diferencias entre forward y redirect'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-1834678462443933237</id><published>2009-10-29T03:36:00.000-07:00</published><updated>2009-11-02T03:02:02.847-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JEE'/><title type='text'>Etiquetas JSP</title><content type='html'>Las etiquetas pertenecientes a la especificación JSP. Proporcionan una funcionalidad básica.&lt;br /&gt;&lt;br /&gt;Un primer grupo de etiquetas proporciona funcionalidad a nivel de la página de una manera muy simple:&lt;br /&gt;&lt;br /&gt;- &amp;lt;jsp:forward&amp;gt;&amp;lt;/jsp:forward&amp;gt;, redirige la request a otra URL.&lt;br /&gt;&lt;br /&gt;- &amp;lt;jsp:include&amp;gt;&amp;lt;/jsp:include&amp;gt;, incluye el texto de un fichero dentro de la página.&lt;br /&gt;&lt;br /&gt;- &amp;lt;jsp:plugin&amp;gt;&amp;lt;/jsp:plugin&amp;gt;, descarga un plugin de Java (una applet o un Bean).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Un segundo grupo permite manipular componentes JavaBean sin conocimientos de Java. &lt;br /&gt;&lt;br /&gt;- &amp;lt;jsp:usebean&amp;gt;&amp;lt;/jsp:usebean&amp;gt;, permite manipular un  &lt;a href="http://es.wikipedia.org/wiki/Bean" title="Bean"&gt;Bean&lt;/a&gt; (si no existe, se creará el Bean), especificando su ámbito (scope), la clase y el tipo.&lt;br /&gt;&lt;br /&gt;- &amp;lt;jsp:getproperty&amp;gt;&amp;lt;/jsp:getproperty&amp;gt;, obtiene la propiedad especificada de un bean previamente declarado y la escribe en el objeto response.&lt;br /&gt;&lt;br /&gt;- &amp;lt;jsp:setproperty&amp;gt;&amp;lt;/jsp:setproperty&amp;gt;, establece el valor de una propiedad de un bean previamente declarado.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-1834678462443933237?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/1834678462443933237/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/10/etiquetas-jsp.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/1834678462443933237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/1834678462443933237'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/10/etiquetas-jsp.html' title='Etiquetas JSP'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-1203326992090157727</id><published>2009-10-20T05:26:00.000-07:00</published><updated>2010-05-31T16:44:34.046-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JEE'/><title type='text'>JSTL y EL buena alternativa a Scriptlets</title><content type='html'>&lt;div style="text-align: justify;"&gt;La creación de sitios Web dinámicos en Java, requiere la incrustación de scriptlets  para algunos (código Java embebido). Se pueden identificar algunas debiladades en dicha práctica, entre las cuales se citan:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;El código Java embebido en scriptlets es desordenado.&lt;/li&gt;&lt;li&gt;Un Desarrollador Web que no conoce Java no puede modificar el código Java embebido.&lt;/li&gt;&lt;li&gt;No permite a los diseñadores y personas que describen la lógica de presentación que actualicen el contenido de la página con facilidad.&lt;/li&gt;&lt;li&gt;El código de Java dentro de scriptlets JSP no pueden ser reutilizados por otros JSP, por lo tanto la lógica común termina siendo re-implementada en múltiples páginas.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;br /&gt;JSTL Java Standard Tag Languages y EL Expretion Languages, son extenciones a la especificación Jsp de sun, surgieron para simplificar el desarrolllo de JSP's, y eliminar los problemas citados previamente.&lt;br /&gt;&lt;br /&gt;En este post comentaremos la sintaxis de JSTL, en concreto de su librería core, que representa el lenguaje de control de flujo en una JSP, en paralelo hablaremos de EL que representa el lenguaje de acceso a datos.&lt;br /&gt;&lt;br /&gt;Primero y ante todo, para poder escribir tags JSTL y que estos seán interpretables habrá que incluír la directrice:&lt;br /&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;font-size:130%;" &gt;Instrucciones de selección&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;A continuación, Veamos cual es la sintaxis de las instrucciones de selección que se pueden hacer con JSTL. Empezamos con las más simple, con un ejemplo. El codigo  ilustrado abajo.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;c:if test="${!empty cookie.userName}"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;  Welcome back &amp;lt;c:out value="${cookie.userName.value}" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;/c:if&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;En JSTL, la palabra reservada "empty" , comprueba que un valor es vacío (null, string vacío, o una collección vacía).&lt;br /&gt;&lt;br /&gt;Seguimos con la estructuras de selección multiple, este ejmplo ilustra la sintaxis de un swith case:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&amp;lt;c:if test="${pageContext.request.method=='POST'}"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;You entered:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;c:choose&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;c:when test="${param.enter=='1'}"&amp;gt;One&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;/c:when&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;c:when test="${param.enter=='2'}"&amp;gt;Two&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;/c:when&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;c:when test="${param.enter=='3'}"&amp;gt;Three&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;/c:when&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;c:otherwise&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;c:out value="${param.enter}" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt; &amp;lt;/c:otherwise&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;/c:choose&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;/c:if&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Mencionar que  un tag "else", no existe como tal en el core de JSTL. Pero se puede hacer  una sentencia  "if else",  recuriendo a la estructura anterior,  haciendo un "when" y un "otherwise". Ejemplo:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-weight: bold;"&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;&amp;lt;c:choose&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&amp;lt;c:when test="${param.enter=='1'}"&amp;gt; HOLA&amp;lt;/c:when&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;lt;c:otherwise&amp;gt; ADIOS &amp;lt;/c:otherwise&amp;gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&amp;lt;/c:choose&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;En los ejemplos anteriores habréis constatado, que se han usado expresiónes EL para recuperar valores de distintos atributos y distintos objetos. Para los objetos implicitos está la siguiente correspondencia que viene bien tener en claro:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt; //Solo recupera parametros Strings que se han mandado por la url, vía Post o Get.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;${param.test} --&gt; request.getParameter("test") ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;//Recuperan un objeto cuya clave se pasa como parametro, es un hashMap &lt;/span&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;definido.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;${requestScope.test} --&gt; request.getAttribute("test");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;       ${sessionScope.test}     --&gt; session.getAttribute("test");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;       ${applicationScope.test} --&gt; application.getAttribute("test");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;       ${pageScope.test}        --&gt; pageContext.getAttribute("test");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;       ${test}                  --&gt; pageContext.findAttribute("test");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;Definir una variable&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;La forma de definir una variable, es la siguiente:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;c:set var="noOfRows" value="10"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Se le puede especificar el atributo "scope" que puede tomar los siguientes valores: page, request, session o application. Por defecto cuando no se especifica el scope toma el valor page&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;font-size:130%;" &gt;Instrucciones de repetición&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;La forma de iterar con JST es mediante la instrucción "forEach" y además se le puede especificar los atributos begin y end.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;c:forEach items="${forecasts.rows}" var="${city}"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;begin="${param.first}" end="${param.first + noOfRows - 1}"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;City: &amp;lt;c:out value="${city.name}" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;Tomorrow's high: &amp;lt;c:out value="${city.high}" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;Tomorrow's low: &amp;lt;c:out value="${city.low}" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;/c:forEach&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Tratamiento de urls:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Los ejemplos anteriores funcionan bien mientras se utilicen las cookies para seguimiento de sesión. No está todo dado; el navegador podría tener desactivadas las cookies, o no soportarlas. Por lo tanto es una buena idea activar el contenedor para usar la reescritura de URL como backup de los cookies. La reescritura de URL, como podrías conocer, significa poner el ID de la sesión en todas las URLs usadas en los enlaces y formularios de la página. Una URL reescrita se parece a algo como esto:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;myPage.jsp;jspsessionid=ah3bf5e317xmw5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Cuando el usuario pulsa en una línea como esta, el identificador de sesión ID se envía al contenedor como parte de la URL. La librería corazón de JSTL incluye la acción &lt;tt&gt;&lt;c:url&gt;&lt;/c:url&gt;&lt;/tt&gt;, que tiene cuidado de la reescritura de URL por nosotros. Aquí está como podemos usarla para mejorar la generación del enlace "Previous Page" del ejemplo anterior:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;c:url var="previous" value="foreach.jsp"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;c:param name="first" value="${param.first - noOfRows}" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;/c:url&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;&amp;lt;a href="&amp;lt;c:out value="${previous}"/&amp;gt;"&amp;gt;Previous Page&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Usar import ó include:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;tt&gt;&lt;br /&gt;&amp;lt;c:import&amp;gt;&amp;lt;/c:import&amp;gt;&lt;/tt&gt; es una acción más flexible que la acción estándar &lt;tt&gt;&amp;lt;jsp:include&amp;gt;&amp;lt;/jsp:include&amp;gt;&lt;/tt&gt;. Podemos usarla para incluir contenido desde los recursos dentro de la misma aplicación Web, desde otras aplicaciones Web en el mismo contenedor, o desde otros servidores, usando protocolos como HTTP y FTP.&lt;br /&gt;&lt;br /&gt;En este post se ha intentado introducir a la buena practica de usar JSTL y EL, existen todavía otras librerías de JSTL, para formateo de datos y internacionalización, tratamiento xml y para la gestión conexiones a bases de datos. La core es la más útil ya que se ocupa de las cosas básicas como son iteraciones, condicionales, manipulación de URL y otras funciones generales, por esta razon he optado escribir sobre ello.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-1203326992090157727?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/1203326992090157727/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/10/la-creacion-de-sitios-web-dinamicos-en.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/1203326992090157727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/1203326992090157727'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/10/la-creacion-de-sitios-web-dinamicos-en.html' title='JSTL y EL buena alternativa a Scriptlets'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-7266159272601318975</id><published>2009-09-22T04:15:00.001-07:00</published><updated>2009-10-29T05:44:08.631-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Procesadores de Lenguajes'/><title type='text'>Inicios de la abstracción del hardware</title><content type='html'>&lt;div style="text-align: justify;"&gt;En los albores de la programación no había ningún tipo de abstracción. La “programación” en aquel entonces era completamente diferente a como la conocemos ahora. En general el hardwareproporcionaba un medio de escribir códigos hexadecimales en su memoria, y una vez en memoria los códigos eran procesados.&lt;br /&gt;&lt;br /&gt;El primer ordenador personal que jamás se vendió fue el MITS ALTAIR 8800. Esta pieza de tecnología venía equipada con 256 flamantes bytes (no, no kbytes) de memoria RAM – ampliables, eso sí, a 2, 4, 8 ¡e incuso 12 KB! La introducción de códigos hexadecimales se realizaba utilizando algunas “palancas”, que al ser accionadas modificaban el valor de los bits en la memoria, mostrándose el cambio en los LEDs.&lt;br /&gt;&lt;br /&gt;La primera evolución fueron los ensambladores. En lugar de escribir el código directamente en binario, el programador utilizaba nemotécnicos. Así, se pasó de escribir “0xFFAC” a escribir algo parecido a “ADD A,B” N.B: Los nemotécnicos no aislan al programador del hardware; para programar en lenguaje ensamblador es necesario conocer la máquina tan bien como cuando se programa directamente en código máquina.&lt;br /&gt;&lt;br /&gt;El primer entorno de programación (limitado) que permitía “ignorar” el hardware fue BASIC. Conociendo una serie de conceptos abstractos, era muy sencillo escibir programas interpretables por antlair BASIC ADD A,B pasó a convertirse en LET speed=speed+aux.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;N.B: El Altair BASIC fue un intérprete para el lenguaje de programación BASIC que corría en el Altair 8800 de MITS y posteriormente en las máquinas de Bus S-100. Fue el primer producto de Microsoft (como Micro-Soft), distribuido por MITS bajo contrato. Altair BASIC fue el principio de la gama de productos de Microsoft BASIC.&lt;br /&gt;&lt;br /&gt;Extended BASIC fue el primer software comercial que desarrolló un tal Bill Gates. Con el tiempo, no obstante, los lenguajes de programación han ido evolucionando más y más, añadiendo más y más abstracción, de manera que hoy en día la mayoría de programadores desconocen por completo la arquitectura de la máquina sobre la que están programando. Los lenguajes compilados más utilizados fueron, primeramente, FORTRAN, y más tarde C.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-7266159272601318975?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/7266159272601318975/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/09/inicios-de-la-abstraccion-del-hardware.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/7266159272601318975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/7266159272601318975'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/09/inicios-de-la-abstraccion-del-hardware.html' title='Inicios de la abstracción del hardware'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-8426268847588213334</id><published>2009-09-22T03:05:00.000-07:00</published><updated>2009-10-29T07:50:37.183-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Sistemas Operativos'/><title type='text'>Restaurar el Grub</title><content type='html'>&lt;div style="text-align: justify;"&gt;Al instalar cualquier sistema operativo Microsoft, se sobreescribe el MBR, borrando nuestro sistema de arranque, lo cual es molesto para algunos usuarios nuevos de Linux, ya que no pueden acceder a su máquina Linux. Lo curioso es que sistemas operativos Microsoft se detectan entre sí, y no borran la información de arranque de otros sistemas operativos Microsoft, pero las de otros sistemas operativos, sí.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Para recuperar nuestro sistema de arranque, introducimos un LiveCD de Ubuntu, lo arrancamos, y ejecutamos por consola:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;code&gt;sudo cfdisk&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Identificamos la partición de linux, suele tener un sistema de archivos ext3, en mi caso es: sda4. Una vez localizada dicha partición la montamos:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;code&gt;sudo mount /dev/sda4 /mnt/sda4 -t ext3&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;y luego reinstalamos el grub en sda&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sudo grub-install --root-directory=/mnt/sda4 /dev/sda&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;Ya tienes tu Grub restaurado con dos comandos ejecutados.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-8426268847588213334?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/8426268847588213334/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/09/restaurar-el-grub.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/8426268847588213334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/8426268847588213334'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/09/restaurar-el-grub.html' title='Restaurar el Grub'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-3125789054700119810</id><published>2009-06-19T09:04:00.000-07:00</published><updated>2010-05-31T17:06:39.551-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IA'/><title type='text'>IA : Algoritmos de búsqueda en Juegos</title><content type='html'>&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;A fin de comprender el funcionamiento del algoritmo alfa-beta para la búsqueda en juegos dejaré un ejemplo de una implemetación de dicho algoritmo en una  próxima entrada  de mi blog.  El ejemplo  que dejaré publicado fue implementado para calcular la mejor jugada para un juego de origen africano, como no, bipersonal llamado OWARE ó wari.&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;En juegos bipersonales el algoritmo más usado es el denominado &lt;b&gt;Minimax&lt;/b&gt;. El procedimiento de búsqueda &lt;b&gt;Minimax &lt;/b&gt;es una búsqueda en profundidad (&lt;i&gt;DFS&lt;/i&gt;) de profundidad limitada. Este algoritmo es bastante costoso en cuanto a  complejidad temporal. Para acotar el espacio de búsqueda de la mejor jugada, encontramos otros algoritmos como: Alpha Beta, SSS*o Scout.&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;Vamos a explicar el principio de como funcionan todos estos algoritmo de busqueda mencionados aplicados a juegos, sin entrar en los detalles de complejidades espaciales y temporales de los mismos, pues los dejaremos para proximos Posts. Partiendo de un estado del juego, por ejemplo un tablero, que representará el nodo raíz de nuestro arbol de busqueda, bifurcamos todas las posibles jugadas, obtenemos N estados nuevos de tablero en el nivel 1, luego volvemos a bifurcar todas las posibles jugadas que puede hacer nuestro adversario, volveremos a obtener N estados nuevos para el nivel 2, y así sucesivamente, hasta llegar al ultimo nivel (que fijáremos dependiendo de las limitaciones  tiempo y memoria) donde evaluaremos los tableros, ventajas y desventajas de cada uno. Para evaluar los estados del tablero finales, los que corresponden a los nodos hoja de nuestro arbol, llamamos a una fución de evaluación, &lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;que tendrá como&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt; propósito, &lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;para un estado &lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;dado&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt; de un tablero, analizar y ponderar de forma óptima y eficiente el estado de este último según los criterios que se hayan tomado en consideración. Es obio que la función de evaluación desempeña un papel muy importante en la búsqueda y obtención de la mejor jugada.&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;Esta función nos devuelve el mejor resultado obtenido, vuelta atrás, y ya tenemos la mejor jugada.&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;Ahora bien, el MiniMax es el algoritmo más costoso en cuanto a complejidad temporal y espacial, su mejora es el alpha-beta, introduce poda teniendo en cuenta cotas superiores e inferiores de los espacios de búsqueda, limitando así el espacio de la solución. SSS* es más eficiente en caunto a complejidad temporal, sin embargo consume bastante recursos de memoria. Scout reduce las complejidades temporales y espaciales de forma espectacular en algunos casos.&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;Si otpaís por implementar alguno tenerlo en consideración.&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-3125789054700119810?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/3125789054700119810/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/06/ia-algoritmos-de-busqueda-en-juegos.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/3125789054700119810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/3125789054700119810'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/06/ia-algoritmos-de-busqueda-en-juegos.html' title='IA : Algoritmos de búsqueda en Juegos'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-1187250880387910804</id><published>2009-06-19T08:49:00.000-07:00</published><updated>2009-09-22T08:40:18.108-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Informatica'/><title type='text'>¿En que consiste el mito de que la informática es un campo de programadores?</title><content type='html'>&lt;div style="text-align: justify;" class="storycontent"&gt;    &lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;Este mito consiste en percibir el campo de informática como un campo que se basa y se resume fundamentalmente en la programación. Ya que firmemente es alojado en películas, novelas, noticias, publicidad, discursos políticos, percepciones de otros científicos e ingenieros, y en las mentes de principiantes anticipados a nuestra profesión. Que es más, muchas personas creen que la informática es sólo un campo de tecnología sin mucha ciencia e ingeniería; la palabra “ciencia” en este campo parece inmerecida. Peter J. Denning Comenta en su articulo: &lt;a href="http://alephn.lacucalbina.org/wp-content/uploads/2008/03/denning_20041pdf.zip" title="The Field of Programmers Myth"&gt;The Field of Programmers Myth&lt;/a&gt;, &lt;em&gt;The persistent public image of computing as a field of programmers has become a costly myth. Reversing it is possible but not easy. &lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;em&gt;¿Cómo se puede hacer frente a esto?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Establecer y afirmar un gran marco de principios de una nueva representación de nuestro campo que acentúa nuestros principios científicos y de la ingeniería y nuestras cuatro prácticas principales es clave para hacer frente a esto. Nuestros principios fundamentales están en el diseño y en la mecánica de cómputo, comunicación, coordinación, y la automatización. Estos principios no fueron tomados prestados de otros campos; los informáticos los desarrollaron. El examinar este mundo por una ventana de programa no permite ver lo que verdaderamente representa. Nuestro desafío debe adoptar una visión más amplia del campo, que revela la ciencia y no confunde la ciencia y la práctica.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;em&gt;¿Como formar a nuestros ingenieros teniendo en cuenta esto?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Para Fred Brooks el escollo fundamental de la programación, es y siempre será, el comportamiento complejo de sistemas de software grandes. Según él, el desarrollo y la producción de software es esencialmente un problema de talento y diseño que sólo puede ser encontrado por una determinación y preocupación por cultivar a grandes diseñadores; No cultivando a grandes programadores. Subrayando la importancia del diseño de sistemas. La adquisición de un talento y una habilidad en asimilar ideas y conocimientos, tienen un enorme efecto sobre la calidad del trabajo: desarrolladores buenos de software son a menudo 10 veces más productivos que principiantes. Brooks sugiere hacer un esfuerzo concertado para enseñar a la comunidad de informáticos ser grandes diseñadores y desarrolladores de software expertos.&lt;/p&gt; &lt;p&gt;De otra parte, tenemos a Dijkstra, un creyente apasionado en la visión matemática de programas y programación, piensa que el modo correcto de enseñar la informática es ofrecer una docencia más sólida en la derivación formal de programas de los predicados lógicos que expresan sus requisitos, proponiendo eliminar de los cursos de principio, asignaturas que abarquen el estudio del verdadero mundo de lenguajes de programación.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;em&gt;¿Cuales son las habilidades que debe tener un profesional de TI de acuerdo a Dening?&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;Un profesional de TI de acuerdo a Dening debería tener el conocimiento extenso de bibliotecas y algoritmos básicos y ser capaz de juntar muchos módulos en un sistema que satisface a clientes. Tendría el conocimiento extenso de los acontecimientos históricos en el programa, sería capaz de diseñar sistemas de software grandes que combinan muchos niveles de abstracción, y definiría los nuevos métodos que mejoran toda la práctica de programa.&lt;/p&gt; &lt;p&gt;Denning hace cuatro recomendaciones para ayudar a reorganizar el plan de estudios para la enseñanza de nuestra disciplina de un modo coherente.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;1. Enseñar el pensamiento algorítmico. El pensamiento algorítmico es una práctica mental de ingeniería y el descubrimiento científico que conceptúa problemas con representaciones digitales y busca algoritmos que expresan o encuentran soluciones.&lt;/p&gt; &lt;p&gt;2. Agrupar la enseñanza de prácticas en una sección de Prácticas de computación del plan de estudios.&lt;br /&gt;Los cursos ahora son etiquetados Informática 1 y 2, pudiendo en la mayor parte de casos ser etiquetado de nuevo Programando Prácticas1 y 2. La introducción a la ingeniería de software puede ser modificada para ser la introducción a prácticas de sistemas. Un curso de prácticas de modelado tendrá que ser añadido a la mayor parte de planes de estudios. El curso de diseño cada vez más popular también puede enseñar prácticas de innovación.&lt;/p&gt; &lt;p&gt;3. Estructurar un marco que da clases alrededor de una escala de capacidad en la práctica.&lt;br /&gt;En cualquier dominio, la escala de capacidad describe los niveles aprobados de habilidad que uno puede lograr dando bastante práctica y experiencia. Definir a los criterios que nos permitirían juzgar el nivel en el cual alguien funciona. Clasificar tanto la calidad del trabajo como la calidad del funcionamiento. Conseguir a profesores con experiencia en el campo para estos cursos.&lt;br /&gt;Aplicando esto, podemos ver criterios diferentes en cada nivel.&lt;/p&gt; &lt;p&gt;4. Enseñar la práctica de detección y corrección de errores. Incluso la gente más experta hace errores.&lt;br /&gt;El provocar errores es parte del proceso; el descubrimiento, la corrección, y el estudio de ellos son parte de la práctica.&lt;br /&gt;Los estudiantes tienen que ver desde el principio como conectar abstracciones a acciones. &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Dening propone el establecimiento de una gran Biblioteca de Principios para apoyar a la gente de nuestro campo en el estudio de los principios y la representación orientada de la informática. La Biblioteca contendría secciones para los grandes principios: el diseño y la mecánica, también para las prácticas principales: la programación, modelado de sistemas, y la innovación, y a continuación las tecnologías principales. Cada sección ofrecería materiales de clase, tutoriales para principiantes, intermedios, y avanzados; seminarios; resúmenes históricos de la evolución de principios y prácticas; Convendría que esto sea supervisado por unos redactores que se preocuparían de la calidad, la consistencia, y la exactitud de los materiales incluidos. Esto sería la parte de la Biblioteca ACM Digital.&lt;/p&gt;  &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-1187250880387910804?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/1187250880387910804/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/06/en-que-consiste-el-mito-de-que-la_19.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/1187250880387910804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/1187250880387910804'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/06/en-que-consiste-el-mito-de-que-la_19.html' title='¿En que consiste el mito de que la informática es un campo de programadores?'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5676695826944219979.post-5225355078759550225</id><published>2009-06-19T08:35:00.000-07:00</published><updated>2009-09-18T05:11:40.171-07:00</updated><title type='text'>Arte</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_GYXlwI-7STs/SrN49THV1kI/AAAAAAAAAE0/chcpW3RGG0I/s1600-h/DSC_1247.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 213px;" src="http://4.bp.blogspot.com/_GYXlwI-7STs/SrN49THV1kI/AAAAAAAAAE0/chcpW3RGG0I/s320/DSC_1247.JPG" alt="" id="BLOGGER_PHOTO_ID_5382778974136292930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;¿Qué sería la vida sin arte?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5676695826944219979-5225355078759550225?l=marwanalephn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://marwanalephn.blogspot.com/feeds/5225355078759550225/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://marwanalephn.blogspot.com/2009/06/arte.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/5225355078759550225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5676695826944219979/posts/default/5225355078759550225'/><link rel='alternate' type='text/html' href='http://marwanalephn.blogspot.com/2009/06/arte.html' title='Arte'/><author><name>Marouane Ajraoui</name><uri>http://www.blogger.com/profile/07200965916621465395</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_GYXlwI-7STs/SrN49THV1kI/AAAAAAAAAE0/chcpW3RGG0I/s72-c/DSC_1247.JPG' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
