<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>A cup of coffee&#8230; or lime blossom tea is ok too</title>
	<atom:link href="https://rafurunet.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://rafurunet.wordpress.com</link>
	<description>Software Engineering</description>
	<lastBuildDate>Mon, 29 Jun 2020 09:31:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<site xmlns="com-wordpress:feed-additions:1">37309397</site><cloud domain='rafurunet.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://s0.wp.com/i/buttonw-com.png</url>
		<title>A cup of coffee&#8230; or lime blossom tea is ok too</title>
		<link>https://rafurunet.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://rafurunet.wordpress.com/osd.xml" title="A cup of coffee... or lime blossom tea is ok too" />
	<atom:link rel='hub' href='https://rafurunet.wordpress.com/?pushpress=hub'/>
	<item>
		<title>Code Challenge #2</title>
		<link>https://rafurunet.wordpress.com/2019/02/25/code-challenge-2/</link>
					<comments>https://rafurunet.wordpress.com/2019/02/25/code-challenge-2/#respond</comments>
		
		<dc:creator><![CDATA[coffedev]]></dc:creator>
		<pubDate>Tue, 26 Feb 2019 02:59:15 +0000</pubDate>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[code challenges]]></category>
		<category><![CDATA[interviews]]></category>
		<guid isPermaLink="false">http://rafurunet.wordpress.com/?p=2633</guid>

					<description><![CDATA[I can&#8217;t remember the first code challenge I got in my interviews, but there&#8217;s one think I&#8217;m completely sure &#8230; I HATE THEM. Don&#8217;t misunderstand me, I&#8217;m just bad at generating an algorithm in the middle of an interview with 30-40 minutes to examine, analyze, create and code a solution. I like to solve problems &#8230; <a href="https://rafurunet.wordpress.com/2019/02/25/code-challenge-2/" class="more-link">Continue reading <span class="screen-reader-text">Code Challenge #2</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter is-resized"><img data-attachment-id="2640" data-permalink="https://rafurunet.wordpress.com/45263837_2050034671727487_5782287227627241472_o/" data-orig-file="https://rafurunet.wordpress.com/wp-content/uploads/2019/02/45263837_2050034671727487_5782287227627241472_o.jpg" data-orig-size="990,972" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="45263837_2050034671727487_5782287227627241472_o" data-image-description="" data-image-caption="" data-medium-file="https://rafurunet.wordpress.com/wp-content/uploads/2019/02/45263837_2050034671727487_5782287227627241472_o.jpg?w=300" data-large-file="https://rafurunet.wordpress.com/wp-content/uploads/2019/02/45263837_2050034671727487_5782287227627241472_o.jpg?w=990" src="https://rafurunet.wordpress.com/wp-content/uploads/2019/02/45263837_2050034671727487_5782287227627241472_o.jpg" alt="" class="wp-image-2640" width="249" height="244" srcset="https://rafurunet.wordpress.com/wp-content/uploads/2019/02/45263837_2050034671727487_5782287227627241472_o.jpg?w=249&amp;h=244 249w, https://rafurunet.wordpress.com/wp-content/uploads/2019/02/45263837_2050034671727487_5782287227627241472_o.jpg?w=498&amp;h=489 498w, https://rafurunet.wordpress.com/wp-content/uploads/2019/02/45263837_2050034671727487_5782287227627241472_o.jpg?w=150&amp;h=147 150w, https://rafurunet.wordpress.com/wp-content/uploads/2019/02/45263837_2050034671727487_5782287227627241472_o.jpg?w=300&amp;h=295 300w" sizes="(max-width: 249px) 100vw, 249px" /><figcaption>Me IRL<br></figcaption></figure></div>



<p class="wp-block-paragraph">I can&#8217;t  remember the first code challenge I got in my interviews, but there&#8217;s one think I&#8217;m completely sure &#8230;  <strong>I HATE THEM. </strong></p>



<p class="wp-block-paragraph">Don&#8217;t misunderstand me, I&#8217;m just bad at generating an algorithm in the middle of an interview with 30-40 minutes to examine, analyze, create and code a solution.  I like to solve problems trough a code challenge, but for me it takes time. </p>



<p class="wp-block-paragraph">BTE , I&#8217;d like to have a history of what kind of code challenges I got I&#8217;m gonna post the challenge and as soon I have a solution I will post it. </p>



<h3 class="wp-block-heading">The challenge..</h3>



<p class="wp-block-paragraph">This challenge was for a Python position,  basically says :</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Challenge:</p><cite><br> &#8220;Sort the next list in a natural order&#8221; <br> List: <br> filenames = [&#8216;bs1-2.png&#8217;, &#8216;bs1-10.png&#8217;, &#8216;cs1-1.png&#8217;, &#8216;bs1-1.png&#8217;, &#8216;cs1-2.png&#8217;, &#8216;cs1-10.png&#8217;] </cite></blockquote>



<p class="wp-block-paragraph">Natural order means we are expecting to be sorted like this:</p>



<pre class="wp-block-code"><code>&#091;'bs1-1.png', 'bs1-2.png', 'bs1-10.png', 'cs1-1.png', 'cs1-2.png', 'cs1-10.png']</code></pre>



<p class="wp-block-paragraph">So, according to this using <strong>list.sort()</strong> will not give us the expected result.</p>



<p class="wp-block-paragraph">And many people will say this is an actual easy challenge, well, not for me because I&#8217;ve never done this without using a compareTo like method.</p>



<h3 class="wp-block-heading">My approach</h3>



<p class="wp-block-paragraph">Now, since python sort function has a key parameter that acts like the Java compareTo method the documentation is not very clear about what actually the method will receive, and again 20-30 minutes to analyze the problem.</p>



<p class="wp-block-paragraph"><strong>My first approach was to compare every character from every pair of words in a bubble sort -like algorithm, but then this was not viable because you must be sure both words contains the same amount of characters. </strong></p>



<p class="wp-block-paragraph"><strong>Next approach : Ok, so, let&#8217;s assume the ascii table assigns a numeric value for every char, what about getting every numeric value from every character in the word, sum everything and compare with the next word value and sort based on this value. But I was not pretty sure if this was viable.</strong></p>



<h3 class="wp-block-heading">The result..</h3>



<p class="wp-block-paragraph">I didn&#8217;t get the position of course,  but hey, I really did my best trying to find a solution.  Then I googled and found I was not too far from the right answer:</p>



<ul class="wp-block-list"><li>Yes, the key parameter was part of the solution  <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/2611.png" alt="☑" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li></ul>



<ul class="wp-block-list"><li>Getting the numeric value of the word was actually&#8230; part of the solution : <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/2611.png" alt="☑" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li></ul>


<pre><pre class="brush: python; title: ; notranslate">

filenames = ['bs1-2.png', 'bs1-10.png', 'cs1-1.png', 'bs1-1.png', 'cs1-2.png', 'cs1-10.png']

def natural_key(string_):
    return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_)]

