Starting a new project from scratch/base is an exciting task and we want to give our best whenever we are starting something new. We try to pour all our past experiences and learnings together to make sure that we are not doing the same mistakes that we have done or found in other projects.
Developing large projects goes through various phases:
1) Requirement gathering and analysis
2) Create high level and low-level architecture and technical design
3) Choosing frameworks/libraries for development
4) Choosing unit testing frameworks
5) Hooking up build scripts
6) Choosing dependency management tool
7) Defining DevOps strategy
8) Infrastructure – Cloud or In House
9) And many more….
Individual people might have worked on different projects and each of them might have faced different problems and might have learned many best practices. It’s quite possible that when you are starting a new project either you don’t know best practices that other individuals might have learned (and you’ll not get benefit from their learning) or you are working on completely new technology and have no idea where and how to start. How about a tool that will allow you to create a ready to go boilerplate project with all best practices?
In this article, we are going to learn about one such tool (i.e. Lazybones) and will use to simplify the challenges that we have with integrating AEM and Angular 5 together. Lazybones can do much more but, in this article, our focus will be on #3, 4, 5 and 6. Lazybones can be extended to handle other AEM related challenges, this is just a sample use case that we have picked for illustrating benefits of using Lazybones with AEM.
2. AEM with Angular 5 project challenges Adobe Experience Manager (AEM), is a content management platform for building websites, mobile apps, and forms - making it easy to manage your marketing content and assets. AEM empowers business users and non-technical staff to create and manage content as per business needs.
Angular 5 is modular in nature, what that means is there is a number of smaller modules that you can choose to mix and match based on what is required in your project. When you are developing Angular 5 application outside of AEM this is not a big challenge in terms of building and shipping an Angular 5 application out of the door because there are many build tools (e.g. Angular 5 CLI) are available to take care of managing these smaller angular modules and dependencies. But, when we are in AEM, components are just building blocks and content authors can drag-drop these components anywhere and as many times as they need so, reusability is key i.e. authors should be able to use Angular 5 components in the same way as regular AEM component. So, this means build tools that are available today for Angular 5 applications can’t help because those tools need to know upfront where components have been used and then these tools compile applications but, in AEM this is different (as we discussed above).
To address this problem, we need to write complex build script, hooks up right dependencies (both for AEM and Angular) and integrate unit testing libraries.
Follow these links to read more about challenges in details: http://suryakand-shinde.blogspot.com/2017/06/part-1-angular-2-with-aem-introduction.html
3. Lazybones
3.1. What is Lazybones Definition from Lazybones repository page:
It allows you to create a new project structure for any framework or library for which the tool has a template. You can even contribute templates by sending pull requests to this GitHub project or publishing the packages to the relevant Bintray repository.
The concept of Lazybones is very similar to Maven archetypes, and what Yeoman does for web applications. Lazybones also includes a sub-templates feature that resembles the behavior of Yeoman's sub-generators, allowing you to generate optional extras (controllers, scaffolding, etc.) inside a project.
3.2. Why Lazybones Often when we are working on a project we spend a lot of time creating project foundation, folders, the base skeleton of the project, hookup build scripts, add right dependencies and other DevOps related tools/configurations and this takes a lot of time. If you look for solutions, you will quickly find that people have solved this problem using tools like:
Maven archetype generators (https://maven.apache.org/guides/introduction/introduction-to-archetypes.html)
yeoman (http://yeoman.io) generator and,
Sometimes using custom scripts If you are working on projects that have different needs from the build, code organization and packaging perspective you’ll realize that standard maven archetypes available publically will not suffice your needs. This is where Lazybones capabilities will help. In the next few sections we learn:
Installing Lazybones
What is Lazybones
How to create a Lazybones projects template to generate an AEM + Angular 5 project
How to use the template
Use cases for Lazybones
Best practices
3.3. Installing Lazybones The easiest way to install Lazybones is with sdkman.
Step 1: Installation and validation of sdkman
Open terminal and type command curl -s "https://get.sdkman.io" | bash
Quit and reopen the terminal
Validate installation by typing command sdk version in a terminal
Fig: Eclipse Gradle project import modal
Step 2: Installation and validation of lazybones
Open terminal and type command sdk install lazybones For more information about installation, please visit https://github.com/pledbrook/lazybones
4. Lazybones Use Cases and Advantages We saw project setup challenges, available options, and learned about Lazybones templates. In this section, we’ll see where should we use it and what are the advantages of using it?
4.1. Use Cases
Project is composed of various technologies and frameworks
Project is complex to handcraft and it takes a lot of time to set up a new project
A project that has a large set of configuration that is difficult to remember while creating a project
Projects that need the same project structure, configurations, and set up to be repeated multiple times
Project in which traditional scaffolding mechanisms of setting up a project (e.g. Maven archetype) are insufficient
The project which needs a customized build script which is difficult to handcraft every time
3.2. Why Lazybones Often when we are working on a project we spend a lot of time creating project foundation, folders, the base skeleton of the project, hookup build scripts, add right dependencies and other DevOps related tools/configurations and this takes a lot of time. If you look for solutions, you will quickly find that people have solved this problem using tools like:
Maven archetype generators (https://maven.apache.org/guides/introduction/introduction-to-archetypes.html)
yeoman (http://yeoman.io) generator and,
Sometimes using custom scripts If you are working on projects that have different needs from the build, code organization and packaging perspective you’ll realize that standard maven archetypes available publically will not suffice your needs. This is where Lazybones capabilities will help. In the next few sections we learn:
Installing Lazybones
What is Lazybones
How to create a Lazybones projects template to generate an AEM + Angular 5 project
How to use the template
Use cases for Lazybones
Best practices
3.3. Installing Lazybones The easiest way to install Lazybones is with sdkman.
Step 1: Installation and validation of sdkman
Open terminal and type command curl -s "https://get.sdkman.io" | bash
Quit and reopen the terminal
Validate installation by typing command sdk version in a terminal
Fig: Eclipse Gradle project import modal
Step 2: Installation and validation of lazybones
Open terminal and type command sdk install lazybones For more information about installation, please visit https://github.com/pledbrook/lazybones
4. Lazybones Use Cases and Advantages We saw project setup challenges, available options, and learned about Lazybones templates. In this section, we’ll see where should we use it and what are the advantages of using it?
4.1. Use Cases
Project is composed of various technologies and frameworks
Project is complex to handcraft and it takes a lot of time to set up a new project
A project that has a large set of configuration that is difficult to remember while creating a project
Projects that need the same project structure, configurations, and set up to be repeated multiple times
Project in which traditional scaffolding mechanisms of setting up a project (e.g. Maven archetype) are insufficient
The project which needs a customized build script which is difficult to handcraft every time
4.2. Advantages
Less time to set up a new project
No need to worry about complex configurations, build process, etc.
A standardized way of creating a project and other artifacts (components, templates, services, etc.) using best practices that are baked into Lazybones templates.
Less time to set up a new project
No need to worry about complex configurations, build process, etc.
A standardized way of creating a project and other artifacts (components, templates, services, etc.) using best practices that are baked into Lazybones templates.
Individual developers don’t need to worry about complexities and don’t need to spend time writing boilerplate code
No comments:
Post a Comment
If you have any doubts or questions, please let us know.