<?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 Lucas Ennouchi on Medium]]></title>
        <description><![CDATA[Stories by Lucas Ennouchi on Medium]]></description>
        <link>https://medium.com/@ennoucas?source=rss-e9bce8e6a08a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*BrrA5CpulRt-GDsC-uX17g.jpeg</url>
            <title>Stories by Lucas Ennouchi on Medium</title>
            <link>https://medium.com/@ennoucas?source=rss-e9bce8e6a08a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 11:47:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ennoucas/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[Engineering with Purpose: Why ‘Why’ Matters More Than Metrics]]></title>
            <link>https://ennoucas.medium.com/engineering-with-purpose-why-why-matters-more-than-metrics-c604718b2a6c?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c604718b2a6c</guid>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[metrics]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[why]]></category>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Sat, 04 Jan 2025 14:10:21 GMT</pubDate>
            <atom:updated>2025-01-05T08:56:16.585Z</atom:updated>
            <content:encoded><![CDATA[<h4>How Purpose, Alignment, and Leadership Redefine Success Beyond Metrics</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pHmVTmb6M-1yecjVTIUAJA.jpeg" /><figcaption>Image generated with Dall-E</figcaption></figure><p><em>This article is available for free members with this link: </em><a href="https://ennoucas.medium.com/engineering-with-purpose-why-why-matters-more-than-metrics-c604718b2a6c?sk=fbd4c4716f308c62141f0075edbb9e1a"><em>https://ennoucas.medium.com/engineering-with-purpose-why-why-matters-more-than-metrics-c604718b2a6c?sk=fbd4c4716f308c62141f0075edbb9e1a</em></a></p><p>As the year draws to a close, there’s a moment I await with both anticipation and dread: the annual retrospective. It’s a ritual — a time for my team and me to review the highs and lows of the last twelve months. This year was no different. We delivered dozens of new applications and services, stabilized critical systems, and embraced modern development practices. At a glance, our scorecard looked impressive.</p><p>But as we dug deeper, cracks began to show. Systems reliability wasn’t where we wanted it to be. Our lead times dragged behind targets. Releases happened, but often with a side order of stress. Something felt… off.</p><p>I couldn’t shake a quote from Friedrich Nietzsche: “He who has a why to live for can bear almost any how.” It struck me that while we were constantly debating the <em>how</em> — how can we deploy faster, how can we stabilize our systems, how can we meet our KPIs — we hadn’t asked the bigger question: <em>“Why does this work matter in the first place?”</em></p><h3>When the “Why” Vanishes, So Does the Spark</h3><figure><img alt="Goodhart&#39;s Law" src="https://cdn-images-1.medium.com/max/800/0*nlRWJURTwMGT46fd" /><figcaption><a href="https://sketchplanations.com/goodharts-law">https://sketchplanations.com/goodharts-law</a></figcaption></figure><p>There’s a principle in economics called Goodhart’s Law, and it goes like this: <em>“When a measure becomes a target, it ceases to be a good measure.”</em> It’s hard to imagine a philosophy better suited to software engineering metrics — especially when I think back to the system we designed to track team performance.</p><p>The idea seemed sound at the time. We’d assign KPIs to keep teams accountable and reward improvement. We’d measure the famous DORA metrics plus other metrics like test coverage. This metric for example, was meant to encourage teams to write robust, meaningful tests that would catch defects early.</p><p>But as Goodhart’s Law warns, the moment test coverage became a KPI, it stopped reflecting its original goal. Some teams, under pressure to hit arbitrary coverage percentages, resorted to writing empty tests — tests that existed solely to satisfy the coverage tool but, in reality, asserted absolutely nothing. Instead of verifying logic or protecting against regressions, these tests padded numbers on a dashboard.</p><p>That wasn’t the only problem. Teams maintaining legacy systems — 10-year-old beasts with spaghetti code — felt demoralised. The targets weren’t fair to their reality. Motivation waned. Meetings became debates over how to reach KPIs rather than discussions about the bigger picture.</p><p>What was missing? The <em>why.</em> Why were we improving these systems? Why were we adopting new practices? The answers — if they existed — weren’t visible to the engineers doing the work. Without a clear purpose, the metrics became hollow.</p><h4>The Power of Purpose: “Why” as a Compass</h4><p>Simon Sinek, in his book <a href="https://simonsinek.com/books/start-with-why/"><em>Start with Why</em></a>, argues that people don’t buy <em>what</em> you do or <em>how</em> you do it; they buy <em>why</em> you do it. It’s not just a business mantra — it’s biology. The “why” aligns with the limbic brain, the part of us that drives emotions, loyalty, and decision-making.</p><p>When software engineers understand the purpose behind the work, they feel part of something greater. They stop asking, “How do I meet this deadline?” and start asking, “How can I make this meaningful?”. In essence they hold a compass, a shared purpose.</p><h4>Rethinking Metrics: From KPIs to OKRs</h4><p>Improving alignment and meaning starts with how we define success. Traditional metrics — KPIs — often miss the mark when it comes to purpose. They tell us <em>what</em> to aim for but rarely explain <em>why</em>. This is where OKRs (Objectives and Key Results) come in. Unlike KPIs, OKRs start with the objective — the purpose. For instance:</p><ul><li>Objective: Empower developers to deploy features faster without sacrificing quality.</li><li>Key Results: Decrease mean time to deploy by X%. Increase automated test coverage by Y%.</li></ul><p>By framing the work around the “why,” OKRs motivate engineers to contribute to something larger than themselves. It’s not about ticking boxes; it’s about solving problems that matter.</p><p>Now, how do we build alignment around these OKRs? Transparency of course!</p><h4>Cutting Through the Noise: Simplifying “Why” Across Layers</h4><p>Big companies like the one I work for often have layers upon layers — teams, divisions, projects, programs, and executives. Too often, the “why” gets lost in translation.</p><p>Take software engineers, for example. Many are several steps removed from the conversations about budgets or profitability that drive decision-making. In my experience, this separation is common in large organizations, but it’s problematic. Every company purpose — no matter how noble — is ultimately tied to profitability. My background in consulting taught me that missed deadlines or budget overruns aren’t just operational hiccups — they lead to visible consequences and cascading repercussions for a business.</p><p>Yet developers sometimes remain unaware of the original purpose. The reasons why a given project is critical to achieving organizational goals or why certain features must be prioritized are not shared to them. Without that understanding, work can feel like an endless series of tickets — disconnected from any larger meaning. They lack motivation</p><p>The answer lies in cutting through the noise. Instead of burying the “why” beneath layers of management, bring everyone into the conversation.</p><p>One leader who champions this approach is Jensen Huang, CEO of NVIDIA. Huang famously invites all employees to meetings where OKRs are discussed, and decisions are made. No one is left in the dark. As he re cently explained:</p><blockquote>I don’t do one-on-ones, and almost everything I say, I say to everybody all the time. I don’t really believe there’s any information that I operate on that only one or two people should hear about… I believe that when you give everybody equal access to information, that empowers people. And so that’s number one… Number two, if the CEO’s direct staff is 60 people, the number of layers you’ve removed in a company is probably something like seven.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//x.com/i/status/1796147169650761937&amp;image=" width="500" height="281" frameborder="0" scrolling="no"><a href="https://medium.com/media/96f307bb12764b95d4da091913cc44d3/href">https://medium.com/media/96f307bb12764b95d4da091913cc44d3/href</a></iframe><p>By breaking down silos, Huang wants everyone to understand <em>why</em> decisions happen — not just <em>what</em> needs to be done. When we hold onto purpose tightly at every level, it becomes the thread that weaves everyone together.</p><p>With purpose as our compass, let’s see how easily engineers can break down complex goals into actionable tasks and priotize what’s most important.</p><h3>Decomposing Purpose into Actionable Tasks</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*9jb94THrWZlrG13x" /><figcaption>The One Thing, Gary Keller</figcaption></figure><p>In Gary Keller’s <a href="https://the1thing.com/book/">The One Thing</a>, he explains how focusing on one overarching goal allows you to break it down into smaller, actionable steps. This mindset is invaluable in connecting purpose with execution in engineering teams. Let’s take an example from our work: building user trust as the backbone of our bank’s reputation. This is our “one thing,” our ultimate purpose. Now let’s decompose it into actionable tasks:</p><ol><li><strong>Why is user trust critical?</strong> Because trust ensures customer retention and loyalty, which are essential for sustainable growth.</li><li><strong>What threatens user trust?</strong> Security vulnerabilities, operational failures, or lack of engineering rigor that could harm users or damage our reputation.</li><li><strong>How do we mitigate these threats?</strong> By ensuring robust engineering practices, such as transitioning from DevOps to DevSecOps, integrating vulnerability scanning into CI/CD pipelines, and conducting thorough quality checks.</li><li><strong>What specific actions are required?</strong> • Embedding security earlier in the development lifecycle. • Implementing tools for automated vulnerability scanning in CI/CD pipelines. • Establishing a culture of engineering excellence through rigorous testing and validation processes.</li><li><strong>What’s at stake if we don’t act?</strong> Let&#39;s take British Airways data breach as a reminder. In 2018, they exposed the personal information (including credit card numbers!) of over 400,000 customers due to inadequate safeguards. The fallout included regulatory fines of £20 million and long-term reputational harm. We can also look beyond software engineering and find stark examples of how lapses in engineering rigour can lead to catastrophic consequences. A year ago, an Alaska Airlines Boeing 737 Max 9 experienced <a href="https://asia.nikkei.com/Business/Transportation/Boeing-under-scrutiny-as-report-says-Alaska-Airlines-737-Max-was-missing-bolts">an inflight blowout of a door panel because bolts were missing</a> — an issue traced back to poor quality control during assembly. This is just one in a series of incidents that have raised serious concerns about Boeing’s engineering practices. The crashes of two 737 Max planes in 2018 and 2019, which were tied to flawed automated systems and insufficient testing, are stark reminders of what happens when engineering rigor is compromised. These failures didn’t just damage Boeing’s reputation; they endangered lives. Both cases show how lapses in engineering or security practices can have devastating consequences — not just for operations or reputation, but for the people who depend on us.</li></ol><p>This decomposition process not only clarifies why each action matters but also ensures alignment between high-level goals and daily tasks. By tying every task back to the overarching purpose — in this example, user trust — we can make sure that purpose serves as a compass for our teams and helps us prioritise by ensuring we never lose sight of what truly matters.</p><h3>Final Thoughts</h3><p>I wanted to write this article after spending the past year asking myself the same question: How can I help my teams reconnect with the “why”? As a tech lead, I’ve come to appreciate the power of that small, three-letter word. Time and again, I’ve seen how losing sight of purpose leads to misaligned discussions, meetings, or even entire applications — regardless of the company’s size or the engineer’s experience.</p><p>Purpose isn’t just a feel-good buzzword. It’s the engine of great engineering. It transforms coding into craftsmanship, maintenance into mastery, and metrics into meaning. As we step into 2025, the next time you stand before your team — or your keyboard —don&#39;t just ask what you’re building. Ask <em>why.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c604718b2a6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adopting trunk-based development in a bank]]></title>
            <link>https://ennoucas.medium.com/adopting-trunk-based-development-in-a-bank-d02550374e94?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d02550374e94</guid>
            <category><![CDATA[trunk-based-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[banking]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Mon, 02 Oct 2023 10:16:19 GMT</pubDate>
            <atom:updated>2023-10-09T21:31:13.529Z</atom:updated>
            <content:encoded><![CDATA[<h4>Demystifying Misconceptions and Embracing Agility — A Lead Software Engineer’s Journey</h4><figure><img alt="Example of coding" src="https://cdn-images-1.medium.com/max/1024/1*DD7o72UleSUwhhx9_lDptQ.png" /></figure><p>If you work in software engineering, there’s a high chance that you’ve heard of trunk-based development (TBD). However, in regulated industries like banking, adopting TBD is often considered impossible or reserved for fintech companies. In this article, I want to demystify the transition to TBD in the banking industry (how to overcome the strict rules and controls in place from the days of coding in Cobol) and dispel the misconceptions surrounding it (developers being seen as cowboys without any oversight).</p><p>As a lead software engineer who has successfully implemented TBD, I can assure you that it is indeed possible for any organization to embrace this approach.</p><h3>Back to the basics</h3><p>TBD is a source control branching model that has gained popularity in the last 20 years. Instead of using long-living branches like “develop” or “hotfixes,” developers merge their changes directly into the main branch, also known as trunk. This frequent merging, usually at least once a day, reduces the distance between developers code and the shared branch to a minimum, minimizing issues that arise from delayed merges.</p><blockquote>“Branches create distance between developers, and we do not want that.” — Frank Compagner, Guerrilla Games</blockquote><p>In other words, the longer developers wait before merging their changes, the more challenging it becomes to integrate them smoothly.</p><h3>One goal: release readiness</h3><p>With TBD, any code committed should be ready to go to production at any time. This might seem counterproductive at first, as you may wonder how upcoming or incomplete features can be pushed to the main branch. The key is to figure out how to release hidden or silent features without impacting the ones currently in use. Here are some impactful strategies we have employed:</p><ol><li>Utilise <strong>abstraction layers</strong> in your code to differentiate implementation layers. By making the layers independent of each other, you can substitute them without affecting the rest.</li><li><strong>Simplify your stories</strong> and divide them into smaller chunks so that developers can finish them within a day</li><li><strong>Version your APIs</strong> so that developers can add new features or improve existing ones without disrupting current users and services.</li><li>Use <strong>feature flags</strong> to enable or disable specific capabilities of the application. Diverse types of feature flags can be implemented, such as build flags (ex: configuration file), boot flags (ex: environment variables), and runtime flags (ex: user permissions), to provide flexibility and control.</li><li>Ensure <strong>no downtime</strong> during releases. Your application should remain accessible to users even while new features are being deployed.</li></ol><blockquote>“Simplicity is important because it enables locality. Locality in our code is what keeps systems loosely coupled, enabling us to deliver features faster.” — The Unicorn Project, Gene Kim</blockquote><h3>Branching strategy: only one long living branch</h3><p>When applying the concepts mentioned above, it becomes easier to have a single long-living branch. Short-lived branches can still be used for specific purposes such as release branches, feature branches, or bug fixes. Our team has found success with the following strategy:</p><ul><li>We use CI pipelines to tag any push to the trunk that passes the required checks.</li><li>These tags serve as containers for what is being released to production, as opposed to deploying directly from the trunk.</li><li>In case of production fixes, we branch out of the latest tag released and merge the fix back to the trunk as soon as possible. <em>NB: an alternative (probably better way) would be to fix directly in trunk and </em><a href="https://git-scm.com/docs/git-cherry-pick"><em>cherry-pick </em></a><em>in the bug-fix branch</em></li></ul><h3>Code reviews without pull requests</h3><figure><img alt="Cowboy coder" src="https://cdn-images-1.medium.com/max/530/1*AvQ315K2QClFBdX22wpfKw.png" /><figcaption>With TBD, developers are just cowboys with no sheriff in town to prevent them from shooting bullets in production! Wait, what!?</figcaption></figure><p>In regulated industries like banking, code reviews are crucial. While pull requests offer an easy and trackable way to review code, some misconceptions arise when it comes to TBD. One of them is that regulations specify a minimum number of approvers for code going to the main branch while TBD loosen all controls.</p><p>However, it is important to note that regulations only require that any artifact released into production should be attested by a second pair of eyes. So, here are two alternative and complementary approaches to evidence source code attestation without pull/merge requests:</p><ul><li><strong>Pair programming:</strong> With pair programming, two developers work together, ensuring that the review happens while coding, not after completion. This approach respects the 4-eye principle and eliminates the need for additional approvals. Each commit can mention the names of the two developers involved, indicating their roles as the main developer and the reviewer:</li></ul><blockquote>Katherine/Harry: JIRA-1234 — add a rule to the api gateway for the subscribe service</blockquote><ul><li><strong>Script-generated evidence</strong>: A script can generate evidence of source code review, which is provided before releasing to production rather than before merging to the trunk. This script can be incorporated into your continuous delivery (CD) pipeline, automatically attaching the report to change requests. It list all commits between two tags and can automatically mark most as approved (if merged to trunk with pair programming or pull request) or require manual approval for exceptional cases.</li></ul><p>By adopting this, financial institutions can ensure code attestation compliance while embracing the benefits of trunk-based development.</p><p>As for code reviews per say, it is defined by <a href="https://www.mas.gov.sg/-/media/MAS/Regulations-and-Financial-Stability/Regulatory-and-Supervisory-Framework/Risk-Management/TRM-Guidelines-18-January-2021.pdf">MAS guidelines</a> as “a systematic and methodical examination of the source code of an application, with the objective of finding code errors, poor coding practices or software defects”. Let’s explore in the following sections how TBD actually enforces rigorous processes and mindset .</p><h3>Shorten the feedback loop with Continuous Integration</h3><p>Software engineers, like all humans, are not perfect (are we?). Even with the best commitment and rigor to avoid breaking the build, trunk-based development (TBD) inevitably opens a door for bugs to creep into the main branch. To minimize this risk, it’s crucial to <strong>shorten the feedback loop</strong> and run all necessary checks before our easily distracted minds forget that we pushed something in the first place!</p><p>So, how can we achieve this without turning into overwhelmed and forgetful developers? Here are some key practices for effective continuous integration:</p><ol><li>Build a strong test suite (units tests, regression tests, you name it…!) that you trust, and automatically run it with a CI tool every time you push to the main branch. Ideally, you should receive the test results within 10 minutes (or even better, 5 minutes) after the push. The bigger the team, the more important this quick feedback becomes to prevent conflicts and catch issues early.</li><li>If the main branch is broken, make it a priority for developers to drop whatever they’re doing and fix it as soon as possible. Remember, the longer you wait, the worse it gets!</li><li>Don’t aim for 100% test coverage. That’s not the goal. Instead, focus on trusting your test suite and covering all the core business logic and most of the edge cases. It’s about quality, not quantity!</li><li>Ensure that the same tests run locally on developers’ machines, regardless of their operating systems, to catch any potential issues early on. Consistency is key!</li><li>Leverage the commit checks provided by your IDE (example with <a href="https://www.jetbrains.com/help/idea/performing-tests.html#run-tests-after-commit">IntelliJ</a>) or git hooks (check out <a href="https://github.com/typicode/husky">husky</a>), such as pre-push, pre-commit, or post-commit, to ensure that all tests pass before you push your changes. It’s all about shifting left.</li></ol><h3>Go further with Continuous Delivery</h3><p>To further shorten the feedback loop, TBD motivated us to build continuous delivery (CD) pipelines. In complex ecosystems with multiple services, databases, and security layers, replicating all the specificities of an integrated environment in CI pipelines becomes challenging. Automating the deployment to a quality assurance (QA) environment on every commit allows us to run integration tests promptly. Here are some additional tips for effective CD:</p><ol><li>Include post-deployment and end-to-end tests as part of your CD pipelines to catch any issues that may arise after the deployment.</li><li>Prioritize testing scenarios that are not covered by unit tests (network issues, bad configuration, certificate issues etc.). Your unit tests should already cover a significant portion of the codebase.</li><li>Utilize tools like <a href="https://learning.postman.com/docs/writing-scripts/test-scripts/">Postman</a> to write API tests and <a href="https://learning.postman.com/docs/collections/using-newman-cli/command-line-integration-with-newman/">Newman</a> to execute them within your CD pipelines. Generating reports with <a href="https://www.npmjs.com/package/newman-reporter-allure">Allure</a> and hosting them with Jenkins provide valuable insights into the test results.</li><li>Consider using Postman tests with tools like <a href="https://k6.io/blog/load-testing-with-postman-collections/">K6</a> for load testing, ensuring your application can handle high traffic and deliver a seamless user experience.</li></ol><h3>Trust, the pillar of TBD</h3><figure><img alt="Trust me, I&#39;m an engineer" src="https://cdn-images-1.medium.com/max/408/1*PzP9JCDZV66u6kn5oLNPsw.png" /><figcaption><a href="https://i.pinimg.com/originals/48/9a/5e/489a5e26c0a576805ded962f5f29db48.jpg">https://i.pinimg.com/originals/48/9a/5e/489a5e26c0a576805ded962f5f29db48.jpg</a></figcaption></figure><p>Finally, it is essential for regulated companies to shift their focus from controlling every process to empowering self-discipline and trusting their engineering teams.</p><p>Trust is the pillar of TBD! Trust your teams to not break the trunk, trust them to write good tests that reduce the need for manual controls, trust them to monitor each environment and respond accordingly, trust them to release with minimal impact to users and the most important, allow them to fail and trust them to learn from their mistakes.</p><p>By fostering a culture of trust, teams can recover quickly from failures and embrace a mindset of continuous improvement.</p><blockquote>What made those teams great is that everyone trusted one another. It can be a powerful thing when that magic dynamic exists. — The Phoenix Project, Gene Kim</blockquote><h3>Embracing a Team of T-Shaped Engineers: Breaking Free from Segregation of Duties</h3><p>In order to foster trust within your team, it is essential to challenge the traditional mindset of segregation of duties (SoD). This approach often hinders developers from truly owning the products they create, as they are disconnected from the release process.</p><p>To overcome this limitation, a team cannot simply consist of individual developers. Instead, it should be comprised of T-shaped engineers, with each member possessing their own unique skills and inclinations. Some may excel in business analysis, others in coding, QA, ops and scripting, or support and maintenance. By adopting techniques such as pair programming, knowledge naturally flows across the team and new skills emerge. Delegation becomes unnecessary, as every team member becomes actively involved in all phases of the DevOps process — from design and implementation, to automating testing and releases, and even building tools and dashboards for monitoring and supporting the application.</p><p>By embracing a team of T-shaped engineers, you empower your team members to take ownership and contribute their expertise throughout the entire development lifecycle. This collaborative approach leads to increased efficiency, improved knowledge sharing, and ultimately, the delivery of high-quality software products.</p><figure><img alt="T shaped — Expert knowledge and good enough" src="https://cdn-images-1.medium.com/max/1024/1*V35N3hWGCfcT86Q3aJO_5A.png" /><figcaption><a href="https://dandypeople.com/blog/t-shaped-employees-and-how-to-grow-it-as-an-agile-leader/">https://dandypeople.com/blog/t-shaped-employees-and-how-to-grow-it-as-an-agile-leader/</a></figcaption></figure><h3>Conclusion</h3><p>In conclusion, transitioning to trunk-based development in the banking industry is not only possible but also highly beneficial. By implementing strategies such as abstraction layers, versioning APIs, using feature flags, and ensuring effective code reviews and continuous integration, organizations can achieve release readiness and streamline their development processes. Embrace the principles of TBD, trust your teams, and witness the transformation in your software engineering practices.</p><p>Remember, as lead software engineers, we have the power to demystify misconceptions, convince others, and drive positive change. Let’s continue to advocate for the adoption of trunk-based development and empower our teams to thrive in the ever-evolving world of software engineering.</p><h4>Resources</h4><ul><li><a href="https://trunkbaseddevelopment.com/">https://trunkbaseddevelopment.com/</a></li><li><a href="https://www.npmjs.com/package/newman-reporter-allure">https://www.npmjs.com/package/newman-reporter-allure</a></li><li><a href="https://learning.postman.com/docs/collections/using-newman-cli/command-line-integration-with-newman/">https://learning.postman.com/docs/collections/using-newman-cli/command-line-integration-with-newman/</a></li><li><a href="https://learning.postman.com/docs/writing-scripts/test-scripts/">https://learning.postman.com/docs/writing-scripts/test-scripts/</a></li><li><a href="https://cloud.google.com/architecture/devops/devops-tech-trunk-based-development">https://cloud.google.com/architecture/devops/devops-tech-trunk-based-development</a></li><li><a href="https://k6.io/blog/load-testing-with-postman-collections/">https://k6.io/blog/load-testing-with-postman-collections/</a></li><li><a href="https://www.jetbrains.com/help/idea/performing-tests.html#run-tests-after-commit">https://www.jetbrains.com/help/idea/performing-tests.html#run-tests-after-commit</a></li><li><a href="https://www.goodreads.com/book/show/17255186-the-phoenix-project">https://www.goodreads.com/book/show/17255186-the-phoenix-project</a></li><li><a href="https://www.goodreads.com/book/show/44333183-the-unicorn-project?ref=nav_sb_ss_1_15">https://www.goodreads.com/book/show/44333183-the-unicorn-project?ref=nav_sb_ss_1_15</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d02550374e94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Aliases in React, Jest and VSCode]]></title>
            <link>https://ennoucas.medium.com/aliases-in-react-jest-and-vscode-288df437e7e5?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/288df437e7e5</guid>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[alias]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[webpack]]></category>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Sun, 19 Dec 2021 10:12:06 GMT</pubDate>
            <atom:updated>2021-12-19T13:54:32.523Z</atom:updated>
            <content:encoded><![CDATA[<h4>Do not duplicate aliases, follow this tutorial instead. Bonus: make it compatible for React (CRA)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EqNygWjyVffHBPq4nQeqxw.png" /></figure><p>After the end of this tutorial you should will get nice aliases like @components/MyComponentinstead of ../../MyComponent .</p><p>This will be compatible for npm run start ,npm run build , npm run test (with JEST) and the auto imports in VSCode.</p><p>This is a tutorial for Typescript with (TSConfig) but it should also work with JSConfig.</p><h4>1. Aliases</h4><p>Create a file tsconfig.aliases.json (does not have to be this name) where we are going to store all of our aliases.</p><pre>{<br>  &quot;compilerOptions&quot;: {<br>    &quot;baseUrl&quot;: &quot;.&quot;,<br>    &quot;paths&quot;: {<br>      <strong>&quot;@api/*&quot;: [&quot;src/api/*&quot;],<br>      &quot;@assets/*&quot;: [&quot;src/assets/*&quot;],<br>      &quot;@components/*&quot;: [&quot;src/components/*&quot;],<br>      &quot;@contexts/*&quot;: [&quot;src/contexts/*&quot;],</strong><br>      ...<br>    }<br>  }<br>}</pre><p>As you can see it uses the object structure of tsconfig.</p><h4>2. VSCode: Add aliases to tsconfig.json</h4><p>Go to tsconfig.json and extends the configuration with our aliases:</p><pre>{<br>  <strong>&quot;extends&quot;: &quot;./tsconfig.aliases.json&quot;,</strong><br>  &quot;compilerOptions&quot;: {<br>    ...<br>  },<br>  &quot;include&quot;: [&quot;src&quot;]<br>}</pre><p><em>If you wonder why we don’t include the aliases in </em><em>tsconfig.jsondirectly, it is become they will get remove by typescript automatically when trying to compile.</em></p><p>At that time, VsCode should now auto import modules with your aliases.</p><h4>3. Webpack</h4><p>Webpack aliases are defined with <a href="https://webpack.js.org/configuration/resolve/#resolvealias">resolve.alias</a> in webpack.config.js</p><pre>alias: {<br>      Utilities: path.resolve(__dirname, &#39;src/utilities/&#39;),<br>      Templates: path.resolve(__dirname, &#39;src/templates/&#39;),<br>}</pre><p>Instead of duplicating our aliases, we’re going to take the ones defined in tsconfig.aliases.json and transform them to the syntax above.</p><p>Here is a sample function to do this:</p><pre>function getWebpackAliasesFromPaths(configPaths) {<br>  const alias = Object.entries(configPaths).reduce(<br>    (webpackAliases, [configAlias, configPathList]) =&gt; {<br>      const [aliasKey] = configAlias.split(&quot;/&quot;);<br>      const [relativePathToDir] = configPathList[0].split(&quot;/*&quot;);<br>      return {<br>        ...webpackAliases,<br>        [aliasKey]: path.resolve(__dirname, relativePathToDir),<br>      };<br>    },<br>    {}<br>  );<br>  return alias;<br>}</pre><p>Yourwebpack.config.js should look like:</p><pre>const aliases = require(&quot;./tsconfig.aliases.json&quot;)</pre><pre>module.export = {<br>  ...<br>  resolve: {<br>    ...<br>    <strong>alias: getWebpackAliasesFromPaths(aliases.compilerOptions.paths)<br></strong>    ...  <br>  }<br>  ...<br>} </pre><p><em>If you are using create-react-app, you can jump to CRACO set up instead.</em></p><h4>4. Jest</h4><p>Jest aliases are defined with moduleNameMapper in jest.config.js:</p><pre>&quot;moduleNameMapper&quot;: {<br>      ...<br>      &quot;^@components$&quot;: &quot;&lt;rootDir&gt;/shared/components/&quot;<br>}</pre><p>Same here, instead of duplicating aliases, we can use a function to transform our aliases OR use the provided one by ts-utils (pathsToModuleNameMapper):</p><pre>module.exports = {<br>  ...<br>  moduleNameMapper: {<br>    <strong>...pathsToModuleNameMapper(aliases.compilerOptions.paths, {<br>      prefix: &quot;&lt;rootDir&gt;/&quot;,<br>    })</strong>,<br>    ...<br>  },<br>  ...<br>}</pre><p><em>If you are using create-react-app, please continue to CRACO configuration.</em></p><h4>Using CRACO for create-react-app</h4><p><a href="https://github.com/gsoft-inc/craco">CRACO</a> is a configuration layer for create-react-app (CRA). It’s really useful for CRA as you can’t change much of the configuration without doing an npm run eject . When building or starting the server it will make sure to take the paths set up in TSConfig / JSConfig and include them in the webpack configuration.</p><h4>Use CRACO in package.json</h4><p>Add craco with npm install @craco/craco --save</p><p>Then, go to package.json and change your scripts to use craco instead of react-scripts</p><pre>...<br>&quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;craco start&quot;,<br>    &quot;build&quot;: &quot;craco build&quot;,<br>    &quot;test&quot;: &quot;craco test&quot;,<br>    &quot;eject&quot;: &quot;craco eject&quot;,<br>    ...<br>  }</pre><h4>Configure CRACO</h4><p>We’re going to add 2 configurations for CRACO: one for webpack, one for Jest. This is all done in craco.config.js to add to the root folder of your project.</p><p>Your craco.config.js file should look like:</p><pre>const path = require(&quot;path&quot;);<br>const { pathsToModuleNameMapper } = require(&quot;ts-jest/utils&quot;);<br>const aliases = require(&quot;./tsconfig.aliases.json&quot;)</pre><pre>function getWebpackAliasesFromPaths(configPaths) {<br>  const alias = Object.entries(configPaths).reduce(<br>    (webpackAliases, [configAlias, configPathList]) =&gt; {<br>      const [aliasKey] = configAlias.split(&quot;/&quot;);<br>      const [relativePathToDir] = configPathList[0].split(&quot;/*&quot;);<br>      return {<br>        ...webpackAliases,<br>        [aliasKey]: path.resolve(__dirname, relativePathToDir),<br>      };<br>    },<br>    {}<br>  );<br>  return alias;<br>}<br>module.exports = {<br>  jest: {<br>    configure: {<br>      ...<br>      moduleNameMapper: {<br>        <strong>...pathsToModuleNameMapper(aliases.compilerOptions.paths, {<br>          prefix: &quot;&lt;rootDir&gt;/&quot;,<br>        })</strong>,<br>        &quot;\\.(css|scss)$&quot;: `&lt;rootDir&gt;/src/__mocks__/styleMock.js`,<br>      },<br>      ...<br>    },<br>  },<br>  webpack: {<br>    alias: <strong>getWebpackAliasesFromPaths(aliases.compilerOptions.paths)</strong>,<br>  },<br>};</pre><p>Finally, configure Jest to use the CRACO config in jest.config.json:</p><pre>const { createJestConfig } = require(&quot;<a href="http://twitter.com/craco/craco">@craco/craco</a>&quot;);<br>const cracoConfig = require(&quot;./craco.config.js&quot;);<br>const jestConfig = createJestConfig(cracoConfig);<br>module.exports = jestConfig;</pre><p>That’s it! You should now have a fully functional environment for starting, building and testing your React application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=288df437e7e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What it takes to become a Salesforce AppExchange ISV]]></title>
            <link>https://ennoucas.medium.com/various-experiences-and-resources-as-a-salesforce-appexchange-isv-8d358d7173cd?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d358d7173cd</guid>
            <category><![CDATA[appexchange]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[package]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[marketing]]></category>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Sat, 27 Mar 2021 09:58:01 GMT</pubDate>
            <atom:updated>2021-08-29T13:45:13.395Z</atom:updated>
            <content:encoded><![CDATA[<h3>What it took to become a Salesforce AppExchange ISV</h3><p>Releasing <a href="https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000GBhfFUAT">Structur</a> on the Salesforce AppExchange marketplace has been a long journey. I (as sole entrepreneur) have spent 2 years developing it as a side project while working full time on Salesforce projects as an architect and dev lead. I garnered many tips, thoughts, experiences, skills that I thought could be useful for anybody considering it.</p><p>There is no particular order in this article. It will be updated times to times.</p><h3>Don’t underestimate Security Review</h3><p>Yes… it’s written everywhere and everyone who released an app will say so. Failing the security review happens. It can also be avoided. Here is why I failed it twice and what I learned from it:</p><ul><li>I have 9+ years of experience with Salesforce. I was too confident and made silly mistakes.</li><li>Four eyes principle: have your code reviewed by other Salesforce devs and architects.</li><li>Use source code analyser like <a href="https://pmd.github.io/">PMD</a>. Add it to your VS Code, your CI and CD builds etc. everywhere! So that you don’t miss something like <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm">sharing keywords</a> in your classes.</li><li>Checkmarx and other scanners can give False negative. You can still fail security review whereas these scans don’t detect anything wrong.</li><li>Salesforce can take up to 8 weeks to review your app. Average for me was 6 weeks. Make no promises to your prospects!</li><li>Write a security service class that you will use for EVERY DML, SOQL, and SOSL call. Don’t miss one!</li><li>Use ‘<a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm">escapeSingleQuotes</a>’ when using LIKE operator.</li><li>Start documenting your architecture and security patterns from the beginning.</li><li>Don’t wait to have all of your features and the perfect app for passing the security review. After you passed, subsequent security reviews are automatically approved for a year.</li><li>The questionnaire for security review is long. Keep all your answers somewhere, so you can reuse them when resubmitting your app.</li><li>It’s expensive… another reason for being meticulous!</li></ul><h3>2nd vs 1st generation package</h3><p>I wanted to use 2nd generation package and benefit from the numerous advantages of SFDX. It didn’t work. Here’s why:</p><ul><li>I am using protected objects and SFDX <a href="https://github.com/forcedotcom/cli/issues/368">fails</a> to create package versions after the first one.</li><li>Not enough support from Salesforce (<a href="https://github.com/forcedotcom/cli/issues/368">ticket</a> has been opened for 1 year)</li><li>Community of ISVs using 2nd generation package is very small (non-existent?)</li><li>Techno not ready yet for managed packages and ISVs.</li></ul><h3>Marketing. Marketing. Marketing</h3><p>The laws of B2B market are harsh. You spend hundreds of hours developing what you think will be the best tool for Salesforce users. Then you realize that in a crowded marketplace like the AppExchange you will have to excel in marketing your app. This is a long journey I just started and will make sure to keep updating this section.</p><ul><li>Salesforce Partner community has great <a href="https://partners.salesforce.com/s/education/appinnovators/market">marketing materials and tips</a></li><li>Hard to understand how SEO works within the AppExchange.</li><li><a href="https://twitter.com/appexchange">https://twitter.com/appexchange</a> and other Salesforce bots retweeted my posts and I gained new followers thanks to it</li><li>Gaining good traction from my LinkedIn network</li><li>Question 1: should I redirect prospects to my <a href="https://structur.app/">website</a> (I control SEO, retargetting) or my <a href="https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000GBhfFUAT">AppExchange listing</a>?</li><li>Question 2: should my website redirect to the AppExchange or to the installation package link?</li><li>Question 3: can I promote my non free app in the partner community?</li></ul><h3>What I’ve spent so far</h3><ul><li>Security review: 2700$</li><li>GSuite: 8$ / month</li><li>Development: 0$ / ~500h</li><li>Marketing: 0$ / ~10h</li></ul><h3>Resources, tools, skills I use everyday</h3><h4>Web</h4><ul><li>Vue JS and Nuxt for my <a href="https://structur.app/">showcase website</a></li><li><a href="https://content.nuxtjs.org/">Nuxt Content</a> for my <a href="https://support.structur.app/">support website</a>: I love it as I can embed this as support resources + release notes within my lightning component (iframe) and as the resources when installing the package. Huge differentiator!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1OqYmZgCw2NNziJrxP_WQ.png" /></figure><ul><li><a href="https://vercel.com/">Vercel</a> for hosting</li></ul><h4>Salesforce Partner Org</h4><ul><li>Checkout Management App (CMA) (with Stripe)</li><li>Licence Management App (LMA) for Feature Management App (FMA)</li><li><a href="https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000GBhfFUAT">Structur</a> for displaying my prospects with licences and features</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8aSu8pmdDIfrMc5RLVqFA.png" /></figure><ul><li><a href="https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3u00000MBdxBEAT">ISV hub</a> from Salesforce Labs</li><li><a href="https://structur.app/contact">Web to Lead</a> form</li></ul><h4>Package Development</h4><ul><li>Custom Features to enable premium options and extend limits</li><li>(Coming) Features to calculate usage of my app</li><li>Protected SObjects</li><li>Github Actions for CI/CD builds (SFDX, pmd checks etc.)</li><li>Release-it for automating versionning</li></ul><h4>Marketing</h4><ul><li>Sketch App for marketing materials</li><li>AppExhange Listing</li><li><a href="https://www.loom.com/">Loom</a> for videos</li><li>Google Analytics</li><li>Google search console</li><li>Tracking pixels</li><li>LinkedIn / Twitter</li><li>Friends, network etc.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d358d7173cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Journey with Salesforce DX Packages at Enterprise Scale (Part 2 — DevOps)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://ennoucas.medium.com/a-journey-with-salesforce-dx-packages-at-enterprise-scale-part-2-a44316941446?source=rss-e9bce8e6a08a------2"><img src="https://cdn-images-1.medium.com/max/1400/1*uBXld1M7wX2cB0AbuROnnw.png" width="1400"></a></p><p class="medium-feed-snippet">Learn the importance of preparing your DevOps teams when migrating to DX packages</p><p class="medium-feed-link"><a href="https://ennoucas.medium.com/a-journey-with-salesforce-dx-packages-at-enterprise-scale-part-2-a44316941446?source=rss-e9bce8e6a08a------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://ennoucas.medium.com/a-journey-with-salesforce-dx-packages-at-enterprise-scale-part-2-a44316941446?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a44316941446</guid>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Mon, 10 Feb 2020 21:49:45 GMT</pubDate>
            <atom:updated>2023-10-09T21:28:01.308Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A Journey with Salesforce DX Packages at Enterprise Scale (Part 1)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://ennoucas.medium.com/a-journey-with-salesforce-dx-packages-at-enterprise-scale-part-1-4095ec84f39a?source=rss-e9bce8e6a08a------2"><img src="https://cdn-images-1.medium.com/max/2600/1*ZpKp7Rf3DXqQw-PdM5pBaQ.png" width="2800"></a></p><p class="medium-feed-snippet">Learn how to design scalable Salesforce DX Packages before they become a burden</p><p class="medium-feed-link"><a href="https://ennoucas.medium.com/a-journey-with-salesforce-dx-packages-at-enterprise-scale-part-1-4095ec84f39a?source=rss-e9bce8e6a08a------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://ennoucas.medium.com/a-journey-with-salesforce-dx-packages-at-enterprise-scale-part-1-4095ec84f39a?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4095ec84f39a</guid>
            <category><![CDATA[sfdx]]></category>
            <category><![CDATA[dependencies]]></category>
            <category><![CDATA[second-generation]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[package]]></category>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Sun, 05 Jan 2020 20:38:55 GMT</pubDate>
            <atom:updated>2020-02-10T21:58:05.569Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Learn how to use Salesforce Named Credentials]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://ennoucas.medium.com/working-with-salesforce-named-credentials-example-with-google-calendar-api-61fa6588167a?source=rss-e9bce8e6a08a------2"><img src="https://cdn-images-1.medium.com/max/2533/1*dExBlTCjCleAkn0-QjpYAw.png" width="2533"></a></p><p class="medium-feed-snippet">Example with Google Calendar API</p><p class="medium-feed-link"><a href="https://ennoucas.medium.com/working-with-salesforce-named-credentials-example-with-google-calendar-api-61fa6588167a?source=rss-e9bce8e6a08a------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://ennoucas.medium.com/working-with-salesforce-named-credentials-example-with-google-calendar-api-61fa6588167a?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/61fa6588167a</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[apex]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Wed, 10 Apr 2019 10:22:26 GMT</pubDate>
            <atom:updated>2020-01-04T11:34:55.708Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Css classes for SLDS Icons — An easier way to use them!]]></title>
            <link>https://ennoucas.medium.com/easier-way-to-work-with-salesforce-lightning-design-systems-icons-ba2726fcca1f?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba2726fcca1f</guid>
            <category><![CDATA[icons]]></category>
            <category><![CDATA[font-awesome]]></category>
            <category><![CDATA[salesforce-lightning]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[fonts]]></category>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Tue, 15 May 2018 12:08:11 GMT</pubDate>
            <atom:updated>2019-03-16T19:45:44.787Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dMIZ2MIkXirNMQwC1ZKFnA.png" /><figcaption>SLDS Icons</figcaption></figure><p>The way SLDS invites you to use their icons pack has always disappointed me. First, you have to use a complex combination of paths and classes to get the right shape, color and size for your icons. Then, the SVG tag became forbidden with Locker Service and you add to use their lightning:icon component with which you lose total control and rely on the attributes available for you.</p><pre>&lt;span class=&quot;slds-icon_container slds-icon-utility-announcement&quot; title=&quot;Description of icon when needed&quot;&gt;<br>  &lt;svg class=&quot;slds-icon slds-icon-text-default&quot; aria-hidden=&quot;true&quot;&gt;<br>    &lt;use xlink:href=&quot;/assets/icons/utility-sprite/svg/symbols.svg#announcement&quot;&gt;&lt;/use&gt;<br>  &lt;/svg&gt;<br>  &lt;span class=&quot;slds-assistive-text&quot;&gt;Description of icon when needed&lt;/span&gt;<br>&lt;/span&gt;</pre><h3>Use a font instead of SVG</h3><p>I was looking for a better and easier to includes these beautiful icons into my projects like I used to do with <a href="https://fontawesome.com/">font-awesome</a>. Then I found this excellent tool <a href="https://icomoon.io/">IcoMoon</a> which allows me to generate a font from SVG files. After some rework on the icons (same scale, reset colors), I’ve managed to create my own font.</p><p>You just have to import the stylesheet and then add prefix icon names with slds-icon-</p><p>Icon names are referenced <a href="https://www.lightningdesignsystem.com/icons/">here</a>.</p><h3>Example</h3><pre>&lt;i class=&quot;slds-icon-adduser&quot; style=&quot;font-size:24px&quot;/&gt;<br>&lt;i class=&quot;slds-icon-account&quot; style=&quot;color:#2ecc71&quot;/&gt;</pre><p>You now have control of the size, the color, the background, the shape… Everything you want to do with them.</p><p><a href="https://github.com/ennoucas/slds-icons-font"><em>Here</em></a><em> is my repository with the fonts and the stylesheet. Enjoy !</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba2726fcca1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Salesforce Lightning application with Vue.js and Webpack — PART 2]]></title>
            <link>https://ennoucas.medium.com/salesforce-lightning-application-with-vue-js-and-webpack-part-2-af0071347274?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/af0071347274</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[salesforce-lightning]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[salesforce]]></category>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Wed, 02 May 2018 14:26:25 GMT</pubDate>
            <atom:updated>2020-01-04T10:42:24.327Z</atom:updated>
            <content:encoded><![CDATA[<h3>Salesforce Lightning application with Vue.js and Webpack — PART 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-i3f2uiPws8Kxb8fJSRvtA.png" /></figure><p>In the <a href="https://medium.com/@ennoucas/creating-a-salesforce-application-with-vue-js-and-webpack-part-1-17c726484f1f">first part</a> of this story, we created a Vue JS application using Webpack and a Progressive Web App template. Then we displayed this application within Salesforce thanks to the Lightning component <em>lightning:container.</em></p><p>Now that our template application is loading fine in Salesforce, we are going to improve it so we can load real data (accounts) from Salesforce.</p><p>In order to achieve that we’ll :</p><p><strong>1. Build the application locally </strong>with<strong> :</strong></p><ul><li><a href="https://router.vuejs.org/en/"><strong>Vue Router</strong></a><strong> </strong>to map our components to the routes</li><li><a href="https://vuex.vuejs.org/en/intro.html"><strong>Vuex</strong></a><strong>, </strong>a “State Management Pattern”</li><li><strong>API file</strong> that will handle calls from the client and have two different behaviors depending if we are in development mode or production mode.</li></ul><p><strong>2. Interact with Salesforce Data</strong> thanks to :</p><ul><li><strong>Lightning container NPM module </strong>to call Apex methods from our Vue app.</li></ul><h3><strong>1. Building the application locally</strong></h3><h4>Vue Router</h4><p>Let’s create our <strong>AccountList</strong> component to display the list of accounts.</p><p>In the folder “src/components” where there is already the “Hello.vue” file (that came with the template), create a file called “AccountList.vue” :</p><pre>&lt;template&gt;<br>  &lt;h1&gt;Account List Component&lt;/h1&gt;<br>&lt;/template&gt;</pre><p>We want to make it our landing component for the default path “/”. We can do that by modifying the <strong>Router</strong> instance that maps the routes and our Vue components. Edit the file “src/router/index.js” to replace the Hello component by our AccountList component:</p><pre>import Vue from &#39;vue&#39;<br>import Router from &#39;vue-router&#39;<br>import AccountList from &#39;@/components/AccountList&#39;</pre><pre>Vue.use(Router)</pre><pre>export default new Router({<br>  routes: [<br>    {<br>      path: &#39;/&#39;,<br>      name: &#39;AccountList&#39;,<br>      component: AccountList<br>    }<br>  ]<br>})</pre><p>Let’s clean our “src/App.vue<strong>”</strong> file a little bit :</p><pre>&lt;template&gt;<br>  &lt;div id=&quot;app&quot;&gt;<br>    &lt;main&gt;<br>      &lt;router-view&gt;&lt;/router-view&gt;<br>    &lt;/main&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><p>The <strong>App</strong> component is the default component loaded by your <strong>main.js</strong> file. The tag &lt;router-view&gt; displays the component mapped to the current route.</p><p>Great ! You should now the the list of accounts when loading your local application at “<a href="/service/localhost:8080">localhost:8080</a>”.</p><p><em>NB : if you’re local server is not running, you can start it with the command :</em></p><pre>$ npm run dev</pre><p>We are also going to prepare the route to display the account detail page. The route path will be “/:accountId”. This :accountId is a param of the $route attribute. So, callingthis.$route.params.accountId on route “/1234” should return <strong>1234</strong>.</p><p>Let’s create another component called<strong> AccountDetail.vue</strong> :</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;h1&gt;Account Detail : {{ accountId }}&lt;/h1&gt;<br>    &lt;router-link tag=&quot;button&quot; class=&quot;slds-button&quot; to=&quot;/&quot;&gt;Back&lt;/router-link&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  computed: {<br>    accountId () { return this.$route.params.accountId }<br>  }<br>}<br>&lt;/script&gt;</pre><p>Then, we’ll modify the “src/router/index.js” file to :</p><pre>import Vue from &#39;vue&#39;<br>import Router from &#39;vue-router&#39;<br>import AccountList from &#39;@/components/AccountList&#39;<br>import AccountDetail from &#39;@/components/AccountDetail&#39;</pre><pre>Vue.use(Router)</pre><pre>export default new Router({<br>  routes: [<br>    {<br>      path: &#39;/&#39;,<br>      name: &#39;AccountList&#39;,<br>      component: AccountList<br>    },<br>    {<br>      path: &#39;/:accountId&#39;,<br>      name: &#39;AccountDetail&#39;,<br>      component: AccountDetail<br>    }<br>  ]<br>})</pre><p>Now, if you go to “<a href="http://localhost:8080/#/1234">localhost:8080/#/1234</a>” you should see :</p><blockquote>Account Detail : 1234</blockquote><p>Finally, we can try using &lt;router-link to=&quot;1234&quot;&gt;Account 1234&lt;/router-link&gt; to create an “a” tag to go to the detail page of an account 1234 :</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;h1&gt;Account List Component&lt;/h1&gt;<br>    &lt;router-link to=&quot;1234&quot;&gt;Account 1234&lt;/router-link&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><h4>Salesforce Lightning Design System (SLDS)</h4><p>For a better style, let’s install SLDS…</p><pre>$ npm install @salesforce-ux/design-system --save</pre><p>… and import it in the css of our <strong>App</strong> component :</p><pre>&lt;template&gt;<br>  &lt;div id=&quot;app&quot;&gt;<br>    &lt;main&gt;<br>      &lt;router-view&gt;&lt;/router-view&gt;<br>    &lt;/main&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><pre>&lt;style&gt;<br>  <a href="http://twitter.com/import">@import</a> url(https://medium.com/&#39;../node_modules/@salesforce-ux/design-system/assets/styles/salesforce-lightning-design-system.min.css&#39;);<br>&lt;/style&gt;</pre><h4>Vuex</h4><p>We are now ready to install Vuex to handle our front end data and share it across the application.</p><p>Run this command :</p><pre>$ npm install vuex --save</pre><p>We now need to instantiate our <strong>Store</strong> object. Create a file &quot;src/store/index.js&quot; (you probably have to create the &quot;store&quot; folder as well) :</p><pre>import Vue from &#39;vue&#39;<br>import Vuex from &#39;vuex&#39;</pre><pre>Vue.use(Vuex)</pre><pre>export const store = new Vuex.Store({<br>  state: {},<br>  getters: {},<br>  mutations: {},<br>  actions: {}<br>})</pre><p><em>NB : About the store object, I invite you to read this </em><a href="https://vuex.vuejs.org/en/"><em>documentation</em></a><em>.</em></p><p>Finally, include our store instance in our Vue by modifying the <strong>main.js </strong>file like that :</p><pre>import Vue from &#39;vue&#39;<br>import App from &#39;./App&#39;<br>import router from &#39;./router&#39;<br><strong>import { store } from &#39;./store&#39;</strong></pre><pre>Vue.config.productionTip = false</pre><pre>/* eslint-disable no-new */<br>new Vue({<br>  el: &#39;#app&#39;,<br>  router,<br>  <strong>store,</strong><br>  template: &#39;&lt;App/&gt;&#39;,<br>  components: { App }<br>})</pre><h4>API file</h4><p>OK, so now that our store is ready, let’s test the behavior of our application by mocking the client-server processing !</p><p>First, we need to create our api file at “src/api/accounts.js”</p><pre>const _accounts = [<br>  { id: &#39;1&#39;, name: &#39;Account 1&#39; },<br>  { id: &#39;2&#39;, name: &#39;Account 2&#39; },<br>  { id: &#39;3&#39;, name: &#39;Account 3&#39; }<br>]</pre><pre>export default {<br>  getAccounts (callback) {<br>    setTimeout(() =&gt; callback(_accounts), 100)<br>  }<br>}</pre><p>For now, <strong>getAccounts</strong> return a local variable. We’ll implement this function later to return real Salesforce data.</p><p>Then, we can modify our “src/store/index.js”</p><pre>import Vue from &#39;vue&#39;<br>import Vuex from &#39;vuex&#39;<br>import accountAPI from &#39;../api/account&#39;</pre><pre>Vue.use(Vuex)</pre><pre>export const store = new Vuex.Store({<br>  state: {<br>    accounts: null<br>  },<br>  getters: {<br>    getAccount: (state, {dispatch}) =&gt; id =&gt; {<br>      return state.accounts ? state.accounts.find(account =&gt; account.id === id) : {}<br>    }<br>  },<br>  mutations: {<br>    setAccounts: (state, payload) =&gt; { state.accounts = payload }<br>  },<br>  actions: {<br>    getAllAccounts: ({commit}) =&gt; {<br>      accountAPI.getAccounts(accounts =&gt; {<br>        commit(&#39;setAccounts&#39;, accounts)<br>      })<br>    }<br>  }<br>})</pre><p>At last, we can display these accounts in our <strong>AccountList</strong> component…</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;div class=&quot;slds-page-header slds-page-header_vertical&quot;&gt;<br>      &lt;div class=&quot;slds-media slds-has-divider_bottom-space&quot;&gt;<br>        &lt;div class=&quot;slds-media__body&quot;&gt;<br>          &lt;h1 class=&quot;slds-page-header__title&quot;&gt;Account List Component&lt;/h1&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>      &lt;ul&gt;<br>        &lt;li v-for=&quot;account in accounts&quot; :key=&quot;account.id&quot;&gt;<br>          &lt;router-link :to=&quot;account.id&quot;&gt;{{ account.name }}&lt;/router-link&gt;<br>        &lt;/li&gt;<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  computed: {<br>    accounts () { return this.$store.state.accounts }<br>  },<br>  created () {<br>    if (!this.accounts) this.$store.dispatch(&#39;getAllAccounts&#39;)<br>  }<br>}<br>&lt;/script&gt;</pre><p>…and in our <strong>AccountDetail</strong> component :</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;div class=&quot;slds-page-header slds-page-header_vertical&quot;&gt;<br>      &lt;div class=&quot;slds-media slds-has-divider_bottom-space&quot;&gt;<br>        &lt;div class=&quot;slds-media__body&quot;&gt;<br>          &lt;h1 class=&quot;slds-page-header__title&quot;&gt;{{ account.name }}&lt;/h1&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;slds-has-divider_bottom-space&quot;&gt;<br>        &lt;dl class=&quot;slds-dl_inline&quot;&gt;<br>          &lt;dt class=&quot;slds-dl_inline__label slds-text-color_weak&quot;&gt;Name:&lt;/dt&gt;<br>          &lt;dd class=&quot;slds-dl_inline__detail&quot;&gt;{{ account.name }}&lt;/dd&gt;<br>          &lt;dt class=&quot;slds-dl_inline__label slds-text-color_weak&quot;&gt;Type:&lt;/dt&gt;<br>          &lt;dd class=&quot;slds-dl_inline__detail&quot;&gt;{{ account.type }}&lt;/dd&gt;<br>          &lt;dt class=&quot;slds-dl_inline__label slds-text-color_weak&quot;&gt;Phone:&lt;/dt&gt;<br>          &lt;dd class=&quot;slds-dl_inline__detail&quot;&gt;{{ account.phone }}&lt;/dd&gt;<br>          &lt;dt class=&quot;slds-dl_inline__label slds-text-color_weak&quot;&gt;Number Of Employees:&lt;/dt&gt;<br>          &lt;dd class=&quot;slds-dl_inline__detail&quot;&gt;{{ account.numberOfEmployees }}&lt;/dd&gt;<br>        &lt;/dl&gt;<br>      &lt;/div&gt;<br>      &lt;div&gt;<br>        &lt;router-link tag=&quot;button&quot; class=&quot;slds-button slds-button_neutral&quot; to=&quot;/&quot;&gt;Back&lt;/router-link&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  computed: {<br>    account () { return this.$store.getters.getAccount(this.$route.params.accountId) }<br>  },<br>  created () {<br>    if (!this.$store.state.accounts) this.$store.dispatch(&#39;getAllAccounts&#39;)<br>  }<br>}<br>&lt;/script&gt;</pre><p>Bravo! Your application should now show the list of accounts. Clicking on one of them should display the detail page of that account.</p><h3>2. Get and update Salesforce data</h3><p>We are ready to work with real data now. For that, we will need to create our apex controller, call our new server method “getAccounts” from our vue component and handle the results.</p><h4><strong>Apex Controller</strong></h4><p>Let’s create an Apex controller called <strong>VueController</strong> with a simple remote action that’s going to return us 10 accounts.</p><pre>global with sharing class VueController {<br>    <a href="http://twitter.com/RemoteAction">@RemoteAction</a><br>    global static Account[] getAccounts() {<br>        return [SELECT Id, Name, Phone, Type, NumberOfEmployees FROM Account Limit 10];<br>    }<br>}</pre><p><em>NB : I usually return a DTO here.. But for the simplicity of this article I will return records with their fields API names.</em></p><h4><strong>Manifest.json (do not miss that part!)</strong></h4><p>We need to make our VueController available to our vue app by declaring it in the <strong>manifest</strong> of our static resource. For that, create the file “/dist/manifest.json” :</p><pre>{<br>    &quot;landing-pages&quot; : [<br>        {<br>            &quot;path&quot;: &quot;index.html&quot;,<br>            &quot;apex-controller&quot;: &quot;VueController&quot;<br>        }<br>    ]<br>}</pre><p><em>NB : Thank you to Christophe Coenraets for this great </em><a href="https://developer.salesforce.com/blogs/2018/04/lightning-container-component-building-components-with-react-angular-and-other-libraries.html"><em>article</em></a><em> “ Lightning Container Component: Building Components with React, Angular, and Other Libraries”. It has plenty of examples and source code that were very useful ! Without this manifest.json file, Salesforce does not return any data and unfortunately no error either…</em></p><h4><strong>Lightning Container NPM module</strong></h4><p>To interact with Salesforce server from our Vue app, Salesforce has created a very helpful <a href="https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/container_api_reference.htm">lightning container NPM module</a> that allows us to communicate with the lightning container component. Here is the command to install it:</p><pre>$ npm install lightning-container --save</pre><p>Next, let’s modify our api file “/src/api/accounts.js” and call our getAccounts apex method :</p><pre>import LCC from &#39;lightning-container&#39;</pre><pre>const _accounts = [<br>  { id: &#39;1&#39;, name: &#39;Account 1&#39; },<br>  { id: &#39;2&#39;, name: &#39;Account 2&#39; },<br>  { id: &#39;3&#39;, name: &#39;Account 3&#39; }<br>]</pre><pre>export default {<br>  getAccounts (callback) {<br>    if (process.env.NODE_ENV === &#39;production&#39;) {<br>      LCC.callApex(<br>        &#39;VueController.getAccounts&#39;,<br>        (result, event) =&gt; {<br>          if (event.status) {<br>            callback(result.map(account =&gt; {<br>              return {<br>                id: account.Id,<br>                name: account.Name,<br>                type: account.Type,<br>                numberOfEmployees: account.NumberOfEmployees<br>              }<br>            }))<br>          } else if (event.type === &#39;exception&#39;) {<br>            console.log(event.message + &#39; : &#39; + event.where)<br>          } else {<br>            console.log(&#39;Unknown Error&#39;, event)<br>          }<br>        },<br>        {escape: false}<br>      )<br>    } else {<br>      setTimeout(() =&gt; callback(_accounts), 100)<br>    }<br>  }<br>}</pre><h3><strong>TADA !</strong></h3><p>If you build and upload your Vue app as a static resource you should now have a fully working Vue application :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*SQpCpCGiXv70kBabCzUjag.gif" /><figcaption>Demo of the application</figcaption></figure><p>I hope your liked this article. Don’t hesitate to comment it I will try my best to answer you quickly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af0071347274" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Salesforce Lightning application with Vue.js and Webpack — PART 1]]></title>
            <link>https://ennoucas.medium.com/creating-a-salesforce-application-with-vue-js-and-webpack-part-1-17c726484f1f?source=rss-e9bce8e6a08a------2</link>
            <guid isPermaLink="false">https://medium.com/p/17c726484f1f</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-lightning]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Lucas Ennouchi]]></dc:creator>
            <pubDate>Thu, 08 Mar 2018 04:46:09 GMT</pubDate>
            <atom:updated>2020-01-04T10:40:22.315Z</atom:updated>
            <content:encoded><![CDATA[<h3>Salesforce Lightning application with Vue.js and Webpack — PART 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qg9VpYZzU2WIODgbGCKm4A.png" /></figure><p>Since Salesforce has released the <a href="https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/intro_framework.htm">Lightning Component Framework</a>, the need to use third party frameworks decreased drastically. Indeed, by using a “stateful client and stateless server architecture that relies on JavaScript on the client side to manage UI component metadata and application data”, they provided a faster and modern way to build beautiful user interfaces.</p><p>However, building an entire application on Lightning may still be painful for several reasons :</p><ul><li><em>Navigation</em>. Let’s say you have dozen of screens in your application with multiple paths between them. One of the solutions I prefer is to have a top “Navigator” component that would handle application events and display or hide components dynamically. It works. But it is hardly sustainable with an application that keeps growing with more and more nested components over time.</li><li><em>Locker Service. </em>Using javascript libraries that are not Locker Service compliant.</li><li><em>Developer skills. </em>You just need some background in web application development.</li></ul><p>For these three reasons, I have decided to try using <a href="https://vuejs.org/">Vue.js</a> as an alternative to lightning applications and share my experience. Here are the topics :</p><p>PART 1</p><ol><li><strong>Initiating the Vue.js application with Webpack</strong></li><li><strong>Loading the application in a lightning component</strong></li></ol><p><a href="https://medium.com/@ennoucas/salesforce-lightning-application-with-vue-js-and-webpack-part-2-af0071347274">PART 2</a></p><ol><li><strong>Building the application locally</strong></li><li><strong>Calling server side actions (with APEX controller)</strong></li></ol><h3><strong>1. Initiating the Vue.js application with Webpack</strong></h3><p>We are going to create a Vue.js application using this Progressive Web App <a href="https://github.com/vuejs-templates/pwa">template</a>. For that, you will need to have <a href="https://github.com/vuejs/vue-cli">vue-cli</a> installed :</p><pre>$ npm install -g vue-cli</pre><p>Then, you can initiate your application. When asking to install vue-router, say yes as we will use that later.</p><pre>$ vue init pwa vuejs-with-salesforce</pre><pre>? Project name vuejs-with-salesforce<br>? Project short name: fewer than 12 characters to not be truncated on homescreen<br>s (default: same as name)<br>? Project description A Vue.js integration with Salesforce Lightning components<br>? Author Lucas Ennouchi<br>? Vue build standalone<br>? Install vue-router? Yes<br>? Use ESLint to lint your code? Yes<br>? Pick an ESLint preset Standard<br>? Setup unit tests with Karma + Mocha? No<br>? Setup e2e tests with Nightwatch? No</pre><p>Then, go the folder (same as your project name), install and run it :</p><pre>$ cd vuejs-with-salesforce<br>$ npm install<br>$ npm run dev</pre><p>You should now have a browser tab opened at localhost:8080 with your new application displayed.</p><p>In the next part, we are going to build the application for production, upload it in Salesforce as a static resource and load it from a Lightning Component.</p><h3><strong>2. Loading the application in Salesforce</strong></h3><p>Before building the application, we have to make sure that production paths are using the ‘./’ notation for specifying the current directory. In order to do that, we’ll modify the file ‘/config/index.js’. At line 13, set <strong>assetsPublicPath </strong>to<strong> ‘./’ </strong>instead of ‘/’ :</p><pre>module.exports = {<br> build: {<br>  ...<br>  <strong>assetsPublicPath: &#39;./&#39;,</strong><br>  ...<br> },<br> dev: {<br>  ...<br> }<br>}</pre><p>Then we need to build the application for production :</p><pre>$ npm run build</pre><p>This should have created a “dist” folder in your project repository. You can now compress it and upload it as a static resource in Salesforce. We’ll call our static resource ‘vueApplication’</p><p>Then, we are going to create a simple Lightning Application where we are going to load our Vue JS Application thanks to the <strong>lightning:container </strong>component.</p><pre>&lt;aura:application &gt;<br>    &lt;lightning:container src=&quot;{!$Resource.vueApplication + &#39;/index.html&#39;}&quot;/&gt;<br>&lt;/aura:application&gt;</pre><p>You should now see your Vue.js application loading in Salesforce.</p><p>In the <a href="https://medium.com/@ennoucas/salesforce-lightning-application-with-vue-js-and-webpack-part-2-af0071347274">next part</a>, we’ll elaborate a more complicated application using <a href="https://vuex.vuejs.org/en/intro.html">Vuex</a> as the store management and <a href="https://router.vuejs.org/en/">vue-router</a> for handling navigation between different screens. Then we’ll see how to call actions of the Lightning component controller.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17c726484f1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>