logo tech writers

tech writers

This is our blog for technology lovers! Here, softplayers and other specialists share knowledge that is fundamental for the development of this community.

Learn more
Introduction to User Experience (UX) concepts and processes
Tech Writers December 06, 2021

Introduction to User Experience (UX) concepts and processes

In this article, we will show how user experience (UX) is present in different moments of our daily lives, in addition, we will: Present its basic concepts; Highlight its importance and relevance within projects acting as a strategic driver; Briefly explain the processes and activities related to the area. Observe the following situations: Despair when missing the time because the alarm clock has not gone off; Discomfort due to complications from the machine when paying with a card; Stress in long lines at pharmacies or supermarkets; Annoyance at not being able to use the bank's app and still having the inconvenience of having to go there to resolve your problem. Have any of these ever happened to you? We often think this is bad luck, but is it really? What could have happened: You missed the time because you turned off the alarm the night before, because it was a holiday, and the system didn't ask you how long you would have liked to have left it off; The collector was using a new machine and was unable to swipe the card, as he didn't know how to use it and the information was very confusing; The queues were huge because “the system crashed”, as we always heard from the attendants; You had to go to the bank, as the application did not predict actions that you would need to perform. So the answer is: it's not bad luck! All of this is directly related to UX, the user experience. What is UX – User Experience? Did you notice that the feelings of the situations were highlighted? Desperation, discomfort, stress and annoyance. When these scenarios happen and negative feelings are aroused, we say that the experience that the person, the user, had with the product or service was bad. Everything could be different if there was greater concern in having clarity of the problem to be solved: trying to understand how each project decision is affecting or could affect the users' objectives and needs. The lack of knowledge about these points makes a total difference between success or failure of a product/service and users' satisfaction or dissatisfaction with it. But how to guarantee user satisfaction? In all areas of Softplan we have a competence center specialized in user experience. In the area responsible for Justice solutions, this center is the CCUX (User eXperience Competence Center), which has a team of designers working in each SAJ vertical (Public Ministries, Public Defender's Offices, Prosecutor's Offices and Courts of Justice). It is difficult to be sure whether we will be able to achieve user satisfaction and product success. After all, there is no magic, silver bullet or miracle medicine. However, our team is dedicated to increasing the chances of this happening, even before a single line of code is written. To achieve this, designers use a series of concepts, techniques and processes that guide them to provide good experiences to users and, thus, minimize chances of project failures. Although they are known as professionals who work directly with User Experience, it is It is extremely important that everyone involved in the project also has a knowledge base about the methods we apply. This allows us to create strategies within multidisciplinary teams, that is, involving other areas of activity and adding diverse knowledge to the project, thus enabling even more assertive solutions. The famous UX process We can summarize the steps of the UX process in: Description of the image above: objectives and strategies, arrow to the right, research and analysis, arrow to the right, ideation and prototype arrow to the right, testing and iteration. Each of them has excellent activities that provide data collection and insights, in addition to making all project efforts much more effective. This allows product development to follow the right path, according to the user's true needs, and not based on assumptions. Next, we briefly describe the essence of each of them. Objectives and strategies In this first stage, we need to resolve all our doubts about the project and identify scenarios that still need to be explored. That is, carried out based on a mapping of our certainties (which must be substantiated with evidence and data), assumptions and doubts. Furthermore, it is also important to: Search for documented internal knowledge; Define boundaries and metrics; Plan a long-term vision; Know limitations; Clarify business objectives; Product objectives; Identify or approach the project’s key actors. All of this allows us to plan actions or create a roadmap for the next steps. Research and Analysis Here, an empathetic approach to users is fundamental, that is, it is necessary to have the ability to put yourself in someone else's shoes to understand their pain, needs and desires. We need to know our customers/users well, talk to them, become immersed in their lives, understand their context, their behavior, and even try to feel firsthand what they feel before, during and after contact with the product/service. In this approach with users, analyzing actions is more important than just listening to them and taking down their requests. We must differentiate attitude from behavior. In other words, it is necessary to distinguish what they say and express (their requests, facial or body expressions), from what they actually do and how they act (what information and tools they use, what paths and decisions are made). It is important to have this insight because it is common for users to propose and request solutions to problems that could be solved in more effective ways, with even more solutions to a problem at the same time and that would deliver much more value to it. In short, this research stage aims to provide data collection to validate or invalidate our assumptions, answer our doubts, support and direct all decisions involving the product. After having carried out a large collection of evidence and getting to know users better, we have collected concrete information and will no longer be held hostage by our assumptions. At this stage, we will also analyze and synthesize this information to identify and define the focus of the problem or point for improving the service/product. It is important to emphasize that, until we are completely clear about the problem to be solved, it is difficult to propose solutions that make a difference to users. Ideation and prototype It's time for ideation, that is, proposing alternative solutions to the problems presented. At this time, it is ideal for the discussion to be multidisciplinary and to seek to bring disruptive ideas. We cannot be afraid of being judged and we should not judge our colleagues' ideas, this is the famous Brainstorming phase. After opening the range of ideas, it is time to converge on a purpose, select a solution that is more likely to deliver value to users, but that is technically feasible to be implemented and within a plausible time frame. It is part of the designer's day-to-day work to balance user needs with technical limitations and business needs. Tests and iterations “Solution in hand?! Time to implement?” Calm down! How about making a prototype, or maybe a few, first? The idea is that they are low-cost prototypes and that they are put in contact with users as soon as possible so that it is possible to validate or invalidate hypotheses and, most importantly, fail as soon as possible! At Softplan's CCUX in the Justice area, we created high-fidelity prototypes, already in HTML and CSS, as it was the most efficient way found to test and collect feedback. However, this largely depends on the context and profile of the users who are carrying out the tests. If it makes sense, it’s worth testing with drawings! During testing, it is essential to observe and pay attention to users' behavior towards the prototype, in addition to collecting data and documenting it, as we will then analyze it more calmly and make the necessary adjustments according to what was seen. Tip: In these moments it is extremely important not to get attached to your solutions, as, often, what we end up initially proposing may not be the best solution that solves users' needs and pains. Fall in love with the problem and not the solution. If necessary, it is possible to carry out even more rounds of tests, with different prototypes, to achieve certainty about what is being delivered, what will be developed and what will reach the hands of users. Does waterfall methodologies go against agile principles? The entire process was described linearly, however, we should not get caught up in this, we can and should go back whenever and as many times as we deem necessary. Therefore, the image below shows the scheme I explained previously. Description of the image above: all steps of the process with arrows going back and forth between each one. We use this process as a guide, but the main idea is that, as we get to know users more and have more clarity about the problems to be solved, we will be able to think of increasingly assertive ideas to solve their problems and deliver products/services. that people really love.

