<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by EVELYN CUSI LOPEZ on Medium]]></title>
        <description><![CDATA[Stories by EVELYN CUSI LOPEZ on Medium]]></description>
        <link>https://medium.com/@cusi-evelyn?source=rss-3547739dce3a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*ZIt8XKOOxu2xjPTZ2kcuyA.jpeg</url>
            <title>Stories by EVELYN CUSI LOPEZ on Medium</title>
            <link>https://medium.com/@cusi-evelyn?source=rss-3547739dce3a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:59:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cusi-evelyn/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Clasificación de idiomas originarios de Bolivia]]></title>
            <link>https://medium.com/saturdays-ai/clasificaci%C3%B3n-de-idiomas-originarios-de-bolivia-91cb0c0b7b48?source=rss-3547739dce3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/91cb0c0b7b48</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[tf-idf]]></category>
            <dc:creator><![CDATA[EVELYN CUSI LOPEZ]]></dc:creator>
            <pubDate>Mon, 13 Sep 2021 05:11:26 GMT</pubDate>
            <atom:updated>2021-09-13T05:11:26.084Z</atom:updated>
            <content:encoded><![CDATA[<p>Autores:<em> Cota V. Andreina, Cusi L. Evelyn, Nina M. Juan Dilan</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i7_P1YJu3KGxkLEChWCpDA.jpeg" /><figcaption>Fuente: <a href="https://www.unicef.org/bolivia/informes/%C2%A1retornando-clases">UNICEF</a></figcaption></figure><p>Bolivia lucha para que no desaparezcan los idiomas indígenas, sin embargo, es aún muy complicado acceder a recursos que ayuden la asimilación y aprendizaje de los mismos. Es por ello que planteamos crear una herramienta de clasificación de idiomas, que si bien es una tarea sencilla es elemental para realizar tareas más complejas como la traducción automática, el análisis de sentimientos, conversión de habla a texto, texto a habla, etc. Este modelo de clasificación se creó usando herramientas de NLP (procesamiento de lenguaje natural) y ML (aprendizaje automático), obteniendo una precisión superior al 99%.</p><h3>1. Introducción</h3><p>Desde 2006 Bolivia es líder en la defensa y reivindicación de los pueblos y las culturas indígenas en su territorio y en el mundo.</p><blockquote>“Hoy en día, las 36 lenguas originarias en Bolivia son idiomas oficiales. En Bolivia se tiene que hablar y enseñar inicialmente un idioma originario&quot; [1].</blockquote><p>Pero todo esté trabajo ¿realmente tiene resultados positivos en la asimilación y aprendizaje de las lenguas originarias en Bolivia?.</p><h3>2. Descripción del problema</h3><p>Si bien en nuestro país se lucha porque no desaparezcan estos idiomas indígenas es aún muy complicado acceder a recursos que ayuden la asimilación y aprendizaje de los mismos. <br>Sin embargo, actualmente se puede usar la tecnología como un aliado para solucionar este problema y la detección de idiomas es un punto inicial y primordial para crear herramientas de traducción automática de texto, de conversión de texto a voz, voz a texto, voz a voz, entre muchas otras aplicaciones.</p><h3>3. Objetivo</h3><p>Crear una herramienta capaz de identificar idiomas originarios de Bolivia, para agilizar tareas relacionadas como la traducción, recuperación de la información, etc.</p><h3>4. Límites y alcances</h3><p><strong>LÍMITES</strong>: Debido a la dificultad de conseguir un conjunto de datos suficientemente grande de los idiomas más hablados en Bolivia (quechua, guaraní, aymara), solo nos centramos en el idioma quechua.</p><p><strong>ALCANCES</strong>: La herramienta de identificación, en una primera etapa, será capaz de clasificar el idioma de frases ya sea como quechua o español.</p><h3>5. Metodología</h3><p>Se utilizó una metodología iterativa incremental, que conlleva las siguientes fases:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*696EDTvNPvMv7Eia" /><figcaption>Figura 1. Metodología (Dataiku)</figcaption></figure><h3>6. Captura de datos</h3><p>Dado que no se contaba con un dataset de frases en Quechua, creamos un dataset a partir de textos obtenidos de documentos de la web. Estos documentos en su mayoría tenían extensión .pdf y otras eran imágenes lo que dificulto la extracción de texto automática y por esa razón tuvimos que tabular los datos manualmente.</p><p>Posterior a la creación del dataset nos dimos cuenta que éste estaba desbalanceado porque el número de frases en quechua duplicaban el de español, por esa razón decidimos balancear los datos agregando frases de español obtenidos de un dataset de Kaggle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/0*HsYW7myZWhHlyZKx" /><figcaption>Figura 2. Captura de datos (Imagen extraída de un <a href="https://www.gettyimages.in/photos/drawing-activity">sitio web</a>)</figcaption></figure><h3>7. Pre-procesamiento</h3><p>En esta etapa se realizaron diversas formas de pre-procesamiento, desde la ingeniería de características (feature engineering) hasta la vectorización. Las cuales se describen a continuación.</p><p><strong>Limpieza de caracteres irrelevantes</strong></p><p>Las frases en español de Kaggle tenían caracteres de otros idiomas e irrelevantes para la clasificación, es por ello que antes de unir con el dataset que se tenía se pasó a realizar una limpieza de todos esos caracteres de las frases de Kaggle. Una vez unido el dataset aún se tenían caracteres que no aportaban información como: dígitos, signos de puntuación, etc. y por tanto se realizó una limpieza de estos caracteres.</p><p><strong>Técnicas implementadas</strong></p><p>En base a la información del dataset se pudo notar que había un dato mal tabulado y se realizó la imputación de datos por valores nulos. Por otro lado, como el dataset cuenta con solo un feature y el target, no se tuvo la necesidad de reducir las dimensiones.</p><p><strong>Análisis de los features</strong></p><p>Cada idioma tiene sus propias reglas gramaticales y el idioma Quechua no es ajeno a eso, por ende se investigó las reglas de este idioma y se pudo notar ciertas características interesantes que lo diferencian de otros idiomas, por mencionar algunas:</p><ol><li>El alfabeto quechua cuenta con 28 consonantes (algunas consonantes son diferentes al de español como: ch’, chh, qh, p’) y 3 vocales (a, i, u)</li><li>Las consonantes del quechua se clasifican según el modo de articulación, algunas de ellas son:</li></ol><ul><li><em>Consonantes oclusivas (p, t, k, q)</em></li><li><em>Consonantes aspiradas (ph, th, chh, kh, qh)</em></li><li><em>Consonantes glotalizadas (p’, t’, ch’, k’, q’)</em></li><li><em>Semiconsonantes (w, y)</em></li></ul><p>3. Para diferenciar el género de una persona se usan las palabras: warmi y qhari</p><p>4. La interrogación en el quechua se realiza agregando a la palabra el sufijo -chu.</p><p>Estas y muchas más características de la gramática Quechua, así como la gramática del Español fueron tomadas en cuenta para realizar las gráficas, las cuales nos permiten corroborar estas diferencias entre las reglas gramaticales en el dataset.</p><p>Uno de los gráficos que realizamos fue la frecuencia de las vocales por idioma en el dataset (Figura 3). La frecuencia de las vocales fueron calculadas según el número de caracteres de cada frase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xZNuNetR6JTWzY5m" /><figcaption>Figura 3. Frecuencia de vocales (Elaboración propia)</figcaption></figure><p>Otras gráficas que realizamos fueron la frecuencia de las consonantes como: <strong>K, H, M, R</strong> (Figura 4) y caracteres especiales como: <strong>á, é, í, ó, ú, ä, ü, ‘ </strong>(Figura 4), según el idioma.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ahpyhYwi3NBn-ms2" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4TBiiLFwXqPBGOO6" /><figcaption>Figura 4. Histograma de caracteres (Elaboración propia)</figcaption></figure><p>Estas gráficas nos permitieron aclarar algunas dudas sobre las diferencias gramaticales entre el idioma Español y Quechua, y representaron un punto clave para realizar el pre-procesamiento de los datos.</p><p>Por las diferencias de algunas letras y caracteres utilizados para cada idioma, además de ciertos sufijos o prefijos propios, numeración y demás características, decidimos vectorizar las frases según el modelo n-gram de caracteres. Para capturar características importantes en ambos idiomas delimitamos el modelo n-gram de 1 a 5, esto por temas de rendimiento y también porque consideramos que este número nos permite abstraer aquellas características gramaticales que citamos anteriormente.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CvCnIe1Eq5B4mOqT" /><figcaption>Figura 5: Pre-procesamiento y vectorización de los features (Elaboración propia)</figcaption></figure><p>Además de vectorizar las frases según la frecuencia de caracteres únicos que tiene cada frase se aplicó la frecuencia TF-IDF, medida estadística que evalúa cuán relevante es un término para un documento en una colección. En este caso cada término es representado por cada carácter y el documento es representado por la frase del idioma en el dataset (colección de frases).</p><h3>8. Selección y evaluación de modelos</h3><p>Con los datos listos se procedió a construir los modelos de predicción. Se utilizaron modelos de clasificación debido a que tenemos un problema de clasificación binaria, sólo se tienen dos posibles etiquetas, <strong>“Quechua” y “Español”.</strong></p><p>Por lo tanto, se utilizaron los siguientes algoritmos de aprendizaje supervisado:</p><ul><li>Naive Bayes</li><li>Support vector Machine</li><li>Logistic regression</li></ul><p>Para encontrar la mejor combinación de hiperparámetros se utilizo GridSearch de la biblioteca Sklearn.</p><p>Las matrices de confusión para los 3 modelos son:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*i2fZODpgoJv8NJaE" /><figcaption>Figura 6. Matrices de confusión, balanced accuracy y tiempo de ejecución de los 3 modelos (Elaboración propia)</figcaption></figure><h3>9. Clasificación de nuevos datos</h3><p>Una vez seleccionado nuestro mejor modelo, es necesario probarlo con algunas frases nunca antes vistas, por ello probamos frases que solo contienen palabras de un idioma, frases que contienen palabras de ambos idiomas que es usual en el habla coloquial de los quechua hablantes y por último una frase sin sentido. Nuestro modelo seleccionado se comporta bien con los dos primeros tipos de frases, sin embargo, al ingresar frases sin sentido que no pertenece ni al español o al quechua, estas frases son clasificadas directamente como quechua, esto se debe a que como manejamos un modelo binario el texto ingresado sea cual sea debe etiquetarlos con una etiqueta u otra.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hU0Qcc4QoNlbeFx4" /><figcaption>Figura 7. Resultados del modelos (Elaboración propia)</figcaption></figure><h3>10. Conclusión</h3><p>En general, el modelo de clasificación basado en Support Vector Machine ofrece el mejor resultado predictivo con una puntuación de precisión balanceada superior al 99%.</p><p>Específicamente, el modelo funciona bien para clasificar Español y Quechua dada la alta precisión, y puntajes f1 para estos dos idiomas.</p><p>Si bien la mejor precisión se obtuvo con SVM, considerando las variables precisión y rendimiento el mejor modelo sería el basado en Regresión Logística, ya que ofrece un tiempo de ejecución menor al de SVM y tiene una precisión superior al 99%, lo cual es un factor importante en aplicaciones en real time.</p><p>Se logró abstraer algunas características del idioma quechua, por lo que es posible realizar el mismo análisis con otros idiomas originarios de Bolivia</p><h3>11. Trabajos futuros</h3><p>Si bien este problema aparenta ser sencillo es un paso necesario para:</p><ul><li>Traducción automática</li><li>Detección de idioma para el uso de boots</li><li>Análisis de sentimientos, etc.</li></ul><p>El codigo fuente de este proyecto se puede encontrar en: <a href="https://github.com/andreina-covi/DataNLP">github</a></p><h3>12. Referencias</h3><p><a href="https://news.un.org/es/story/2019/06/1457591#:~:text=%E2%80%9CHoy%20en%20d%C3%ADa%2C%20las%2036,inicialmente%20en%20la%20lengua%20originaria.%E2%80%9D&amp;text=En%20cambio%2C%20sus%20nietas%20s%C3%AD,les%20ense%C3%B1a%20en%20la%20escuela.">ONU - Bolivia, a la vanguardia en la protección y promoción de las lenguas indígenas</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91cb0c0b7b48" width="1" height="1" alt=""><hr><p><a href="https://medium.com/saturdays-ai/clasificaci%C3%B3n-de-idiomas-originarios-de-bolivia-91cb0c0b7b48">Clasificación de idiomas originarios de Bolivia</a> was originally published in <a href="https://medium.com/saturdays-ai">Saturdays.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[New refactorings for Pharo 9]]></title>
            <link>https://cusi-evelyn.medium.com/introduced-refactorings-in-pharo-9-9c7274b68b22?source=rss-3547739dce3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c7274b68b22</guid>
            <dc:creator><![CDATA[EVELYN CUSI LOPEZ]]></dc:creator>
            <pubDate>Mon, 03 May 2021 12:35:39 GMT</pubDate>
            <atom:updated>2021-05-03T13:21:12.204Z</atom:updated>
            <content:encoded><![CDATA[<p>These months I was working fixing and introducing new refactorings.</p><p>Below is a list of the new refactorings introduced:</p><h3>1. Extract setUp method</h3><p>I’m a refactoring for creating a setUp method from a code fragment.</p><p>You can select an interval of some code in a test method and call this refactoring to create a setUp method implementing that code and replace the code with nothing.</p><p>The selected class needs to be a subclass of TestCase.</p><p>The preconditions are quite complex.</p><p>- The code needs to be parseable valid code.</p><p>- The class must not implement the setUp method.</p><p>- Class must inherit from TestCase class</p><h4>Example</h4><p>Before refactoring:</p><pre>TestCase subclass: #RBDataTest</pre><pre>instanceVariableNames: ‘’</pre><pre>classVariableNames: ‘’</pre><pre>package: ‘Example’.</pre><pre>RBDataTest &gt;&gt; someMethod</pre><pre>#someMethod.</pre><pre>RBDataTest &gt;&gt; testExample</pre><pre>self someMethod.</pre><pre>self assert: true.</pre><p>After refactoring:</p><pre>RBDataTest &gt;&gt; setUp</pre><pre>super setUp.</pre><pre>self someMethod.</pre><pre>RBDataTest &gt;&gt; testExample</pre><pre>self assert: true.</pre><blockquote><strong>Video</strong>: <a href="https://youtu.be/feKsdci0dL4">https://youtu.be/feKsdci0dL4</a></blockquote><h3>2. Remove senders of method refactoring</h3><p>I am a refactoring to remove all possible senders from a method (you cannot remove those calls where the result of the method call is used or when the method name symbol is referenced).</p><h4>Example</h4><p>Remove all senders of printString</p><p>Before refactoring:</p><pre>RBRefactoryTestDataApp &gt;&gt; caller1</pre><pre>| anObject |</pre><pre>anObject := 5.</pre><pre>self called: anObject + 1</pre><pre>on1:</pre><pre>[:each |</pre><pre>each printString.</pre><pre>^anObject]</pre><p>After refactoring (notice that the call to printstring was removed):</p><pre>RBRefactoryTestDataApp &gt;&gt; caller1</pre><pre> | anObject |</pre><pre>anObject := 5.</pre><pre>self called: anObject + 1 on1: [:each |^anObject]</pre><blockquote><strong>Video</strong>: <a href="https://youtu.be/nMJiyy8US8U">https://youtu.be/nMJiyy8US8U</a></blockquote><h3>3. Copy package as refactoring</h3><p>I am a refactoring to copy a package.</p><p>My preconditions verify, that the copied package exists (in the current environment) and that the new copy package name is valid and not yet used as a global variable name</p><p>The refactoring transformation create a new package and copy defined classes of origin package (exclude all class’ extensions)</p><p><strong>Example</strong></p><p>The following package has these classes,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*CnUFKu4zSbPwqwPd" /><figcaption>Image: Package content</figcaption></figure><p>and these classes has these references between them:</p><pre>MyClassA &gt;&gt; foo</pre><pre>^ MyClassB</pre><pre>MyClassB &gt;&gt; example4</pre><pre>#MyClassA1</pre><p>After copy #Example package we obtain this result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*2d-dEgCQCIB49mXe" /><figcaption>Image: Contents copied package</figcaption></figure><p>and references were updated</p><pre>MyClassACopy &gt;&gt; foo</pre><pre>^ MyClassBCopy</pre><pre>MyClassBCopy &gt;&gt; example4</pre><pre>#MyClassA1Copy</pre><p>It can also be noted that the hierarchy was correctly updated with the copied classes.</p><h3>4. Rename package (rename manifest)</h3><p>I’m a refactoring to rename a package.</p><p>My preconditions verify that the new name is different from the current package name and is a valid name.</p><p>I change all the references of the classes that are defined within the package, and if there is a manifest, it is updated with the new name of the package.</p><blockquote><strong>Video</strong>: <a href="https://youtu.be/94qlZmmIMwY">https://youtu.be/94qlZmmIMwY</a></blockquote><h3>5. Merge instance var into another</h3><p>I am a refactoring for merge an instance variable into another.</p><p>I replace an instance variable by another, in all methods referring to this variable and rename the old accessors, then if the instance variable renamed is directly defined in class it is removed.</p><p>My precondition verifies that the new variable is a defined instance variable in class.</p><p><strong>Example</strong></p><p>Before refactoring:</p><pre>Class Foo -&gt; inst vars: x, y</pre><pre>Foo &gt;&gt; foobar</pre><pre>^ x</pre><pre>Foo &gt;&gt; foo</pre><pre>^ x + y</pre><p>After refactoring merging X into Y</p><pre>Class Foo -&gt; inst vars: y</pre><pre>Foo &gt;&gt; foobar</pre><pre>^ y</pre><pre>Foo &gt;&gt; foo</pre><pre>^ y + y</pre><blockquote><strong>Video</strong>: <a href="https://youtu.be/sntrzsHCW9A">https://youtu.be/sntrzsHCW9A</a></blockquote><h3>6. Move to class side method</h3><p>I’m a refactoring to move a method to the class side.</p><p>My preconditions verify that the method exists and belongs to instance side.</p><p>I catch broken references (method senders and direct access to instVar) and fix them.</p><p><strong>Example</strong></p><p>Before refactoring (move #rewriteUsing: to class side):</p><pre>RBTransformationRuleTestData &gt;&gt; rewriteUsing: searchReplacer</pre><pre>rewriteRule := searchReplacer.</pre><pre>self resetResult.</pre><p>After refactoring:</p><pre>RBTransformationRuleTestData &gt;&gt; rewriteUsing: searchReplacer</pre><pre>^ self class rewriteUsing: searchReplace.</pre><pre>RBTransformationRuleTestData class &gt;&gt; rewriteUsing: searchReplacer</pre><pre>| aRBTransformationRuleTestData |</pre><pre>aRBTransformationRuleTestData := self new.</pre><pre>aRBTransformationRuleTestData rewriteRule: searchReplacer.</pre><pre>aRBTransformationRuleTestData resetResult.</pre><h3>7. Create accessors with lazy initialization</h3><p>I’m a refactoring for creating accessors with lazy initialization for variables.</p><p>I am used by a couple of other refactorings creating new variables and accessors.</p><p>My precondition is that the variable name is defined for this class.</p><h4>Example</h4><p>Before refactoring:</p><pre>Object subclass: #RBLintRuleTestData</pre><pre>instanceVariableNames: ‘name foo1’</pre><pre>classVariableNames: ‘Foo1 Name1’</pre><pre>poolDictionaries: ‘TextConstants’</pre><pre>package: ‘Refactoring-Tests-Core-Data’</pre><p>After refactoring we get:</p><pre>RBLintRuleTestData &gt;&gt; foo1</pre><pre>^ foo1 ifNil: [foo1 := 123]</pre><pre>RBLintRuleTestData &gt;&gt; foo1: anObject</pre><pre>foo1 := anObject</pre><blockquote><strong>Video Example</strong>: <a href="https://youtu.be/SO0G6f1Y0fk">https://youtu.be/SO0G6f1Y0fk</a></blockquote><p>That’s all for this post, goodbye and happy coding :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c7274b68b22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding shortcuts and new submenu for refactorings]]></title>
            <link>https://cusi-evelyn.medium.com/adding-shortcuts-and-new-submenu-for-refactorings-ab3e71ac8fa2?source=rss-3547739dce3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab3e71ac8fa2</guid>
            <category><![CDATA[gsoc-2019]]></category>
            <category><![CDATA[shortcuts]]></category>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[pharo]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[EVELYN CUSI LOPEZ]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 18:19:18 GMT</pubDate>
            <atom:updated>2019-07-23T18:19:18.797Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post I will show some small improvements that I made on the refactoring access commands.</p><p>The decision to add submenus was based on an <a href="https://github.com/pharo-project/pharo/issues/3737">Issue</a> of the <a href="http://pharo.org/">Pharo</a> project, so a new group of commands was added specifically for refactorings, both for methods and for classes.</p><p>The changes made in each menu are detailed below.</p><h4>Submenu for classes</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*sOkiC6gJPrMfQfbRE8cU1Q.png" /><figcaption>Image 1 — New submenu for class refactoring</figcaption></figure><p>The menu for the classes was modified as shown in Image 1, icons were added in each of the options and also the shortcut (Ctrl + GA). It was added for the generation of accessors of a class which I was missing a lot from Pharo 7 .</p><h4>Menu for variables</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*3W6o65HVk6945_KqRtHngg.png" /><figcaption>Image 2 — Menu for variables</figcaption></figure><p>This menu was modified a little, since it did not have many options, so adding a submenu would only make access to refactoring of the variables more difficult. The only thing that was added was icons in the menu options.</p><h4>Submenu for methods</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*H42Rg5_nA5BsxcM-hUKTZQ.png" /><figcaption>Image 3— Submenu for method refactoring</figcaption></figure><p>In this menu (Image 3) as in the previous ones, icons were added for each refactoring option, on the other hand the Refactor submenu and some shortcuts for the Pull up (Ctrl + PU) and Push down (Ctrl + PD) refactorings were added, making access to these easier for developers.</p><p>Below is a video of how to access each of these menus</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFnaw4NqbjI4%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFnaw4NqbjI4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFnaw4NqbjI4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/654ba2f836b9a6770584943005ba4eb5/href">https://medium.com/media/654ba2f836b9a6770584943005ba4eb5/href</a></iframe><p>This is only the first stage of the modification of refactoring commands, so if you have suggestions of new shortcuts that are necessary, do not hesitate to leave a comment.</p><p>That’s all for this post, goodbye and happy coding :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab3e71ac8fa2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[New previews for Pull up and Push down refactoring]]></title>
            <link>https://cusi-evelyn.medium.com/new-previews-for-pull-up-and-push-down-refactoring-7d62d8f00fb8?source=rss-3547739dce3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d62d8f00fb8</guid>
            <category><![CDATA[pharo]]></category>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[preview]]></category>
            <category><![CDATA[smalltalk]]></category>
            <category><![CDATA[gsoc-2019]]></category>
            <dc:creator><![CDATA[EVELYN CUSI LOPEZ]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 18:17:26 GMT</pubDate>
            <atom:updated>2019-07-23T18:17:26.509Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post I will show you a small progress made during the second stage of <a href="https://summerofcode.withgoogle.com/">GSoC</a> for <a href="http://pharo.org/">Pharo</a>, of the project: <em>“</em><a href="https://summerofcode.withgoogle.com/projects/#6148169409232896"><em>Better and more refactorings for Pharo</em></a><em>”</em></p><p>In a previous post I explained different refactorings that exist in Pharo and although many of them work wonderfully they have limitations, in many cases access to them is usually tedious and not very intuitive, so based on previews of other programming languages’ IDEs this stage I worked on improving the previews of both Pull up and Push down refactorings.</p><h3>Push down</h3><p>In the previous version of this refactoring, it could only be accessed in one way: by selecting the methods and pressing on the push up command. However, if you want to raise the hierarchy of more than one method and these didn’t have consecutive order, it would not possible to do it directly, because you cannot select non-consecutive methods in Pharo, which makes it tedious to select method one by one to do Push down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*QjXuqn5yhJ22S5jt-X4hcA.png" /><figcaption>Image 1 — New preview for Push down refactoring</figcaption></figure><p>That is why a new preview was added for this refactoring, which makes the selection of methods simpler, thus making it easier to use this refactoring for Pharo developers.</p><h4>How to use the new push down refactoring preview?</h4><p>The use of this preview (Image 1) is quite intuitive, you just have to select methods that you want to push down (which as you can see no longer need to be consecutive) and press on the Refactor button. Below I show a video of how to use the new preview to push down on Pharo:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FF_JjZfZzCqY%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DF_JjZfZzCqY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FF_JjZfZzCqY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a7a52904497af20dd2919d6ba2e927a/href">https://medium.com/media/2a7a52904497af20dd2919d6ba2e927a/href</a></iframe><h3>Pull up</h3><p>This refactoring presents the same problems as the previous one, however it presentes another inconvenience, which is that you could only go up one level in the inheritance hierarchy, it means, if you want to go up more than one level in the inheritance hierarchy you should do it one by one until you reach the desired class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*VF_Y3iWrhvQycvZunA3UxQ.png" /><figcaption>Image 2— New preview for Pull up refactoring</figcaption></figure><p>To overcome these problems, some minor modifications were made on how the refactoring worked and a new preview (Image 2)was added as in the previous case, this view is based on IntelliJ IDEA.</p><h4>How to use the new pull up refactoring preview?</h4><p>This view is the same as the previous one, with a single difference, it presents a selection list to be able to select to which level of the hierarchy you want to pull up your methods (in this case the Object and ProtoObject objects were omitted in the list, because the process is too long when you try to pull up on them. Below is a video of how to use this new preview:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FnZiLNx4Y6tA%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnZiLNx4Y6tA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FnZiLNx4Y6tA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/29bac37e48f1b2612ff639561d442b73/href">https://medium.com/media/29bac37e48f1b2612ff639561d442b73/href</a></iframe><p>That’s all for this post, any suggestion or comment is welcome.</p><p>Goodbye and happy coding :D</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d62d8f00fb8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better and more refactorings for Pharo — Part 3]]></title>
            <link>https://cusi-evelyn.medium.com/better-and-more-refactorings-for-pharo-part-3-e1bdebb33f45?source=rss-3547739dce3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1bdebb33f45</guid>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[gsoc-2019]]></category>
            <category><![CDATA[pharo]]></category>
            <dc:creator><![CDATA[EVELYN CUSI LOPEZ]]></dc:creator>
            <pubDate>Wed, 26 Jun 2019 17:16:32 GMT</pubDate>
            <atom:updated>2019-06-26T17:16:32.590Z</atom:updated>
            <content:encoded><![CDATA[<h3>Better and more refactorings for Pharo — Part 3</h3><p>This is a post summary of my first month in the GSoC program. Then let’s get started…</p><p>In the first stage, I mainly did 3 things: understand how Pharo’s refactorings work internally, learn tools and finally make the first advances of my proposal. Below I will detail each of these.</p><h3>Understanding how refactorings work</h3><p>Refactorings in Pharo work on their own code meta-model.</p><p>To execute a refactoring there are two ways: primitiveExecute and execute.</p><ul><li><strong>PrimitiveExecute: </strong>It consists of validating the preconditions of the refactoring (it should be noted that each refactoring has its own preconditions and these are generally defined by the RBCondition class) and then perform the necessary code transformation, however the changes made by the transformation are not yet implemented in the image of Pharo, that is, your image continues as it was before executing this method, below the <em>primitiveExecute</em> method is shown.</li></ul><pre><strong>primitiveExecute</strong><br>    self checkPreconditions.<br>    self transform</pre><p>You can access the changes of the refactoring using the changes method. Generally this method is used in the execution of tests and in suggestions of the menu, since the latter shows you a preview of the changes in the refactoring, in which you can decide which ones to accept and which ones do not..</p><ul><li><strong>Execute: </strong>In the following fragment of code you can see the execute method, which is practically the execution of primitiveExecute with the difference that directly implements the changes, that is, it does not give you a preview of the changes and they are applied atomically.</li></ul><pre><strong>execute</strong><br>    self primitiveExecute.<br>    RBRefactoryChangeManager instance performChange: self changes.</pre><p>This method is used in the source code of the menu, with some exceptions.</p><p>Personally, it was difficult for me to understand it and it was in the part that cost me the most, but after reviewing the whole code I was amazed, because there are a lot of refactorings that I did not know existed, since they go beyond of the refactorings to which can be accessed through the commands (menus, shortcuts).</p><p>For example, the <strong>RBExtractMethodToComponentRefactoring</strong> class can extract methods even over other classes, for example:</p><p>Having this code fragment:</p><pre><strong>RBReadBeforeWrittenTester</strong> &gt;&gt;&gt; <strong>copyDictionary:</strong> aDictionary <br>    “We could send aDictionary the copy message, but that doesn’t copy the associations.”</pre><pre>    | newDictionary |<br>    newDictionary := Dictionary new: aDictionary size.<br>    aDictionary keysAndValuesDo: [ :key :value | newDictionary at: key put: value ].<br>    ^ newDictionary</pre><p>we can get this:</p><pre><strong>RBReadBeforeWrittenTester</strong> &gt;&gt;&gt; <strong>copyDictionary:</strong> aDictionary <br>    ^aDictionary copyWithAssociations</pre><pre><strong>Dictionary</strong> &gt;&gt;&gt; <strong>copyWithAssociations</strong> <br>    | newDictionary |<br>    newDictionary := Dictionary new: self size.<br>    self<br>    keysAndValuesDo: [:key :value | newDictionary at: key put: value].<br>    ^newDictionary</pre><p>In the same way there is a refactoring (<strong>RBSplitCascadeRefactoring</strong>) that divides a message in cascade into several messages, for example given the following code fragment:</p><pre><strong>methodWithCascades</strong><br>    | a |<br>    a := Object new initialize; asString.<br>    ^ a</pre><p>we get:</p><pre><strong>methodWithCascades</strong><br>    | a receiver |<br>    receiver := Object new.<br>    receiver initialize.<br>    a := receiver asString.<br>    ^ a</pre><p>These are just a small fragment of everything that Pharo has, if you really like this topic I recommend you review it and I assure you that just like me, you will be fascinated.</p><h3>Learn, learn and learn ..<strong>.</strong></h3><p>Then according to the suggestion of my mentors, review Spec2 and Commander2 this because Pharo 8 is in the process of migrating from Spec (is a framework in Pharo for describing user interfaces) to Spec2 all the views and from Commander (it is a tool that serves to menu management) to <a href="https://github.com/pharo-spec/Commander2">Commander2</a>.</p><p>Refactoring has few views, and I focused on collaborating by giving ideas with the <a href="https://github.com/CafeKrem/stage">Stage</a> project (in which Pharo’s views from Spec to Spec2 were migrating) specifically in the refactoring views, resulting in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*osSw5SfHGWPE6nxNCvfQbw.png" /><figcaption>Figure 1: Update of previews</figcaption></figure><p>However, these views are not yet integrated to Pharo, but soon they will be :D.</p><p>When I checked Commander2 I had the inconvenience that it does not have an adapter for Morphic yet, so I could not migrate the refactoring commands to Commander2.</p><p>Additionally my mentors suggested me to review MatchTool, which is a tool that allows you to test and explore RB matching expressions, it’s really interesting, do not even check it thoroughly but if you’re interested you can review it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQtZzDZJioNqpuzFeKLaZg.png" /><figcaption>Figure 2: Preview MatchTool</figcaption></figure><p>I really did not know that I would review so many new tools in the realization of this project, sometimes you find things difficult to grasp the first, however you have to lose the fear of asking, so you can move faster and really the Pharo community is very helpful and I assure you that there will always be someone who is willing to help you in any doubt ;)</p><h3>First advances of my proposal</h3><p>Before I started describing what I did, I must explain to them why this happened, in my initial proposal I had to implement the inline methods the first month, however these were already implemented, so I decided to advance tasks that I had in my timeline, so I decided perform the renaming of parameters when extracting a method, and at the suggestion of my mentors I made a prototype of the creation of an interactive layer.</p><ul><li><strong>Rename parameters: </strong>The first thing I did was modify the preview (SycMethodNameEditor2 of the Stage project) where the new name of the extracted method is defined, adding an editable text field when selecting a parameter.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W2xz7QW0hdkLRdHz0JBs9g.png" /><figcaption>Figure 3: Preview of extract method with option to rename parameters</figcaption></figure><p>Then add validators to accept the new name of the parameter, and finally add a method for the renaming of parameters in the transform method of RBExtractMethodRefactoring, so that it is already possible to rename the parameters when extracting a method. This change is not yet available in Pharo but you can see the changes made <a href="https://github.com/pharo-project/pharo/compare/Pharo8.0...Lin777:renameParameters">here</a> .</p><ul><li><strong>Add interactive layer: </strong>This consists mainly of separating the logic from the refactoring of the views, for example, system commands is the one that handles the logic of which views to use to send the necessary parameters of the refactoring, which should not be the case. Which is why I’m working on it. These changes have not yet been approved, however if you want to give them a view you can do it from <a href="https://github.com/Lin777/Enjoliveur/tree/UpdateInteractiveLayer">here</a> and the modification of system commands if it is accept this would become as shown <a href="https://github.com/pharo-ide/SystemCommands/compare/master...Lin777:UpdateToUseNewInteractiveLayer">here</a>.</li></ul><p>I hope that my experience will help you to plan your tasks well and not be in the situation that I was due to the bad planning that I had for my first month, and above all I hope you liked this post.</p><p>That’s all for today’s publication, goodbye and happy coding :D</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1bdebb33f45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better and more refactorings for Pharo-Part 2]]></title>
            <link>https://cusi-evelyn.medium.com/better-and-more-refactorings-for-pharo-part-2-96b23a502bf6?source=rss-3547739dce3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/96b23a502bf6</guid>
            <category><![CDATA[refactor]]></category>
            <category><![CDATA[gsoc-2019]]></category>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[pharo]]></category>
            <dc:creator><![CDATA[EVELYN CUSI LOPEZ]]></dc:creator>
            <pubDate>Mon, 20 May 2019 15:59:11 GMT</pubDate>
            <atom:updated>2019-05-20T15:59:11.700Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is aimed to give a small introduction of what refactoring is and to present the refactoring tool that <a href="http://pharo.org/">Pharo</a> currently has, in such a way that it can show the starting point that we will have before carrying out this project. So let’s get started…</p><h3>1. What is refactoring?</h3><p>Refactoring is to make a <strong>transformation to the software preserving its behavior</strong>, modifying only its internal structure to <strong>improve</strong> it.</p><h3>2. Why should we do refactoring?</h3><p>One of the reasons for refactoring is to help the code to stay in “<em>good shape</em>”, since over time the changes in the software cause it to lose its structure, and this makes it difficult to see and preserve the design. Refactoring helps to avoid typical problems that appear over time, such as, a greater number of lines to do the same things or duplicate code.</p><h3>3. Pharo’s refactoring tool</h3><p>The <a href="http://pharo.org/">Pharo’s</a> refactoring tool has the following automatic refactoring capabilities:</p><ul><li>Rename</li><li>Extract</li><li>Inline</li><li>Push down and Pull up</li></ul><h3>3.1. Rename</h3><p>It allows to change the name of classes, local variables and methods. It is useful when you want to safely change the name of something without having to search all the instances and copy and paste the new name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*vSLUS866Ci0YVJzVOtpa3A.png" /><figcaption>Figure 1 — Window of rename</figcaption></figure><p>To access this option, select the item you want to rename and press Ctrl + R, Pharo will show you a window to modify the name (Figure 1).</p><h3>3.2. Extract</h3><ul><li><strong><em>Extract Method</em></strong></li></ul><p>The <em>Extract Method</em> refactoring lets take a code fragment that can be grouped together, move it into a separated method and replace the old code with a call to the method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*fWzUWzybmoK1UFd1f0OT7Q.png" /><figcaption>Figure 2 — Selecting a refactoring option</figcaption></figure><p>You can access this option by selecting the code fragment you want to extract, <strong><em>right click &gt;&gt; Suggestions &gt;&gt; Extract method</em></strong> (Figure 2), this will open a window to name the method you are extracting, once named the method, will appear the window “Changes Browser” (Figure 3) showing how your code will look like after the extraction, you can select which changes you want to make and deselect which not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*L65ZucFKulXw6npoAkRnRA.png" /><figcaption>Figure 3 — Changes browser</figcaption></figure><p>Below you will see an example of extract method</p><p>— Before refactoring</p><pre>Example &gt;&gt; method<br>    | a b c d|<br>    a := 1.<br>    b := 2.<br>    c := a + b.<br>    d := a + c.</pre><p>— After refactoring</p><pre>Example &gt;&gt; method<br>    | a b c d|<br>    a := 1.<br>    b := 2.<br>    c := self add: a to: b.<br>    d := self add: a to: c.</pre><pre>Example &gt;&gt; add: a to: b<br>    ^ a + b</pre><ul><li><strong><em>Extract local</em></strong></li></ul><p>If you come across an expression that is hard to understand or it is duplicated in several places throughout you code, the <em>Extract Local Variable</em> refactoring can help you deal with those problems placing the result of such expression or its part into a separate variable that is less complex and easier to understand. Plus, it reduces the code duplication.</p><p>To access this option you must follow the same steps as to extract a method, but instead of selecting the option Extract method you must select <strong><em>Extract local</em></strong>, this will show a view (Figure 4) where you must define the name of the local variable with which you will extract the fragment of code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*LzXtQM-IEKRsQjqcnOjuzQ.png" /><figcaption>Figure 4 — Window for name a local variable that will be extracted</figcaption></figure><p>Once you name the local variable, and press Ok, you will get the “Changes Browser” window as before, where you can see your changes in the code.</p><p>Below you will see an example of extract local</p><p>— Before refactoring</p><pre>Example &gt;&gt; method<br>    | a b c|<br>    a := 1.<br>    b := a + list size.<br>    c := b + list size.</pre><p>— After refactoring</p><pre>Example &gt;&gt; method<br>    | a b c d|<br>    a := 1.<br>    d := list size.<br>    b := a + d.<br>    c := b + d.</pre><h3>3.3. Inline</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*hORks8ZpDKLLzNLTKbPKzA.png" /><figcaption>Figure 5 — Selecting Inline temp option</figcaption></figure><ul><li><strong><em>Inline temp</em> </strong>refactoring replaces redundant temporal variable usage with its initializer.</li></ul><p>You can access this option by selecting the variable that you want put inline and then <strong><em>right click &gt;&gt; Source code&gt;&gt; Inline temp </em></strong>(Figure 5)</p><p>Below you will see an example of inline temp</p><p>— Before refactoring</p><pre>Example &gt;&gt; method<br>    | number b |<br>    number := anotherClass value.<br>    b := 3 + number.</pre><p>— After refactoring</p><pre>Example &gt;&gt; method<br>    | b |<br>    b := 3 + anotherClass value.</pre><ul><li><strong><em>Inline method </em></strong>results in placing method’s body into the body of its caller(s). This option can be accessed like extract method, but instead of selecting the option Extract method you must select <strong><em>Inline method.</em></strong></li></ul><p>Below you will see an example of inline method</p><p>— Before refactoring</p><pre>Example &gt;&gt; method<br>    | a b c d|<br>    a := 1.<br>    b := 2.<br>    c := self add: a to: b.<br>    d := self add: a to: c.</pre><pre>Example &gt;&gt; add: a to: b<br>    ^ a + b</pre><p>— After refactoring</p><pre>Example &gt;&gt; method<br>    | a b c d|<br>    a := 1.<br>    b := 2.<br>    c := a + b.<br>    d := a + c.</pre><h3>3.4. Push down and Pull up</h3><ul><li><strong><em>Push down </em></strong>improves class coherence. A method is located where you expect to see it. For example if you see that a method is needed by more than one subclass, but not all of them, it may be useful to create an intermediate subclass and move the method to it. This allows avoiding the code duplication that would result from pushing a method down to all subclasses.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n-ubBg5HN_ZHOpak9-_rKw.png" /><figcaption>Figure 6 — Push down example (Image extracted of website: <a href="https://refactoring.guru/push-down-method">https://refactoring.guru/push-down-method</a>)</figcaption></figure><p>This option can be accessed selecting the method of superclass that you want push down then <strong><em>right click &gt;&gt; Push down.</em></strong></p><ul><li><strong><em>Pull up </em></strong>gets rid of duplicate code. If you need to make changes to a method, it’s better to do so in a single place than have to search for all duplicates of the method in subclasses; this refactoring technique can also be used if, for some reason, a subclass redefines a superclass method but performs what’s essentially the same work.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKIrTFPdGq_j9cPAAbreLw.png" /><figcaption>Figure 7— Pull up example (Image extracted of website: <a href="https://refactoring.guru/pull-up-method">https://refactoring.guru/pull-up-method</a>)</figcaption></figure><p>This option can be accessed selecting the method of subclass that you want pull up then <strong><em>right click &gt;&gt; Pull up.</em></strong></p><p>I hope that this post has served to improve their knowledge of refactoring, and to see how to use them with the automatic options of refactoring that has <a href="http://pharo.org/">Pharo</a>.</p><p>That’s it for today’s post, bye and happy coding :D</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96b23a502bf6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better and more refactorings for Pharo — Part 1]]></title>
            <link>https://cusi-evelyn.medium.com/better-and-more-refactorings-for-pharo-part-1-d79da98b4569?source=rss-3547739dce3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d79da98b4569</guid>
            <category><![CDATA[gsoc-2019]]></category>
            <category><![CDATA[smalltalk]]></category>
            <category><![CDATA[pharo]]></category>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[tools]]></category>
            <dc:creator><![CDATA[EVELYN CUSI LOPEZ]]></dc:creator>
            <pubDate>Mon, 13 May 2019 21:17:40 GMT</pubDate>
            <atom:updated>2019-05-13T21:17:40.101Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4dYVjMsku1HU1CmwufvZQ.png" /></figure><h3>Better and more refactorings for Pharo — Part 1</h3><p>Hi everyone! My name is Evelyn, I am from Bolivia, and during the Google Summer of Code 2019, I will be working on improving the refactoring tools for <a href="https://pharo.org/">Pharo</a>. This project is being mentored by Christophe Demarey, Pablo Tesone and Juan Pablo Sandoval.</p><h3>What is Google Summer of Code?</h3><p><a href="https://summerofcode.withgoogle.com/">Google summer of Code</a> (GSoC) is an annual program funded by Google to encourage students in crafting open source software. Every year Google selects mentoring organizations. Students are paired with mentors of the mentoring organizations to work on their projects. The coding period spans for 3 months and students go through 3 evaluations within this period.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/0*i7GmuKsMfPLfKIr_" /></figure><h3>What is Pharo?</h3><p><a href="http://pharo.org/">Pharo</a> is a clean, innovative, open-source, pure object-oriented programming environment / language. Pharo is supported by a strong community that grows daily. The Pharo community is active, very friendly and helpful.</p><h3><strong>Why improve the refactoring tools for Pharo?</strong></h3><p>Refactoring tools help developers to automatically perform a number of predefined source code changes, while preserving the current functionality.Currently Pharo has already implemented a number of refactoring options.Unfortunately, Pharo refactoring support lowered in quality and some refactoring options is still missing in Pharo, and this is the why I I would like to contribute in this GSoC for that Pharo refactoring tool reaches the level of other IDEs such as<a href="https://www.jetbrains.com/help/idea/refactoring-source-code.html"> IntelliJ IDEA</a>.</p><p>I’ll upload a blog every week, where I show you implementation details for this project step by step. This is the first post of many, if you like this topic, do not hesitate to follow this series of posts.</p><p>Well, bye for now and happy coding :D.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d79da98b4569" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pruebas funcionales con Parasol]]></title>
            <link>https://cusi-evelyn.medium.com/pruebas-funcionales-con-parasol-9af6c9c2bdcf?source=rss-3547739dce3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9af6c9c2bdcf</guid>
            <category><![CDATA[smalltalk]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[test]]></category>
            <category><![CDATA[seaside]]></category>
            <category><![CDATA[pharo]]></category>
            <dc:creator><![CDATA[EVELYN CUSI LOPEZ]]></dc:creator>
            <pubDate>Thu, 25 Apr 2019 21:06:04 GMT</pubDate>
            <atom:updated>2019-04-25T21:06:04.304Z</atom:updated>
            <content:encoded><![CDATA[<p>En cualquier proyecto de desarrollo de software <strong>“los tests no son opcionales”, </strong>debido a que hacer tests es la forma en la que nos aseguramos de que nuestro programa haga lo que queremos y lo haga sin errores.</p><p>Es por ello que el éxito de los tests impacta directamente en la calidad final del producto que desarrollemos y forma una parte fundamental en la evolución y mantenimiento del mismo.</p><p>Pero… ¿qué hacemos cuando queremos hacer testing a una pagina web en el navegador?, sin tener que estar nosotros tras todos los navegadores posibles, emulando ser muchos usuarios a la vez, etc.</p><p>Es aquí donde puedes usar <a href="https://github.com/SeasideSt/Parasol"><strong>Parasol</strong></a>, un framework de Smalltalk que automatiza los navegadores web para hacer pruebas sobre sitios Web y comprueba de una manera sencilla que todo el conjunto del sitio o aplicación funciona correctamente.</p><p>Este framework nos sirve para testear websites desde el lado del cliente, simulando determinados usos de sitios en el navegador, tal como lo realizarían nuestros propios usuarios, de modo de que podamos comprobar como se comporta nuestra aplicación o sitio web en diferentes casos, todo esto sin que tengamos que realizarlo manualmente.</p><h3>¿Cómo puedo usarlo?</h3><p>Primero debes contar con los siguientes requerimientos:</p><ul><li>Una imagen de Pharo, si aun no la tienes es muy fácil crearla con <a href="https://pharo.org/download">PharoLauncher</a>.</li><li>Instalar Parasol en tu imagen, para ello debes abrir un espacio de trabajo y evaluar:</li></ul><pre>Metacello new<br> baseline: ‘Parasol’;<br> repository: ‘github://SeasideSt/Parasol/repository’;<br> load: ‘tests’.</pre><pre>(Smalltalk at: #ZnZincServerAdaptor) startOn: 8080.</pre><ul><li>Tener instalado un navegador <a href="https://www.google.com/chrome/">Chrome</a>.</li><li>Contar con el archivo JAR de <a href="http://docs.seleniumhq.org/download/">Selenium standalone server</a> (recomiendo usar la version 3.14.0 esta version hasta ahora no me dio problemas :D)</li><li>Y por ultimo tener el <a href="https://sites.google.com/a/chromium.org/chromedriver/">Chromedriver</a> para tu sistema operativo.</li></ul><p>Una vez cuentes con todo, debes extraer el archivo ZIP de Chromedriver en el directorio donde colocaste el archivo JAR del servidor Selenium.</p><p>Ahora tenemos todo listo para hacer las pruebas funcionales con Parasol.</p><h3>Creando un test simple con Parasol</h3><p>Para realizar nuestros tests primero crearemos una subclase de TestCase llamada <em>FunctionalTests</em>.</p><pre>TestCase subclass: #FunctionalTests<br> instanceVariableNames: ‘’<br> classVariableNames: ‘’<br> package: ‘FT-Parasol’</pre><p>Una vez creada nuestra clase debemos contar con un controlador para el navegador, por lo que debemos agregar una variable de instancia llamada <em>driver.</em></p><pre>TestCase subclass: #FunctionalTests<br> instanceVariableNames: ‘driver’<br> classVariableNames: ‘’<br> package: ‘FT-Parasol’</pre><p>Antes de continuar con nuestro test debemos considerar que cuando realizamos tests debemos preparar el estado inicial antes de que se ejecuten los tests y realizar una limpieza después de completarlos, eso se conoce como configuración (setUp) y desmontaje (tearDown). Por lo tanto inicializaremos nuestro controlador (driver) en el método setUp y lo cerraremos con el método tearDown.</p><pre>FunctionalTests &gt;&gt;&gt; <strong>setUp</strong><br> super setUp.<br> driver := BPRemoteWebDriver withCapabilities: BPDesiredCapabilities chrome.</pre><pre>FunctionalTests &gt;&gt;&gt; <strong>tearDown</strong><br> super tearDown.<br> driver quit</pre><p>Pero aún no tenemos definido que URL testearemos, esto se realiza con el método<strong> get: anUrl </strong>del controlador, así que ahora podemos agregar este método a nuestro método setUp (para nuestras pruebas usaremos la siguiente <a href="http://newtours.demoaut.com/">pagina</a><strong> </strong>la cual es una pagina falsa para enseñar a automatizar).</p><pre>FunctionalTests &gt;&gt;&gt; <strong>setUp</strong><br> super setUp.<br> driver := BPRemoteWebDriver withCapabilities: BPDesiredCapabilities chrome.<br> driver get: &#39;<a href="http://newtours.demoaut.com/&#39;">http://newtours.demoaut.com/&#39;</a></pre><p>Para nuestro primer test haremos un simple registro en la pagina, ingresaremos un nombre de usuario y una contraseña y pulsaremos en el botón de registro, esperando que esto nos redireccione a otra pagina.</p><p>Para hacer esto necesitamos conocer la estructura de la pagina por lo que a continuación les mostrare lo que contienen las etiquetas de todos los elementos con los que queremos interactuar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*4ad5nXdb2AF-q-mBsonGIw.png" /></figure><p><strong>User Name:</strong><em> &lt;input type=”text” name=”userName” size=”10&quot;&gt;</em></p><p><strong>Password: </strong><em>&lt;input type=”password” name=”password” size=”10&quot;&gt;</em></p><p><strong>Sign-in:</strong> <em>&lt;input type=”image” name=”login” value=”Login” src=”/images/btn_signin.gif” width=”58&quot; height=”17&quot; alt=”Sign-In” border=”0&quot;&gt;.</em></p><p>Ahora ya contamos con lo necesario para hacer nuestro primer test.</p><p>Primero debemos encontrar los campos y el botón para poder registrarnos automáticamente, afortunadamente Parasol cuenta con casi todos los métodos de Selenium, por lo que contamos con un método que encuentra elementos de la pagina por su atributo <strong>name (</strong>findElementByName: aString<strong>), </strong>entonces ahora solo nos queda seleccionar todos los elementos que necesitamos:</p><pre>FunctionalTests &gt;&gt;&gt; <strong>testSignIn<br> </strong>|userName password signIn|</pre><pre> userName := driver findElementByName: ‘userName’.<br> password := driver findElementByName: ‘password’.<br> signIn := driver findElementByName: &#39;login&#39;.</pre><p>Ahora ya tenemos almacenados en variables cada elemento, pero aun no hacemos nada con estos elementos, primero llenaremos los campos userName y password, para llenar un campo existe un método del elemento llamado <strong>sendKeys: aString, </strong>conociendo esto ya podemos llenar estos campos.</p><pre>FunctionalTests &gt;&gt;&gt; <strong>testSignIn<br> </strong>|userName password signIn|</pre><pre> userName := driver findElementByName: ‘userName’.<br> password := driver findElementByName: ‘password’.<br> signIn := driver findElementByName: &#39;login&#39;.</pre><pre> userName sendKeys: ‘User‘.<br> password sendKeys: ‘Password‘.</pre><p>Bien ya tenemos los campos llenados, ahora solo nos queda hacer click en el botón de registro, para esto existe el siguiente método <strong>click.</strong></p><pre>FunctionalTests &gt;&gt;&gt; <strong>testSignIn<br> </strong>|userName password signIn|</pre><pre> userName := driver findElementByName: ‘userName’.<br> password := driver findElementByName: ‘password’.<br> signIn := driver findElementByName: &#39;login&#39;.</pre><pre> userName sendKeys: ‘User‘.<br> password sendKeys: ‘Password‘.</pre><pre> signIn click.</pre><p>Ahora el registro esta automatizado pero ¿cómo verificamos que hace lo que queremos? bueno una simple forma seria verificar que al realizar esta acción nos redireccione a otra pagina, y en efecto al presionar el botón nos redirecciona a esta pagina</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*rKVDHrrzu2_Ey_AecBj3wQ.png" /></figure><p>entonces para terminar nuestro test solo debemos verificar que ingresamos aquí exitosamente, haremos esto encontrando el link con el texto <strong>registration form </strong>usando el método<strong> findElementByPartialLinkText: aString, </strong>nuestro test pasara si encuentra este elemento en caso de que no lo encuentre no lo hara.</p><pre>FunctionalTests &gt;&gt;&gt; <strong>testSignIn<br> </strong>|userName password signIn|</pre><pre> userName := driver findElementByName: ‘userName’.<br> password := driver findElementByName: ‘password’.<br> signIn := driver findElementByName: &#39;login&#39;.</pre><pre> userName sendKeys: ‘User‘.<br> password sendKeys: ‘Password‘.</pre><pre> signIn click.</pre><pre> self shouldnt: [driver findElementByPartialLinkText: ‘registration’] raise: BPNoSuchElementException </pre><p>Ahora ya tenemos nuestro primer test automatizado con Parasol :D, pero antes de ejecutarlo aun nos falta hacer un paso, debemos ejecutar el servidor de Selenium, para hacer esto solo ejecuta la siguiente línea de comando en tu terminal:</p><pre>java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone-3.14.0.jar</pre><p>Y estamos listos para ejecutar nuestro primer test :D</p><p>Si todo salió bien obtendrán un lindo color verde en la ejecución de tu test.</p><p>Si les gusto la automatización con Parasol pueden encontrar muchos mas ejemplos en el paquete<strong> ‘Parasol-Tests’.</strong></p><p>Continuaremos con más de Parasol en un artículo futuro. Manténganse al tanto…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9af6c9c2bdcf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>