filenames.sort(key=natural_key)

print(filenames)

</pre></pre>


<p class="wp-block-paragraph">Update: What&#8217;s going here?</p>



<ul class="wp-block-list"><li>The key function will divide every string using a regex and put into a list every string fragment, and numbers, and then return the list in order to be compared with another element in the string list.</li></ul>



<p class="wp-block-paragraph">So well, I will assume I have a lot of work solving challenges, but actually I did better than expected .</p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafurunet.wordpress.com/2019/02/25/code-challenge-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2633</post-id>
		<media:thumbnail url="https://rafurunet.wordpress.com/wp-content/uploads/2019/02/1_zxixptvl4rzkx3eduj38xw-e1551150310676.jpeg" />
		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2019/02/1_zxixptvl4rzkx3eduj38xw-e1551150310676.jpeg" medium="image">
			<media:title type="html">1_ZXixptvL4rzkx3EDuj38xw</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/e25a379d12cc6e9f28cc426d4b08b8131129a2bf3c32b29be01a802d8a5619ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Rafael Carrillo</media:title>
		</media:content>

		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2019/02/45263837_2050034671727487_5782287227627241472_o.jpg" medium="image" />
	</item>
		<item>
		<title>What a trip!</title>
		<link>https://rafurunet.wordpress.com/2019/01/28/what-a-trip/</link>
					<comments>https://rafurunet.wordpress.com/2019/01/28/what-a-trip/#respond</comments>
		
		<dc:creator><![CDATA[coffedev]]></dc:creator>
		<pubDate>Tue, 29 Jan 2019 05:23:29 +0000</pubDate>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Blog]]></category>
		<guid isPermaLink="false">http://rafurunet.wordpress.com/?p=2615</guid>

					<description><![CDATA[It’s been 4 months since I left my past job as software engineer in a local business company to join to a bigger company with an outsourcing scheme, yes with all the downsides this has. I really wanted to move because I found I was doing the same over and over and my schedule was &#8230; <a href="https://rafurunet.wordpress.com/2019/01/28/what-a-trip/" class="more-link">Continue reading <span class="screen-reader-text">What a trip!</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">It’s been 4 months since I left my past job as software engineer in a local business company to join to a bigger company with an outsourcing scheme, yes with all the downsides this has.</p>



<p class="wp-block-paragraph">I really wanted to move because I found I was doing the same over and over and my schedule was so tough for develop more skills (an 11 hours workday), so when this offer popped up I said “this is my chance”.</p>



<p class="wp-block-paragraph">And well, as soon I started to get interviewed for getting a project I realized how bad my skills were, I lacked a lot of english communication, I mean, the english was there, just I was not too comfident, fortunely a good friend helped me to sort this problem.</p>



<hr class="wp-block-separator is-style-dots" />



<p class="wp-block-paragraph">Next, and a reason why sometimes I feel some depresed is the tech skills.</p>



<p class="wp-block-paragraph">I really love to develop software, from mobile apps, doing tests with API’s and creating new API’s to being part of a huge project like in my past job, and I really thought I was really good with Java.</p>



<p class="wp-block-paragraph">But after my first interview was like a cold water bucket in my head, I really needed a lot of training with new technologies, algorithms, problem solving. This gave me the enough ingredients to have what it’s known as “impostor syndrome”, sometimes I think I’m not just good as I tought.</p>



<p class="wp-block-paragraph">On the positive side, I have learned a lot during this 4 months, new frameworks, a lot from the JDK core, how is built from inside, serverless architecture, and a lot.. I mean A LOT of softskills.</p>



<p class="wp-block-paragraph">I feel like 3 years ago when I was unemployeed, I remember to said “I JUST NEED A CHANCE TO SHOW WHAT CAN I DO!!” , so I’m still looking for a chance (I just hope I don’t get fired before the chance comes up) .</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafurunet.wordpress.com/2019/01/28/what-a-trip/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2615</post-id>
		<media:thumbnail url="https://rafurunet.wordpress.com/wp-content/uploads/2019/01/0.jpg" />
		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2019/01/0.jpg" medium="image" />

		<media:content url="https://2.gravatar.com/avatar/e25a379d12cc6e9f28cc426d4b08b8131129a2bf3c32b29be01a802d8a5619ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Rafael Carrillo</media:title>
		</media:content>
	</item>
		<item>
		<title>[ES] Que ha ocurrido con el sitio?</title>
		<link>https://rafurunet.wordpress.com/2018/11/27/es-que-ha-ocurrido-con-el-sitio/</link>
					<comments>https://rafurunet.wordpress.com/2018/11/27/es-que-ha-ocurrido-con-el-sitio/#respond</comments>
		
		<dc:creator><![CDATA[coffedev]]></dc:creator>
		<pubDate>Wed, 28 Nov 2018 04:32:54 +0000</pubDate>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Spanish]]></category>
		<guid isPermaLink="false">http://rafurunet.wordpress.com/?p=2609</guid>

					<description><![CDATA[Las pocas personas que aun quedan suscritas via feedburner probablemente notaran que a su correo han vuelto a llegar notificaciones de éste sitio.  Este blog nació como una &#8220;libreta de notas&#8221; por ahí del 2012 aproximadamente mientras estaba a la mitad de mis estudios de preparatoria.  Necesitaba un lugar donde plasmar lo que iba entendiendo, &#8230; <a href="https://rafurunet.wordpress.com/2018/11/27/es-que-ha-ocurrido-con-el-sitio/" class="more-link">Continue reading <span class="screen-reader-text">[ES] Que ha ocurrido con el&#160;sitio?</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter is-resized"><img data-attachment-id="2610" data-permalink="https://rafurunet.wordpress.com/17426059_282415098855692_1324910915156545420_n/" data-orig-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/17426059_282415098855692_1324910915156545420_n.jpg" data-orig-size="480,368" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="17426059_282415098855692_1324910915156545420_n" data-image-description="" data-image-caption="" data-medium-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/17426059_282415098855692_1324910915156545420_n.jpg?w=300" data-large-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/17426059_282415098855692_1324910915156545420_n.jpg?w=480" src="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/17426059_282415098855692_1324910915156545420_n.jpg" alt="" class="wp-image-2610" width="179" height="137" srcset="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/17426059_282415098855692_1324910915156545420_n.jpg?w=179&amp;h=137 179w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/17426059_282415098855692_1324910915156545420_n.jpg?w=358&amp;h=274 358w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/17426059_282415098855692_1324910915156545420_n.jpg?w=150&amp;h=115 150w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/17426059_282415098855692_1324910915156545420_n.jpg?w=300&amp;h=230 300w" sizes="(max-width: 179px) 100vw, 179px" /><figcaption>Pic unrelated</figcaption></figure></div>



<p class="wp-block-paragraph">Las pocas personas que aun quedan suscritas via feedburner probablemente notaran que a su correo han vuelto a llegar notificaciones de éste sitio. </p>



<p class="wp-block-paragraph">Este blog nació como una &#8220;libreta de notas&#8221; por ahí del 2012 aproximadamente mientras estaba a la mitad de mis estudios de preparatoria. </p>



<p class="wp-block-paragraph">Necesitaba un lugar donde plasmar lo que iba entendiendo, de esta forma puedo generar una relación mas fuerte del nuevo conocimiento adquirido e incluso formular ejemplos para complementar el post.</p>



<p class="wp-block-paragraph">Desgraciadamente al entrar a la universidad y entrar a trabajo de medio tiempo (y en adelante) no me dio tiempo de continuar con el blog .</p>



<p class="wp-block-paragraph">Actualmente he retomado el blog y le di un pequeño ajuste, limpie (literalmente) todo lo anterior pues la mayoría eran conceptos que ya no son muy validos actualmente o están desactualizados y he empezado a plasmar algunas cosas que he aprendido recientemente.</p>



<p class="wp-block-paragraph">Adicionalmente, el sitio lo estoy escribiendo en ingles a fin de familiarizarme totalmente con términos técnicos en ingles para que me sea mas fácil contestar alguna pregunta o dar una platica en éste idioma, esto sigue a una necesidad de hacerme mucho mas fluido al expresarme y comunicarme en inglés  puesto que quiero romper el &#8220;si se, pero me falta&#8221;. </p>



<p class="wp-block-paragraph">Eventualmente agregare posts como este en español, bajo la categoría spanish, y con el prefijo [ES]. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafurunet.wordpress.com/2018/11/27/es-que-ha-ocurrido-con-el-sitio/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2609</post-id>
		<media:content url="https://2.gravatar.com/avatar/e25a379d12cc6e9f28cc426d4b08b8131129a2bf3c32b29be01a802d8a5619ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Rafael Carrillo</media:title>
		</media:content>

		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/17426059_282415098855692_1324910915156545420_n.jpg" medium="image" />
	</item>
		<item>
		<title>ArrayLists: A complete review &#8211; Part 1/?</title>
		<link>https://rafurunet.wordpress.com/2018/11/27/arraylists-a-complete-review-part-1/</link>
					<comments>https://rafurunet.wordpress.com/2018/11/27/arraylists-a-complete-review-part-1/#respond</comments>
		
		<dc:creator><![CDATA[coffedev]]></dc:creator>
		<pubDate>Tue, 27 Nov 2018 16:29:19 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[What is..]]></category>
		<category><![CDATA[ArrayList]]></category>
		<category><![CDATA[How Array Lists Work]]></category>
		<guid isPermaLink="false">http://rafurunet.wordpress.com/?p=2602</guid>

					<description><![CDATA[As part of my intensive Java training I got asked to review the source code of the common collections in the JDK.  I started by cloning the JDK Mercurial repository and checking the ArrayList implementation, and it&#8217;s a surprise to see there is not black magic in the code, is the same code that you &#8230; <a href="https://rafurunet.wordpress.com/2018/11/27/arraylists-a-complete-review-part-1/" class="more-link">Continue reading <span class="screen-reader-text">ArrayLists: A complete review &#8211; Part&#160;1/?</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter is-resized"><img data-attachment-id="2590" data-permalink="https://rafurunet.wordpress.com/2018/11/05/the-strictfp-modifier-in-java/java-card/" data-orig-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png" data-orig-size="480,240" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="java-card" data-image-description="" data-image-caption="" data-medium-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=300" data-large-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=480" src="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png" alt="" class="wp-image-2590" width="288" height="144" srcset="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=288&amp;h=144 288w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=150&amp;h=75 150w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=300&amp;h=150 300w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png 480w" sizes="(max-width: 288px) 100vw, 288px" /></figure></div>



<p class="wp-block-paragraph">As part of my intensive Java training I got asked to review the source code of the common collections in the JDK. </p>



<p class="wp-block-paragraph">I started by cloning the <a href="http://hg.openjdk.java.net/jdk/jdk">JDK Mercurial repository</a> and checking the ArrayList implementation, and it&#8217;s a surprise to see there is not black magic in the code, is the same code that you or me may create for solving the same problem: create a resizable array with common operations. </p>



<p class="wp-block-paragraph">The arraylist has internally an Object array that stores every object  added through the constructor or the add, addAll operations. The &#8220;black magic&#8221; comes when you find the arrays can&#8217;t be resized, so how the ArrayLists manages to do this. </p>



<p class="wp-block-paragraph">Well, when you call the constructor without a collection to add (the empty constructor) the array is initialized empty. When you use the constructor with a collection will use the Arrays.toArray method to store your collection.</p>



<p class="wp-block-paragraph">Any time you call the add() method java ensures there is enough space , and grows the array +1 by making a new one, copying the elements of the previous array and adding the new one on the new space (see the code below).</p>



<pre class="wp-block-preformatted">private void grow(int minCapacity) {<br>    // overflow-conscious code<br>    int oldCapacity = elementData.length;<br>    int newCapacity = oldCapacity + (oldCapacity &gt;&gt; 1);<br>    if (newCapacity - minCapacity &lt; 0)<br>        newCapacity = minCapacity;<br>    if (newCapacity - MAX_ARRAY_SIZE &gt; 0)<br>        newCapacity = hugeCapacity(minCapacity);<br>    // minCapacity is usually close to size, so this is a win:<br>    elementData = Arrays.copyOf(elementData, newCapacity);<br>}<br></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>The maximum length of the ArrayList is the Integer.MAX_VALUE or 2,147,483,647 elements since the list relies on a standard array.  After reaching this size any subsequent try to add elements will result on an out of memory exception.</p></blockquote>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">I will write about the delete, addAll and the basic methods specified on the List interface and how ArrayLists implements them in the next posts. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafurunet.wordpress.com/2018/11/27/arraylists-a-complete-review-part-1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2602</post-id>
		<media:content url="https://2.gravatar.com/avatar/e25a379d12cc6e9f28cc426d4b08b8131129a2bf3c32b29be01a802d8a5619ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Rafael Carrillo</media:title>
		</media:content>

		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png" medium="image" />
	</item>
		<item>
		<title>Tricky Question: is java passed by reference or passed by value?</title>
		<link>https://rafurunet.wordpress.com/2018/11/23/tricky-question-is-java-passed-by-reference-or-passed-by-value/</link>
					<comments>https://rafurunet.wordpress.com/2018/11/23/tricky-question-is-java-passed-by-reference-or-passed-by-value/#respond</comments>
		
		<dc:creator><![CDATA[coffedev]]></dc:creator>
		<pubDate>Fri, 23 Nov 2018 21:53:37 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[What is..]]></category>
		<guid isPermaLink="false">http://rafurunet.wordpress.com/?p=2599</guid>

					<description><![CDATA[TL;DR When we pass an object (or an object &#8220;reference&#8221;) to a method we are actually passing a copy of the bits in the reference, so is passed by value This is a really really tricky question, since many people thinks that you are actually passing a reference to a method (an object reference of &#8230; <a href="https://rafurunet.wordpress.com/2018/11/23/tricky-question-is-java-passed-by-reference-or-passed-by-value/" class="more-link">Continue reading <span class="screen-reader-text">Tricky Question: is java passed by reference or passed by&#160;value?</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter is-resized"><img loading="lazy" data-attachment-id="2590" data-permalink="https://rafurunet.wordpress.com/2018/11/05/the-strictfp-modifier-in-java/java-card/" data-orig-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png" data-orig-size="480,240" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="java-card" data-image-description="" data-image-caption="" data-medium-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=300" data-large-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=480" src="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png" alt="" class="wp-image-2590" width="360" height="180" srcset="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=360&amp;h=180 360w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=150&amp;h=75 150w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=300&amp;h=150 300w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png 480w" sizes="(max-width: 360px) 100vw, 360px" /></figure></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>TL;DR </p><cite>When we pass an object (or an object &#8220;reference&#8221;) to a method we are actually passing a copy of the bits in the reference, so <strong>is passed by value</strong></cite></blockquote>



<p class="wp-block-paragraph">This is a really really tricky question, since many people thinks that you are actually passing a reference to a method (an object reference of course) and not the object itself.</p>



<p class="wp-block-paragraph">And this is half true</p>



<p class="wp-block-paragraph">We need to define what actually which information holds the object reference, in this case a variable holds the exact bits that tell the JVM how to get the referenced object in the Heap (the java space in memory) .</p>



<p class="wp-block-paragraph">So when we pass an object (or an object &#8220;reference&#8221;) to a method we are actually passing a copy of the bits in the reference, this may look like 3bad086a, and not the reference itself neither the object.&nbsp;</p>



<p class="wp-block-paragraph">So, the next time someone asks you if Java is &#8220;passed by value&#8221; or &#8220;passed by reference&#8221; you know the answer and why is actually passed by value.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafurunet.wordpress.com/2018/11/23/tricky-question-is-java-passed-by-reference-or-passed-by-value/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2599</post-id>
		<media:content url="https://2.gravatar.com/avatar/e25a379d12cc6e9f28cc426d4b08b8131129a2bf3c32b29be01a802d8a5619ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Rafael Carrillo</media:title>
		</media:content>

		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png" medium="image" />
	</item>
		<item>
		<title>A brief summary about Strings in Java</title>
		<link>https://rafurunet.wordpress.com/2018/11/15/a-brief-summary-about-strings-in-java/</link>
					<comments>https://rafurunet.wordpress.com/2018/11/15/a-brief-summary-about-strings-in-java/#respond</comments>
		
		<dc:creator><![CDATA[coffedev]]></dc:creator>
		<pubDate>Fri, 16 Nov 2018 05:52:38 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[What is..]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[String]]></category>
		<guid isPermaLink="false">http://rafurunet.wordpress.com/?p=2592</guid>

					<description><![CDATA[A String in Java, in short words, is an object that stores a sequence of characters, think on a &#8220;char array&#8221;. But doesn&#8217;t have a char array internally. Also in Java, Strings has some interesting qualities: Strings are immutable objects, this means once is created can&#8217;t be modified. Like any other class in java, extends &#8230; <a href="https://rafurunet.wordpress.com/2018/11/15/a-brief-summary-about-strings-in-java/" class="more-link">Continue reading <span class="screen-reader-text">A brief summary about Strings in&#160;Java</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" data-attachment-id="2593" data-permalink="https://rafurunet.wordpress.com/2018/11/15/a-brief-summary-about-strings-in-java/string-pool-java1/" data-orig-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png" data-orig-size="1168,648" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="String-Pool-Java1" data-image-description="" data-image-caption="" data-medium-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=300" data-large-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=1024" class=" size-large wp-image-2593 aligncenter" src="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=2048" alt="String-Pool-Java1" width="580" height="322" srcset="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=580 580w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=1160 1160w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=150 150w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=300 300w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=768 768w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=1024 1024w" sizes="(max-width: 580px) 100vw, 580px" /></p>
<p>A String in Java, in short words, is an object that stores a sequence of characters, think on a &#8220;char array&#8221;. But doesn&#8217;t have a char array internally.</p>
<p>Also in Java, Strings has some interesting qualities:</p>
<ul>
<li>Strings are immutable objects, this means once is created can&#8217;t be modified.</li>
<li>Like any other class in java, extends from the Object class, so Strings contains its numeric representation trough the hashCode() method.</li>
<li>Strings can be directly instanced with quotes (&#8220;&#8221;) and using the &#8220;new&#8221; key word for the constructor.</li>
<li>The main difference between using quotes and the constructor is the String Pool.</li>
<li>The String pool is a reserved area in the JVM heap, which will store Strings for a future recycling, this means, if you declare a string like String a = &#8220;cat&#8221;, and then , String b = &#8220;cat&#8221; . Instead of creating a new String object, Java will check if the string already exists in the pool then will return a reference to the same memory location. But if doesn&#8217;t exists it will create a new string in the pool and return the reference instead.</li>
<li>On the other hand, when you use the new (constructor) for instantiating a String, Java forces the creation of a new String object directly on the heap space.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://rafurunet.wordpress.com/2018/11/15/a-brief-summary-about-strings-in-java/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2592</post-id>
		<media:content url="https://2.gravatar.com/avatar/e25a379d12cc6e9f28cc426d4b08b8131129a2bf3c32b29be01a802d8a5619ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Rafael Carrillo</media:title>
		</media:content>

		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/string-pool-java1.png?w=2048" medium="image">
			<media:title type="html">String-Pool-Java1</media:title>
		</media:content>
	</item>
		<item>
		<title>The strictfp modifier in Java</title>
		<link>https://rafurunet.wordpress.com/2018/11/05/the-strictfp-modifier-in-java/</link>
					<comments>https://rafurunet.wordpress.com/2018/11/05/the-strictfp-modifier-in-java/#respond</comments>
		
		<dc:creator><![CDATA[coffedev]]></dc:creator>
		<pubDate>Mon, 05 Nov 2018 15:08:34 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[What is..]]></category>
		<category><![CDATA[concepts]]></category>
		<guid isPermaLink="false">http://rafurunet.wordpress.com/?p=2587</guid>

					<description><![CDATA[I just learned there are some (not very known) modifiers in the Java language, one in particular is called strictfp. Natively, java uses the IEE754 for the float and double values , but it can extend the the exponent range where available resulting in more precise results. But, when we use the keyword strictfp in &#8230; <a href="https://rafurunet.wordpress.com/2018/11/05/the-strictfp-modifier-in-java/" class="more-link">Continue reading <span class="screen-reader-text">The strictfp modifier in&#160;Java</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" data-attachment-id="2590" data-permalink="https://rafurunet.wordpress.com/2018/11/05/the-strictfp-modifier-in-java/java-card/" data-orig-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png" data-orig-size="480,240" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="java-card" data-image-description="" data-image-caption="" data-medium-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=300" data-large-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=480" class=" size-full wp-image-2590 aligncenter" src="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png" alt="java-card.png" width="480" height="240" srcset="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png 480w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=150&amp;h=75 150w, https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png?w=300&amp;h=150 300w" sizes="(max-width: 480px) 100vw, 480px" /></p>
<p>I just learned there are some (not very known) modifiers in the Java language, one in particular is called <strong>strictfp</strong>.</p>
<p>Natively, java uses the IEE754 for the float and double values , but it can extend the the exponent range where available resulting in more precise results.</p>
<p>But, when we use the keyword <strong>strictfp</strong> in a class or a method, we are forcing the results of floating-point calculations to be IEEE754, ensuring an identical result on every platform.</p>
<p>This keyword can be used on classes or methods just like the next code shows:</p>
<pre>public strictfp class SomeClass {

    ... 
}</pre>
<p>&nbsp;</p>
<pre>public  class SomeClass {

    public strictfp Double someMethod(){
      ...  
    }
}</pre>
<p>&nbsp;</p>
<p>Depending where is used it will be the scope of the IEEE754 FP calculations and using the <strong>strictfp</strong> you may not be able to use some JAVA capabilities for floating point.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafurunet.wordpress.com/2018/11/05/the-strictfp-modifier-in-java/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2587</post-id>
		<media:content url="https://2.gravatar.com/avatar/e25a379d12cc6e9f28cc426d4b08b8131129a2bf3c32b29be01a802d8a5619ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Rafael Carrillo</media:title>
		</media:content>

		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2018/11/java-card.png" medium="image">
			<media:title type="html">java-card.png</media:title>
		</media:content>
	</item>
		<item>
		<title>SOLID as your design principles</title>
		<link>https://rafurunet.wordpress.com/2018/10/31/solid-as-your-design-principles/</link>
					<comments>https://rafurunet.wordpress.com/2018/10/31/solid-as-your-design-principles/#respond</comments>
		
		<dc:creator><![CDATA[coffedev]]></dc:creator>
		<pubDate>Wed, 31 Oct 2018 17:11:02 +0000</pubDate>
				<category><![CDATA[Software Designing]]></category>
		<category><![CDATA[What is..]]></category>
		<category><![CDATA[concepts]]></category>
		<category><![CDATA[good practices]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[SOLID]]></category>
		<guid isPermaLink="false">http://rafurunet.wordpress.com/?p=2584</guid>

					<description><![CDATA[One of the most important concepts that I was asked for in my last job interview was &#8220;what is SOLID?, are you familiar with the SOLID principles?&#8221;  . And this is important because SOLID stands for five principles for object designing, you known, before start coding you should design your solution.. right? &#8230;.. right? ok. &#8230; <a href="https://rafurunet.wordpress.com/2018/10/31/solid-as-your-design-principles/" class="more-link">Continue reading <span class="screen-reader-text">SOLID as your design&#160;principles</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p style="text-align:left;"><img loading="lazy" data-attachment-id="2585" data-permalink="https://rafurunet.wordpress.com/2018/10/31/solid-as-your-design-principles/900px-template_method_uml_class_diagram-svg/" data-orig-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png" data-orig-size="900,360" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="900px-Template_Method_UML_class_diagram.svg" data-image-description="" data-image-caption="" data-medium-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png?w=300" data-large-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png?w=900" class="alignnone size-full wp-image-2585" src="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png" alt="900px-template_method_uml_class_diagram-svg.png" width="900" height="360" srcset="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png 900w, https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png?w=150&amp;h=60 150w, https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png?w=300&amp;h=120 300w, https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png?w=768&amp;h=307 768w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<p>One of the most important concepts that I was asked for in my last job interview was &#8220;what is SOLID?, are you familiar with the SOLID principles?&#8221;  .</p>
<p>And this is important because SOLID stands for five principles for object designing, you known, before start coding you should design your solution.. right? &#8230;.. right? ok.</p>
<p>So what SOLID stands for?</p>
<p><strong>S</strong> : Single responsibility &#8211; Your class must have one single responsibility, if you are creating a class for &#8220;sending a mail&#8221; that is the only task that should do, not validating, not connecting, not applying a template, only to send the mail, the other tasks should be done by other classes.</p>
<p><strong>O</strong> : Open/Close &#8211; When you are designing an application that probably will be need extended in the future, you should be sure that your design is open to extend the functionality but closed to modify it. If you need to modify a core functionality in order to update your application then your design is probably incorrect.</p>
<p><strong>L</strong> : Liskov Substitution &#8211; After te &#8220;O&#8221; principle is when SOLID starts to be interesting. Liskov Substitution states that  subclasses  must be suitable for the parent classes,  in other words, if you are inheriting a parent class and you HAVE to override a method with a &#8220;return null&#8221; or throwing a &#8220;NotImplementedException&#8221;or you completely changed the functionality of the parent method then you are violating the Substitution Liskov .</p>
<p><strong>I</strong> : Interface segregation- This is very similar to Single responsibility but applied to interfaces, interfaces are for the clients not for the application. So you want to segregate your interfaces in particular tasks rather than create a giant interface that makes everything and your client has to create dummy implementations.</p>
<p><strong>D</strong>: Dependency Injection &#8211; This principle is the most important, DI allows to build loose coupled code, because other class doesn&#8217;t know the details of how create an instance another method to start working with it. Instead calling a constructor  a DI manager will inject the instance to the class through the constructor or a setter method.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafurunet.wordpress.com/2018/10/31/solid-as-your-design-principles/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2584</post-id>
		<media:thumbnail url="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png" />
		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/900px-template_method_uml_class_diagram-svg-e1541005694221.png" medium="image">
			<media:title type="html">900px-Template_Method_UML_class_diagram.svg</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/e25a379d12cc6e9f28cc426d4b08b8131129a2bf3c32b29be01a802d8a5619ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Rafael Carrillo</media:title>
		</media:content>
	</item>
		<item>
		<title>What is the difference between Struts 2 and Spring MVC?</title>
		<link>https://rafurunet.wordpress.com/2018/10/25/what-is-the-difference-between-struts-2-and-spring-mvc/</link>
					<comments>https://rafurunet.wordpress.com/2018/10/25/what-is-the-difference-between-struts-2-and-spring-mvc/#respond</comments>
		
		<dc:creator><![CDATA[coffedev]]></dc:creator>
		<pubDate>Fri, 26 Oct 2018 00:13:46 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[What is..]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[Spring framework]]></category>
		<category><![CDATA[spring mvc]]></category>
		<category><![CDATA[struts 2]]></category>
		<category><![CDATA[what is the difference]]></category>
		<guid isPermaLink="false">http://rafurunet.wordpress.com/?p=2577</guid>

					<description><![CDATA[&#160; When you look for a MVC framework you will find there is two main candidates: Struts 2 and Spring Framework. I will not argue which is better, because both are a fit for different situations , not only technical situations. TL;DR , the main difference between Spring MVC and Struts 2 is the way &#8230; <a href="https://rafurunet.wordpress.com/2018/10/25/what-is-the-difference-between-struts-2-and-spring-mvc/" class="more-link">Continue reading <span class="screen-reader-text">What is the difference between Struts 2 and Spring&#160;MVC?</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>
<img width="150" height="50" src="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/struts.png?w=150" class="attachment-thumbnail size-thumbnail" alt="" ids="2578,2579" type="rectangular" link="none" orderby="post__in" include="2578,2579" srcset="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/struts.png?w=150 150w, https://rafurunet.wordpress.com/wp-content/uploads/2018/10/struts.png 256w" sizes="(max-width: 150px) 100vw, 150px" data-attachment-id="2578" data-permalink="https://rafurunet.wordpress.com/2018/10/25/what-is-the-difference-between-struts-2-and-spring-mvc/struts/" data-orig-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/struts.png" data-orig-size="256,86" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Struts" data-image-description="" data-image-caption="" data-medium-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/struts.png?w=256" data-large-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/struts.png?w=256" />
<img width="150" height="150" src="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/core_spring_icon_d632c8b5-d912-4f5e-9b81-16f7308051ca_1024x1024.png?w=150" class="attachment-thumbnail size-thumbnail" alt="" ids="2578,2579" type="rectangular" link="none" orderby="post__in" include="2578,2579" srcset="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/core_spring_icon_d632c8b5-d912-4f5e-9b81-16f7308051ca_1024x1024.png?w=150 150w, https://rafurunet.wordpress.com/wp-content/uploads/2018/10/core_spring_icon_d632c8b5-d912-4f5e-9b81-16f7308051ca_1024x1024.png?w=300 300w" sizes="(max-width: 150px) 100vw, 150px" data-attachment-id="2579" data-permalink="https://rafurunet.wordpress.com/2018/10/25/what-is-the-difference-between-struts-2-and-spring-mvc/core_spring_icon_d632c8b5-d912-4f5e-9b81-16f7308051ca_1024x1024/" data-orig-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/core_spring_icon_d632c8b5-d912-4f5e-9b81-16f7308051ca_1024x1024.png" data-orig-size="1019,1024" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Core_Spring_Icon_d632c8b5-d912-4f5e-9b81-16f7308051ca_1024x1024" data-image-description="" data-image-caption="" data-medium-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/core_spring_icon_d632c8b5-d912-4f5e-9b81-16f7308051ca_1024x1024.png?w=300" data-large-file="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/core_spring_icon_d632c8b5-d912-4f5e-9b81-16f7308051ca_1024x1024.png?w=1019" />
</p>
<p>&nbsp;</p>
<p style="text-align:justify;">When you look for a MVC framework you will find there is two main candidates: Struts 2 and Spring Framework.</p>
<p style="text-align:justify;">I will not argue which is better, because both are a fit for different situations , not only technical situations.</p>
<p style="text-align:justify;">TL;DR , the main difference between Spring MVC and Struts 2 is the way they handle the requests, Spring MVC IS a servlet while struts 2 uses a filter to execute the action, BUT the learning curve of Spring 2 is way shorter than Spring MVC, if you have a very very complex requirement for a short time you can build an elegant and robust solution with Struts 2, if you have experience with spring and your backend already uses spring framework your best choice is Spring MVC.</p>
<h2>Spring MVC</h2>
<p style="text-align:justify;">Spring MVC is part of one of the biggest frameworks available for Java :Spring Framework, relies on IoC (Inversion of Control) and complements the OOP with Aspect Oriented Programming by using the dependency injection.</p>
<p style="text-align:justify;">So this means, when you are using Spring MVC you probably have a backend made with Spring so you can access to the application context and work with the beans that are loaded by injecting them to your MVC Controller.</p>
<p style="text-align:justify;">Finally, Spring MVC is designed around a dispatcher servlet that catch all the incoming requests and dispatches to the handlers, so it&#8217;s a servlet.</p>
<h2>Struts 2</h2>
<p style="text-align:justify;">Struts 2 is a stand alone MVC framework which means  you are not tied to a technology in particular, you can integrate it easily with Hibernate, JSP, Spring, etc. In the &#8220;old days&#8221; you were tied to JSP for the view layer, but now thanks to the plugins you can create a modern singlepage site in integrate it with Struts 2.</p>
<p style="text-align:justify;">Struts 2 uses the Filter from javax to intercept the requests and choose the action required to process it.</p>
<p style="text-align:justify;">The filter (since struts 2.3) is the PrepareAndExecuteFilter that handles the incoming request, for its preparation and execution. So when a new requests is passed by the filter it will search for the required action, then the request is passed to interceptors that will execute tasks like validations, then is passed to the action class to process and generate a result.</p>
<p style="text-align:justify;">The result is passed back by interceptors too and finally the PrepareAndExecuteFilter will deliver the result to the client.</p>
<p style="text-align:justify;">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafurunet.wordpress.com/2018/10/25/what-is-the-difference-between-struts-2-and-spring-mvc/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2577</post-id>
		<media:content url="https://2.gravatar.com/avatar/e25a379d12cc6e9f28cc426d4b08b8131129a2bf3c32b29be01a802d8a5619ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Rafael Carrillo</media:title>
		</media:content>

		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/struts.png?w=150" medium="image" />

		<media:content url="https://rafurunet.wordpress.com/wp-content/uploads/2018/10/core_spring_icon_d632c8b5-d912-4f5e-9b81-16f7308051ca_1024x1024.png?w=150" medium="image" />
	</item>
	</channel>
</rss>