Proud Tech 2021: Top Tech Trail Insights for Software Developers!
Tech Writers November 29, 2021

Proud Tech 2021: Top Tech Trail Insights for Software Developers!

Anyone who is a software developer knows that staying up to date and understanding everything the market presents is a big challenge. In this sense, Proud Tech, an event for those who love technology and want to always be on top of this universe, is a great choice! The 2021 edition brought together softplayers and softplayer guests to share knowledge with others passionate about the topic. Among the various trails, there was the Tech Trail, in which many of these reference professionals spoke about curiosities and legacy code, artificial intelligence and the importance of the non-functional. Therefore, in this content we will cover the main insights, so you know what happened there. Check it out: The importance of the non-functional for a software developer To understand the approaches, it is worth recalling what is non-functional for a software developer. Understanding this concept is important to know how to overcome challenges. In her lecture on the topic, Lucélia Siqueira highlights what happens when the non-functional is neglected. To enable this understanding, she draws attention to the importance of trying to change this scenario. Returning to explanations about what the definition of non-functional would be, the speaker also recalls that this term refers to system attributes with characteristics such as: security; reliability; scalability. In other words, it can be understood as the criterion for evaluating the operability of a system. For her, however, it is everything that supports functional demands, guaranteeing the quality of the software under development. This way, the professional can make improvements to their project. This requirement is able to describe how the system performs some task, while the functional one says what it performs. Therefore, it is possible not only to know what the software does, but how it performs. Validating good software by knowing its performance in advance is much safer and more accurate. Dealing with legacy code In the language of a software developer, legacy code refers to code that is generally developed at first without thinking about the costs that may exist later for maintenance. This is a problem because without proper planning or testing, which are good practices, it is not possible to know whether the software will be sustainable in the long term. It is also not possible to say and know whether there will be good acceptability. Some dependency elimination techniques are covered in the book “Working Effectively with Legacy Code” and are very important to be known by a software developer. In this lecture, Jefferson Henrique mentions that this reading is one of the most desired for those who work in the field. Anyone who hasn't read it should have it on a list to do so, of course. The professional states that this concept is not only seen in old companies, but also in new ones. In the talk, a speech by Michael Feathers is highlighted, who states that legacy code is any code that is not covered by automated tests. Therefore, regardless of the framework, legacy code is anything that does not offer you feedback. Without this feedback, the developer always works in a “blind spot”. Without knowing better how the solution is performing, its maintenance becomes even more complicated later. The importance of Artificial Intelligence in Brazilian Justice Another interesting point for a software developer is understanding how artificial intelligence has a very useful use in society. A very interesting case is discussed in Mauricio Seiji's talk. In this way, functionalities of Softplan's artificial intelligence solution for combating domestic violence are addressed, which came to fill gaps in the organization of data. Seiji explains that the Public Prosecutor's Office has a role not only in combating, but also in preventing this type of problem. To help Brazilian Justice, he participated in the development of a solution that uses machine learning to help identify when this happens, as we will see later. Applying machine learning Using a specific machine learning technique, called text classification, it was possible to create a system that helped to correctly classify the data that these bodies had to better understand what was going on and correctly separate each piece of information. Thus, cases previously classified, for example, as a common crime, could be analyzed from the point of view of domestic violence, to identify it. This entire set of well-interpreted data, by region, even helps the Court to take action. This way, through graphs, it is possible to show this data and help with decision making. Artificial intelligence, in these cases, has an accuracy of around 93% (high success rate). Based on data, the Public Ministry is able to take better actions regarding decisions involving its budget, actions to prevent violence, awareness and combat. See how important all these insights are for a software developer?

