Visit our website: https://www.fitradar.me/ and join the mailing list. Our app is coming soon.
Recently our team finished the work on FitRadar booking system. That was quite a challenging task and I decided to share some insights and knowledge we gained during the design and development of this system. Already on the early stage of designing and requirement gathering it was clear that ticket booking system on the back-end should be independent from the rest of the Fitradar system because we wanted to introduce Event Sourcing for such entities as Order and Payment. Since these two entities are responsible of money charging and money is always a very sensitive topic, we wanted to make sure we can always track down the state changes in booking and payment processes. But to what degree it should be independent was the question we had to answer.
- fault in one object might lead to crash in another object
- the load of a single object affects the whole process, so we can’t assign PC resources to separate app components. It means you can only scale the whole application, usually by creating a new instance of the application. This starts to play a big role when app is hosted on cloud environment like Azure, Google Cloud or AWS where we must pay for used resources.
- It is hard to apply new technology or framework to the new feature. Usually the whole application is build based on single architectural pattern like MVC and CRUD or MVC and CQRS and it is hard to introduce one more pattern (if we already using simple Data Access Objects for working with data coming from web, then it will take some time to introduce CQRS with Event Sourcing) in the same application. It is much simpler to create a new application.
So there is very little we can do about object decoupling at runtime in single process application case, but do we really need to deploy a booking system in a separate application? Maybe we can just isolate our booking system in a separate library and still run it in the same process with the rest of FitRadar libraries? And so we started to investigate it. Very quickly we noticed that our ideas of making booking system independent from the rest of application strongly reassembles the principles of Microservices architecture . And since now days there are a lot of talks around the Microservices we thought that our project might be a good candidate to move to Microservices architecture. But just because something is promoted doesn’t mean it fits your needs. You usually don’t start the development of application as a distributed system, unless it was a requirement from the beginning. Applications usually mature to the state when Monolithic Architecture doesn’t satisfy the initial requirements and a team starts to consider switching to Microservices Architecture. And we wanted to make sure that this is the time when the new feature requires us to switch to the new Architecture to make the development easier in the future. Here are the advantages of Microservices Architecture that really attracted our attention:
- it gives us a smaller code base to work with. It is a really huge benefit if you consider that at certain point a team more and more starts to think about how properly structure the project (how to write the Clean Code), that any new developer could easy understand it and navigate it. And putting a Booking system as a separate solution would allow as to reduce the code complexity and as result would allow developers navigate faster and add new code faster. If you have ever worked on enterprise scale application development then you know how much time it can take just to figure out where to put your new code.
- Web API end to end tests and Integration tests can run much faster because there is no need to load all of the Fitradar system libraries only those related to booking system. This advantage really starts to shine when we enter the test phase.
- It allows us to scale booking system and the rest of the back-end application independently. The booking system is more focused on data writing in the database on the other hand main back-end application is focused on data serving. We expect thousands of data requests a day while user will be navigating around in mobile application and just few bookings a day.
- Improved fault isolation
And for our project it seemed that we will gain more than loose if we will treat booking system as separate application and deploy it in a separate process. So we gave it a try.
Visit our website: http://fitradar.me/ and join the mailing list. Our app is coming soon!
In my previous articles when I was talking about Clean architecture and Domain Driven Design I mentioned one piece of domain layer – repository or more precisely repository pattern. The repository pattern is used to persist and retrieve domain models. Although repositories are mostly related to Domain Driven Design the other architectures might have the objects with the same functionality but are called different. In Fitradar application (front end and back end) the objects that are used to persist data in the database and fetch data from the database and map data to in-memory objects (aka POCO – Plain Old C# Object, POJO – Plain Old Java Object) and are not part of the Domain layer are called DAO (Data Access Objects). DAO usually are used in cases when no business logic is involved and the application needs to execute simple CRUD operation.
In Android application to work with database we use Room Persistence library but in our back-end solution we use Entity Framework Core. These two are know as Object-relational mappers or ORM. And today I wanted to explore the relationship between Domain Repositories, Data Access Objects and ORM and share some experience we had in our team working with these patterns and libraries.
If you look at the responsibilities of Repository, DAO and ORM they are very close to each other. Some years ago when ORM technology was in its inception the DAO and Repositories usually were working directly with the low level database access services. In case of .NET it was ADO.NET library and in case of Android it was SQLite library. And it was quite clear that DAO or Repository should use these libraries to persist or retrieve in-memory objects and map the data. But now-days when in application development main data access technology became ORM the border between ORM and DAO and Repository has become very blur, especially when one just switched to ORM. Working with ORM in different projects and languages our team came to conclusion that in same cases ORM can fully replace the DAO or Repository and can be used instead of it. Let’s look closer at the cases when it is appropriate to use just a ORM library and when the DAO or Repository should be used in combination with ORM:
- If you need to save, update or delete single flat plain old object then in most cases ORM library will do the job for you. Of course EF Core and Room are capable of doing more, but then we really should investigate each case separately
- If you need to fetch the data from single table by primary key then again in most cases you can fully relay on ORM
- In case Domain layer aggregate has complex entity cluster hierarchy, where different entities might have different persistence state you most likely will need to write such aggregate persistence logic by yourself either using ORM or low level database access library. In our application one such aggregate is Sport Event that has Place and Organizer and some other entities. And the problem we faced when tried to save Sport Event by using built in EF Core capabilities was the different Entity State and the calculated state before Save operation. For example we had cases when we needed to create a Sport Event in Place that was not yet saved in database, and since both entities have the same Entity State EF Core tackled that case well and was able to create both entity records in database. But the problem started to appear when we wanted to create Sport Event in the Place that already had other Sport Events, now before saving aggregate Sport Event we had to fetch Place entity to make sure EF Core sets the correct Entity State. And the more entities your aggregate root has the more fetch operations might be needed. So in this case for us seemed obvious putting Entity State synchronization logic in separate Repository.
- In case data query logic and following mapping logic is so complex that to make a code readable it is necessary to split logic in separate functions, you most likely will move those functions to separate class, Data Access Object, to persist the Single Responsibility principle.
As you can see the Repository and DAO still has their place in the modern software architecture. In case of queries in CQSR architecture query logic might be put in Application layer since anyway contrary to Commands, Queries only responsibility is data fetching, and that duplicates DAO responsibility. By choosing to put query logic in Application layer we make a direct dependency on EF Core. That is not a problem in classical three layer application, but it does not fit the Clean Architecture principle where Application layer should be aware only of Domain layer and with outer layers (EF Core belongs to the Infrastructure layer) communicates only through interfaces. In this case we should use DAO.
Please visit our website and join the mailing list. Our app is coming soon:
Physical fitness has been associated with better brain structure and brain functioning in adults.
The findings of a study, led by Dr Jonathan Repple of the University Hospital Muenster in Germany, suggests that increasing fitness levels through exercise could result in improved cognitive ability – such as memory and problem solving – as well as improved structural changes in the brain.
A group of researchers led by Repple used a publicly available database of 1,200 MRI brain scans from the Human Connectome Project and combined it with physical testing to assess the subjects’ physical fitness. Each one’s cognitive ability was also measured. The researchers excluded subjects with pre-existing conditions, such as neurodevelopmental disorders, diabetes or high blood pressure.
The results of the study showed that physical endurance was positively associated with the global cognition scores of the subjects taking part.
In its conclusion, the group of researchers said the results of the study suggest that physical exercise could be used as a form of preventative healthcare.
“The observed pattern of results appears to support the notion of a beneficial effect of physical fitness on cognitive function,” the study reads.
“This notion is supported by the few available experimental studies indicating that physical exercise leads to increases in memory performance and brain structural integrity.
“This concept might be of relevance for a wide range of domains in health and life sciences including prevention, clinical care and neurobiological research.
“Along with previous findings, our findings point to the potential of physical fitness as a modifiable factor that might be applied as an intervention in prevention and clinical care.”
The report was simultaneously published in the Scientific Reports journal and presented at the ECNP Congress in Copenhagen, Denmark.
To read the study in full, click here.
Please visit our website and join the mailing list. Our app is coming soon:
- Lifts your mood
- Improves learning abilities
- Builds self-esteem
- Keeps your brain fit
- Keeps your body fit & able
- Boosts mental health
- Boosts your immune system
- Reduces stress
- Makes you feel happier
- Has anti-aging effects
- Improves skin tone and colour
- Improves sleeping patterns
- Helps prevent strokes
- Improves join function
- Improves muscle strength
- Alleviates anxiety
- Sharpens memory
- Helps to control addictions
- Boosts productivity
- Boosts creative thinking
- Improves body image
- Gives you confidence
- Helps you keep focused in life
- Improves eating habits
- Increases longevity
- Strengthens your bones
- Strengthens your heart
- Improves posture
- Prevents colds
- Improves appetite
- Improves cholesterol levels
- Lowers risk of (certain) cancers
- Lowers high blood pressure
- Lowers risk of diabetes
- Fights dementia
- Eases back pain
- Decreases osteoporosis risk
- Reduces feelings of depression
- Prevents muscle loss
- Increases energy and endurance
- Increases sports performance
- Increases pain resistance
- Improves balance and coordination
- Improves oxygen supply to cells
- Improves concentration
- Helps with self-control
- Lessens fatigue
- Increases sex drive & satisfaction
- Makes life more exciting
- Improves Quality of Life
Visit our website and join the waiting list. Our app is coming soon:
Sometimes it can feel nearly impossible to get yourself in shape, which is why personal trainers are so helpful. Not only do they give you that extra push, but you also get the benefits of their expert knowledge and experience. Even with their guidance, however, your efforts will be in vain if you aren’t following the right diet and fitness regimen for you. To find out exactly how you can improve your fitness routine, WD spoke with top-notch personal trainers for their secrets to getting the most out of your workout and living an overall healthier life.
1. Set realistic goals and be confident.
Before starting your path to a healthier lifestyle, it’s important to be realistic about how much time you have for the results you want, and how you can achieve them. Colleen Faltus, private trainer at The Sports Club/LA in Boston, suggests compiling “a list of both short- and long-term goals. This will keep you motivated to accomplish and surpass them; it will give you focus and add some variety to your workout.” Another trick to staying focused? Be confident! Trainer Bill Trimble, founder of the workout program Extreme Bill Trimble, says, “if you’re not confident and determined you can achieve your goals, you won’t. Make sure you try to stay positive and keep your head up, even on those rough days.”
2. Get specific about what you want to achieve.
Although you may think your trainer will automatically know what you want, that isn’t the case. Trimble says telling your trainer exactly what your goals are is the key to success. A weight-loss plan, for instance, will be different from a plan for someone trying to build muscle. Your trainer will design a routine based on your individual needs and lifestyle, so letting him or her know exactly what you want up front will help you get the most out of the experience.
3. Have fun!
“Working out should be enjoyable. Your personal trainer is there to push you a little bit, but not intimidate,” says Trimble. During your initial consultation, talk with your trainer about activities you enjoy, your schedule and exercises you don’t particularly like. This way, he or she can devise a routine you’ll love. Another key factor to having fun is variation. “Incorporating other elements of fitness besides cardio will increase the likelihood of faster and more efficient weight loss,” explains Faltus. Another plus? You’re less likely to become bored if you try new things.
4. Performing each exercise correctly is imperative, so watch your form.
To achieve the best possible results and stay injury-free, follow your trainer’s instructions about proper form. This is especially important if you’re doing an at-home workout on your own. “Model the video or demonstration exactly, paying special attention to the trainer’s breathing technique and form,” Trimble urges.
5. You should begin to see results within 12 weeks.
Depending on your workout plan, the three-month mark can be a good indicator of how you’re doing. “In about 90 days, you should be able to notice results—whether it be that your jeans are a little looser, your quality of sleep is better or you just feel good all around,” Trimble says. Many people lose motivation if they don’t see results sooner, but you’re changing your physique, so 12 weeks is about how long it will take before your workouts begin building lean muscle.
6. Communication is the key to success.
As with any relationship, communication is vital when it comes to a healthy and happy experience. Faltus recommends giving your trainer feedback about how you are or aren’t liking the exercises, what is or isn’t working and anything else that’s on your mind. Most often, your trainer will check in with you before and after the workout. So use the opportunity to talk! “You know your body better than anyone else, so speak up at each session and your experience will be that much more enjoyable and exciting,” Faltus says.
7. You’re going to have bad days.
“You’re going to fall off the wagon and have off days at some point,” says Trimble. “But get right back up and begin again without getting discouraged.” The biggest problem trainers see in their clients is that their emotional confidence starts to dwindle when something goes wrong. “You have to believe in yourself and [believe] you can do it,” Trimble says. So, if you splurge on your eating one weekend, don’t beat yourself up—just give it your all during your Monday workout session.
8. If you don’t have a trainer, you can still stay motivated.
On those mornings when you just can’t get yourself out of bed, it’d be pretty nice to have a trainer waiting for you at the gym. But you don’t need a trainer if you know how to find motivation elsewhere. For one thing, Trimble recommends working out with a partner for extra encouragement. He also suggests choosing a fun workout so you’ll look forward to it. “These days, so many programs are easily accessible, such as at-home boot camp workouts, circuit training, online videos and specific plans such as the P90X workout.” And perhaps most important, be consistent. If you exercise on the same days every week, not only can you schedule around your workout, but you’ll be more likely not to miss it.
9. You have to eat right, too.
Personal trainers aren’t miracle workers, so after you leave the gym, make sure you follow the diet plan you’ve established for yourself (or with the help of a dietician). One way Trimble helps his clients eat right is by encouraging them to keep a food journal. “Nutrition can be a problem, so writing it down and being able to look at it with my clients is helpful,” he says. Not only will you be able to discuss what you’re eating with your trainer, but you’ll also become more aware of your food choices—and rethink that second piece of cake! One way Faltus suggests you start a good nutrition plan? Let yourself cheat. “Eating balanced meals filled with fruits, vegetables, grains and protein will prove successful in the long run. But remember to give yourself a ‘cheat’ nutrition day on the weekends.”
10. You’re probably not getting enough sleep.
“Lack of sleep causes a decrease in energy and motivation to accomplish both short- and long-term goals.” Not only are proper sleeping habits important for you mentally, but if you don’t rest your muscles properly before and after a good workout, you risk injury. Faltus says to “adjust your sleep schedule and get both quality sleep and a decent quantity of sleep. You’ll notice the difference in your overall performance, and your muscles will thank you too.” For some tips on how you can destress and unwind before bed to sleep better, click here.
Please visit our website and join the waiting list. Our app is coming soon: http://fitradar.me/
Any application to some extent is using the logging system. And we are not an exception. We log a lot of information in our Android and iOS applications as well as in our backend server application. But what logs give us, after all, they are not contributing to the application functionality? They might be a part of user requirements, but why would anyone want to invest money and time for the feature that is not used by a user? Let’s explore the purpose of logs in software development and practices developers are applying.
Here are some of the cases where we are using logging in our applications:
- during development to make it easier and faster spot a bug along the
- @NonNull and other annotations and code inspection tool Lint
- unit and integration tests, where we try to cover most of the code execution paths and integrations points. (And I already wrote how we approached the testing in our project)
we use logs that show as the trace of actions and values that led to a particular bug. But before we started to use logs we had to answer the following questions:
- where to put log statements on
- what information to log
Since a lot of our code is covered by unit tests then there is little reason to log our own code for debugging and test purposes, but where we don’t have control over the values we are processing is:
- framework lifecycle methods, like onCreate, on ViewCreate, onResume, onPause in Android application. If our code is using the arguments provided by lifecycle method we log these values and assert the expected value if it is possible
- to click listeners and other event handlers
- third party library methods and their returned results. For example, for network calls we are using Retrofit and we always log the network requests and responses in debug build variant. Another example calls to the database. Since we are using Room in Android application, we want to see SQL code sent to the database
So once we log enough information we can spot the bug just by going through logs and skipping the process of starting the app again with attached debugger and stepping through the code. And we don’t have to worry much about the performance as well since Android logging system is taking care of debug log statements and skip them at runtime.
- in production:
to monitor, on the back end server the logs are used to monitor the normal business logic functionality. We log every request. If the request is successful we log it as info, in case request ends up we log error. When the error is reported on the back end service, the gathered logs are of great value. Very often they allow to spot the problem without further investigation.
- we log fatal errors, that caused the application stop. On the backend server, we catch the exceptions as early as possible and when the exception is caught it is logged and an email is sent to an administrator. We don’t experience many exceptions outside of our app on the back end part, because the only reason that can lead to such exception is a malformed request and not the back end code itself, and since the request is formed by third party library it is very rear that it is malformed. A different story is with uncaught exceptions on the client – Android or iOS app. It is not possible to catch all the exceptions so they leak and cause the app to crash. To log these kinds of exceptions we use Fabric Crashlytics (Firebase). These logs later help us a lot to find a cause of a crash.
Visit our website and join the mailing list! Our app is coming soon:
#blockchain #btc #crypto #cryptocurrency #bitcoin #ICO #fintech#Ethereum #altcoin #ETH #crowdsale #token #tokens #tokensale#preICO #cryptomemes #cryptolife #cryptoporn#cryptocurrencies #ICOcoin #ICOtoken #bounty #bitcointalk#decentralized #trading #smartcontract #bitx #bitcoins #bitcoin