Beginner programmers: check out the main insights from Proud Tech 2021
Tech Writers November 22, 2021

Beginner programmers: check out the main insights from Proud Tech 2021

Are you part of the beginner programmers club and want to learn more about software development? So stay tuned for this content, in which we will talk about what happened on the Proud Tech 2021 Softdraft Trail. This is an event promoted by us, at Softplan, for other technology lovers. Divided into tracks that took place in parallel, we brought several experienced speakers to Proud Tech in the market. The Softdraft Track was focused on introductory subjects and covered aspects such as Java evolution and software quality. Therefore, it is of great importance for those who are starting to explore this universe. Part of the shared knowledge came from: Felipe da Silva Corrêa, developer since 2008; Julio de Lima, who works within a financial consulting firm; Christian Fritsch, who has been working with front-end for 10 years; Andre Baltieri, who has been working with development and web applications since 2003. Check out a little about what was covered and read the content in full, to find out what the talks were like that you weren't able to attend or to remember the most important points, if you did. Things that no one tells beginner programmers about working with Java Felipe da Silva Corrêa brings a very interesting vision for beginner programmers, who always wonder where to start. Addressing the evolution of Java over the years and the main tips for operating in the market, it also brings an insight into what people generally don't say about the challenges of operating in this segment, but which, when they know, help the professional to overcome them. them. Felipe begins the talk by pointing out that Java is a project that began in the early 90s. At that time, it did not have that name and was practically a university project, but it has evolved over the years. Its first commercial version came in 1995 and to this day, 27 years later, it remains on the market, although it has undergone transformations. Java Transformations Among the notable facts of what made Java so well known is the internet boom in the early 2000s. Thus, platforms and solutions came along that could work to meet the needs of the web with Java, in a primitive way, generating static HTML code, rendered in a browser. In 2007, the maintainer made the code available (open source). By opening it up to the community, everyone was able to feed Java and promote it. In 2008, the company was purchased by Oracle. From this, Java was divided into two possibilities: open source and enterprise (licensed). After that, we went through the framework development decade, until we got to what we have today, including a streaming service, like Netflix, using the resource. Tips for acting Felipe talks about what you can expect from the market and gives 5 tips on how to prepare: discover how to converse in the language of the person you are speaking, even if it is different from yours; learn beyond your specialty, having at least an idea of ​​others, understand before drawing conclusions (don't just look at a code and consider it bad, understand how it works); keep up to date, Java always has news; learn Linux. Career in software testing and quality: A practical guide! For beginner programmers, it is very important to understand the career path and how to navigate quality. Julio de Lima, in his lecture, talks about the reason for testing the quality of software, which is related to the objective of preventing application problems from reaching the hands of customers. He explains that in the traditional context, there would be testers, but in agile development this role is performed by the software team itself. Knowing how to conduct these tests goes, then, including the step of thinking about this culture before it is developed. After all, which framework to start with? Tips for beginner programmers regarding which framework to start with can be seen in Christian's talk. Learning a framework, as seen in it, is important because it provides a style guide to follow. This even helps in situations where it is not the same professional who starts a process who will finish developing it. The speaker's framework tips include: choosing a framework that your friends already use; use a framework that the companies of interest already use; Use the one with the nicest documentation. Clean Code: how to keep your code clean? Beginner programmers may also be very curious to understand how to work with clean code. Baltieri presented, in his talk, general rules such as: following conventions (if the project already has a standard); follow the KISS logic (everything as simple as possible); practice the boy scout rule (if you take a code for maintenance, return it better than it was, applying, for example, the clean code to a section); work on the root cause of the problem, not just fixing it. Finally, the concept of Code Smells is brought up. It is used to designate when something in the code is not consistent. Baltieri emphasizes the following characteristics: rigidity; fragility; immobility; unnecessary complexity; unnecessary repetition; opacity. Working to minimize these effects is critical to achieving a solution that is both effective and easier to use. Did you understand the relevance of understanding these aspects for beginner programmers?  

Main new features introduced in JAVA 1.8
Tech Writers November 13, 2021

Main new features introduced in JAVA 1.8 

As many know, the new JAVA 1.8 version was released in October 2021, with improvements, new features and fixes for recurring bugs from the old version. Below, see the latest news and practical, objective examples. Good reading! Main new features introduced in JAVA 1.8 Next, we will exemplify the main new features in JAVA 1.8. They are: Default Methods in interfaces; Lambda and Functional interfaces; Method References; Stream; New Dates API; Default Methods in interfaces Below, we will create a List of type String containing titles of some remarkable games that will be used in the examples of the content. List games = new ArrayList<>(); games.add(“Top Gear”); games.add(“The Legend of Zelda: Ocarina of Time”); games.add(“Shadow of the Colossus”); In the past, the common way to sort objects in a Listlist was to use the Ccollections class and the static sort method. System.out.println(games);// [Top Gear, The Legend of Zelda: Ocarina of Time, Shadow of the Colossus]Collections.sort(games);System.out.println(games);// [Shadow of the Colossus, The Legend of Zelda: Ocarina of Time, Top Gear] It is important to remember that the code above compiled without the need for any changes. This happens because the String class implements an interface called Comparable, which requires the declaration of the compareTo method. Within this technique, the configuration is done in lexicographic order. What if we want to sort the words in a different order? If we want to sort words by size, for example, we need to create a comparator to inform the sort method. It is necessary to create a class. Its name doesn't matter much, but it is mandatory that it has implemented the Comparator interface and a declaration for the compare method. class StringComparatorBySize implements Comparator { public int compare(String s1, String s2) { if(s1.length() < s2.length()) return –1; if(s1.length() > s2.length()) return 1; return 0; }} Now, we need to pass this comparator to the sort method, as it has a rewrite that receives a List and a Comparator. comparator comparator = new StringComparerBySize();System.out.println(games); // [Top Gear, The Legend of Zelda: Ocarina of Time, Shadow of the Colossus]Collections.sort(games, comparator);System.out.println (games);// [Top Gear, Shadow of the Colossus, The Legend of Zelda: Ocarina of Time] With the new Default Methods feature, we can now create bodied methods within an interface. From this, the List interface now has an implementation of the sort method. // Sort method inside the Listdefault interface void sort(Comparator<? super E> c) { Object[] a = this.toArray(); Arrays.sort(a, (Comparator) c); ListIterator i = this.listIterator(); for (Object e : a) { i.next(); i.set((E) e);} Note that, to implement sort through List, we must inform a Comparator. comparator comparator = new StringComparerBySize();games.sort(comparator);System.out.println(games);// [Top Gear, Shadow of the Colossus, The Legend of Zelda: Ocarina of Time] Lambda and Functional interfaces In this topic, let's continue in the same context as the last example. public class App { public static void main(String[] args) throws Exception { Comparator comparator = new StringComparerBySize(); List games = new ArrayList<>(); games.add(“Top Gear”); games.add(“The Legend of Zelda: Ocarina of Time”); games.add(“Shadow of the Colossus”); games.sort(comparator); System.out.println(games); // [Top Gear, Shadow of the Colossus, The Legend of Zelda: Ocarina of Time] }}class StringBySize Comparator implements Comparator { public int compare(String s1, String s2) { if(s1.length() < s2.length()) return –1; if(s1.length() > s2.length()) return 1; return 0; }} Is it possible to make the lambda code a little better? public class App { public static void main(String[] args) throws Exception { List games = new ArrayList<>(); games.add(“Top Gear”); games.add(“The Legend of Zelda: Ocarina of Time”); games.add(“Shadow of the Colossus”); games.sort(new Comparator (){ @Override public int compare(String s1, String s2) { if(s1.length() < s2.length()) return –1; if(s1.length() > s2.length()) return 1; return 0; } }); System.out.println(games); // [Top Gear, Shadow of the Colossus, The Legend of Zelda: Ocarina of Time] }} Because the class approach is simple, we can have the java compiler create an Anonymous Classes. But we can still improve a little more. Note that the compare method has some conditionals testing the sizes of the titles. Essentially, we are testing numbers with numbers and in Integer we have a compare method that does exactly that. games.sort(new Comparator (){ @Override public int compare(String s1, String s2) { return Integer.compare(s1.length(), s2.length()); }} Attention, the Double type also implements this method. Even though our last code got a little more compact, it's still a little verbose. In this context, a resource called lambda was added, but its operation is only possible through Functional interfaces. These interfaces have 1 single abstract method, but in addition to this method, they can have other methods, as long as they are default or static. This structure is critical, as this way the compiler knows exactly that the body of the lambda expression we write is the implementation of its only abstract method. So, as the Comparator is a Functional interfaces, we can use a lambda. games.sort((String s1, String s2) -> { return Integer.compare(s1.length(), s2.length());}); The Java compiler allows us to make the code a little shorter. games.sort((game1, game2) -> Integer.compare(game1.length(), game2.length())); Method References In this topic, we will continue in the same context as the last example. public class App { public static void main(String[] args) throws Exception { List games = new ArrayList<>(); games.add(“Top Gear”); games.add(“The Legend of Zelda: Ocarina of Time”); games.add(“Shadow of the Colossus”); games.sort((game1, game2) -> Integer.compare(game1.length(), game2.length())); System.out.println(games); // [Top Gear, Shadow of the Colossus, The Legend of Zelda: Ocarina of Time] }} The Comparator interface has a new method (comparing), which must receive a Function interface, which in turn is a Functional interface. games.sort(Comparator.comparing(game -> game.length())); It's like we wrote it like that. //We are talking below: Given a String, we will return an Integer which will be the return of the lambda game -> game.length()Function function = game -> game.length();games.sort(Comparator.comparing(function); In this case, as we have a simple invocation of String's length method, it is possible to use Method References. matches.sort(Comparator.comparing(String::length)); One highlight, the use of Method References needs attention. This practice only works for simple invocations. In the next topic, we will see an example where it cannot be used. Stream In this topic, let's continue in the same context as the last example. But now we need a Game class. public class Game { private String title; private int launch; public Jogo(String title, int launch) { this.title = title; this.launch = launch; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getLancamento() { return lancamento; } public void setLancamento(int lancamento) { this.lancamento = lancamento; } } public class App { public static void main(String[] args) throws Exception { List GameList = new ArrayList<>(); listaDeJogos.add(new Jogo(“Top Gear”, 1992)); listaDeJogos.add(new Jogo(“The Legend of Zelda: Ocarina of Time”, 1998)); listaDeJogos.add(new Jogo(“Shadow of the Colossus”, 2005)); }} Stream is a new interface that allows the use of several very interesting methods. Let's filter our list so that only games with releases less than the 2000s are displayed on the terminal. A simple way to do this, in the old days, would be to create a foreach with a conditional testing each value. for (Game game : listOfGames) { if (game.getLaunch() < 2000) { System.out.println(game.getTitle()); }} But there is a better way: Invoking the filter from the Stream. listaDeJogos.stream() .filter(game -> game.getLancamento() < 2000); In this case, we are unable to use Method References, as we are not using a simple filter invocation. This piece of code does not solve our problem, it is testing item by item with our conditional, but a modification to a stream does not modify the collection/object that generated it. To work, we can use forEach, which Stream itself implements. listOfGames.stream() .filter(game -> game.getLaunch() < 2000) .forEach(game -> System.out.println(game.getTitle())); // Top Gear // The Legend of Zelda: Ocarina of Time As we don't have the toString method in the Game class, we can't use the Method References, because we need to inform which parameter System.out should print in the terminal. New Date API We now have several classes with different methods that make work related to dates in Java much easier. Here are some examples of LocalDate: LocalDate date = LocalDate.now();System.out.println(date);// 2021-08-17date = LocalDate.of(2021, Month.DECEMBER, 15);System. out.println(date);// 2021-12-15 To use the DateTimeFormatter to format a LocalDate, you can do it as follows: DateTimeFormatter formador = DateTimeFormatter.ofPattern(“dd/MM/yyyy”);String novaDate = date.format(formatator);System.out.println(newDate);// 15/12/2021 Example of how to extract the nominal day of the week using DayOfWeek DayOfWeek week = DayOfWeek.from(date);System.out.println (week); // WEDNESDAY Examples of LocalDateTime: LocalDateTime time = LocalDateTime.now();System.out.println(time); // 2021-08-17T11:29:56.861110time = LocalDateTime.of(2021, Month. DECEMBER, 15, 21, 30, 0);System.out.println(time);// 2021-12-15T21:30 Example of how to format a LocalDateTime using DateTimeFormatter: DateTimeFormatter formadorTime = DateTimeFormatter.ofPattern(“dd/MM/ yyyy hh:mm:ss");String novaTime = time.format(formatadorTime);System.out.println(novaTime); // 15/12/2021 09:30:00 Example of how to compare LocalDate using Period: LocalDate date1 = LocalDate.of(2021, Month.DECEMBER, 15);LocalDate date2 = LocalDate.of(2051, Month.JANUARY, 22);Period period = Period.between(date1, date2);System.out.println(period) ;// P29Y1M7DSystem.out.printf( “Missing %d years, %d month and %d days.”, periodo.getYears(), periodo.getMonths(), periodo.getDays());// Missing 29 years, 1 month and 7 days. Conclusion about JAVA 1.8 What was exemplified in the topics is just a very superficial view of all the power of these new changes. There are many other methods that provide good solutions to various problems that eventually arise in the development of our applications. The advice that remains is: always keep in mind that, if we are racking our brains to write some method, it is likely that there is already a ready-made method to do it for us. It is always worth checking the existing documentation and solutions. Learn more on our Blog!

The evolution of society and technology
Tech Writers November 04, 2021

The evolution of society and technology

https://open.spotify.com/episode/3kXrDANPbBkNim7RRIKQZv?go=1&sp_cid=65617f9945b6dafa4bd6df3d4f755a20&utm_source=embed_player_p&utm_medium=desktop A evolução da sociedade e da tecnologia No nosso segundo episódio da Together in Tech, conversamos a respeito do desenvolvimento da sociedade junto da tecnologia, desde os primórdios até os dias atuais. Para isso, convidamos a antropóloga Andressa Soilo para dialogar e trocar ideias com o host Guilherme Brasil. O bate-papo foi muito interessante e abordaremos alguns tópicos discutidos aqui nesse artigo.  Os últimos 10 anos da sociedade Ao analisar a linha de tempo da humanidade podemos perceber que muitas coisas mudaram ao longo dos últimos 10 anos. Naquela época, não havia aplicativos para se locomover, para pedir comida ou para requisitar serviços em geral. Hoje em dia, qualquer item que alguém possa necessitar é possível ser encontrado na internet.  Durante o bate-papo, Andressa aponta a questão de que a tecnologia surgiu antes do digital. Quando pensamos nela, muitas vezes ligamos a concepção de que é apenas um ”mundo” de smartphones, impressoras 3D, robótica, inteligência artificial, drones e naves espaciais. No entanto, isso são itens sofisticados que estão ganhando espaço no mercado no momento. Como vivemos em um contexto marcado pelo digital, tendemos a acreditar que a tecnologia está ligada unicamente a isso. O digital certamente impacta a vida das pessoas, visto que é algo que está muito presente no cotidiano. O instagram é um exemplo de rede social que representa o efeito que a tecnologia insere hoje em dia. Muitas pessoas vêm se sentindo cada vez mais inseguras por conta das pressões estéticas da sociedade no meio digital. Além disso, as fake news também são outro exemplo de como o digital se enquadra em nossas vidas. Essas mentiras que se propagam rapidamente geram desinformação e até mesmo causaram diversas mortes durante a pandemia do COVID-19. Ou seja, pode-se perceber de forma clara que atualmente a tecnologia tem quase o mesmo conceito de digital e que nos impacta profundamente.  Questão geracional Estamos vivendo em um período onde as mudanças tecnológicas estão se transformando em uma velocidade rápida. Por isso, certas gerações acabam se perdendo ao acompanhar as alterações tecnológicas. O exemplo citado para demonstrar essa situação é o aparecimento do Tik Tok. Uma nova rede social que ganhou um grande espaço e de forma acelerada nesse mundo. Pessoas de uma geração mais velha, como é o caso da Andressa, nem sequer chegam a baixar e saber utilizar essa rede.  Atualmente, as crianças já crescem sabendo utilizar smartphones e outros aparelhos. Às vezes, até mesmo, aprendem de maneira autodidata. Algo totalmente distinto de gerações passadas, que muitas vezes possuem dificuldade em usar certas tecnologias.   ”No momento, a gente vive uma pluralidade de entendimentos do modo de como nós incorporamos a tecnologia na atualidade.” – Andressa expõe sua opinião. Os impactos da tecnologia  Na conversa, Andressa diz que não há um consenso se a tecnologia digital de hoje em dia é positiva ou negativa. A tecnologia por si só não faz mal a ninguém, mas sim como os indivíduos a utilizam. Isso porque, ela é ambivalente. Ou seja, ela pode trazer tanto impactos bons como ruins para a sociedade.  Caso as pessoas desejam utilizar a tecnologia para algo positivo, ela possui um grande potencial de gerar benefícios em suas vidas. Entretanto, também há diversos aspectos negativos que afetam principalmente o emocional dos indivíduos. Ao manusear a tecnologia de forma prejudicial, problemas psicológicos como ansiedade, depressão e crises de pânico podem começar a surgir na vida dessas pessoas. Esses tipos de transtornos mentais são mais comuns na sociedade do século XXI e são causados pelo mau uso do digital. Dessa forma, é preciso estar atento ao modo como você utiliza a tecnologia diariamente. Ela está te trazendo benefícios? Gostou dessas reflexões? Ouça o bate-papo completo. Nele falamos de outras questões relacionadas com a sociedade e a tecnologia.

Strategy Design Pattern: What it is, when to use it, how to apply it and examples!
Tech Writers November 02, 2021

Strategy Design Pattern: What it is, when to use it, how to apply it and examples!

Among the different design patterns, Strategy allows you to create a family of algorithms, encapsulate each one of them and make them interchangeable, allowing the algorithm to vary independently of the clients that use it and facilitating the maintainability of your code. If you're starting out in the world of design patterns and code quality, but still don't know how to use Strategy, don't worry. We will show you today what Strategy is, when to use it and how to apply it, with examples. You will realize that this pattern is simpler than you think and that it can help you a lot in your daily life. Check it out! What is the Strategy Pattern? Strategy is a behavioral design pattern that defines a family of algorithms, ensuring that the algorithm varies independently of the clients that use it. With it, you can turn a set of behaviors into objects and then make them interchangeable. Today, we will address only the Strategy. But, in addition to it, there are other design patterns in Java, such as Composite and Decorator, which are covered in the GoF Design Patterns book, the Gang of Four - or in Portuguese, Gang of Four, if you have interest in exploring the subject further. Still according to the Gang of Four, in the book Design Patterns: Elements of Reusable Object-Oriented Software, we have the following definition: “A design pattern names, abstracts and identifies the key aspects of a common design structure to make it useful for creating a reusable object-oriented project […]”. How does the Strategy Design Pattern work? Let's understand how the Strategy Design Pattern works: imagine that we have an e-commerce and in the store's shopping cart we can apply some promotions depending on several factors. For example, it is possible to apply a promotion according to the minimum purchase amount, the quantity of the product, free shipping, among others. In this scenario, we can have many variations of algorithms within the shopping cart. However, when doing all this within the cart class without separating the algorithm, there would probably be several IFS conditionals to check in which cases to apply each promotion, generating several changes to the cart class. That's where Strategy comes in, as it solves this problem by separating the algorithm. This way, inside the shopping cart, we will have a field to link a discount strategy that will be a whole family of strategies. That is, we can separate the algorithm from the business rule. When should I use the Strategy pattern? The Strategy pattern is very common in Java code and can be used in situations where your code will have many algorithm variations and conditions, generating a chain of IFs. It is worth emphasizing that not all IF chains need to be replaced by a Strategy, only if the changes are frequent in the long term. This pattern helps facilitate code maintainability and makes potential expansion of your code simpler and more objective. This is possible through the decentralization of responsibility for handling an object abstracted by an interface and its different implementation “strategies”. How to apply the Strategy in practice? Now that you have a better understanding of the concept of the Strategy pattern and when to use it, let's get out of the theoretical part and move on to practice. Let's visualize a problem and think about it, and then test the implementation of the design pattern in question. Strategy Java application example: The Problem To better understand how to apply the Strategy, imagine that there is an Employee object with its properties and a SalaryCalculator class that performs the salary adjustment of this employee according to his performance during the year. With an ENUM that exists within the properties of the Employee object, the employee's performance is measured. See the following example: Now, imagine the following business rules: If the employee has a NEGATIVE performance at the time of calculation, he should not receive a salary increase. If the employee has a POSITIVE performance at the time of calculation, his salary should receive a readjustment with a salary increase of 5%. Due to the logic behind the business, the ideal is not to return an adjustment value “X” by default. That way, we can create an exception in case in the future there is some new type of performance that we forgot to implement in our calculator. Implementing the readjustaSalario method (in the example, using Java), we can achieve a result similar to the following: The code above is functional. However, a week after implementation, let's assume that the team requested the creation of a new performance type: EXCELLENT. In this new condition, the employee who achieves an “excellent” performance receives a 10% salary increase. Being simple and straightforward, ENUM would be implemented with one more type, “EXCELLENT”. Finally, the implementation of the readjustaSalario method would look similar to the example below: It is in scenarios similar to this that the Strategy pattern is applied: where the code can easily expand by creating a chain of IFs. In the example above, we're "taking it easy" ─ in the real world, one finds chained IFs at a much more common frequency, often in worse situations than ours. All of this impairs code readability and is not good practice. And how can we implement the Strategy in this case? There are several ways to solve a problem with Strategy, most of them involve implementing an interface or an abstraction. In our example, things are much simpler thanks to our ENUM. Probably, until now, our implementation of Performance was as follows: From then on, when we implement an abstract method inside our ENUM, all the different types inside it will require an implementation, causing a compile-time error if this requirement is not met. met, forcing the developer to implement the method. And so we can change the way our calculator returns the employee's salary adjustment. This makes reading the code and maintaining it immensely easier, making it simpler. This process must follow the SOLID principles (five principles of Object Oriented Programming). Take the opportunity to read our article about one of SOLID's most important principles: Single Responsibility Principle. After applying the Strategy, basically, as long as the fundamental business rule doesn't change, we don't even need to touch our “Calculator” anymore. As we are sure that the returnReajusteSalarial method has its proper implementation depending on the type of performance, we also guarantee that the scenario described previously does not exist, where the developer forgot to implement the adjustment calculation. It is important to emphasize that this is not the only way to implement the Strategy design pattern, but it is a great way to exemplify how it is easier to implement it in our code than you might think. Author's Opinion on the Strategy Project Pattern Even though it is often confused because it seems complex, Strategy is much simpler to implement than it seems and could very well be seen more often in the code of various object-oriented systems. During development, we can sometimes end up creating the wrong idea that trying to apply Design Patterns is time consuming. In fact, once you know and master Design Patterns, they only add to the speed and elegance of your solution. Design patterns facilitate development and make code evolution and maintainability simpler. And you, have you already applied the Strategy to any of your codes? What did you think of this design pattern?