DEV Community

bright inventions
bright inventions

Posted on • Updated on • Originally published at brightinventions.pl

Self code review

Once I was a child my parents were convincing me that it was worth double checking both my homework as well as tests before handing them in, to catch errors and fix them. It soon became a habit for me. The habit that once evaluated into a self code review process :)

I will share with you the steps I take before commiting code. Probably most of them are obvious to you, but maybe you will find something interesting and worth including into your routine?

1. Compilation errors

This might seem to be quite obvious. If the code doesn’t compile, how can you even check if it works? I have added this step to my in-mind checklist lately as in our TypeScript projects the compile script is a little more “strict” than the one for running an app in the hot reloading mode (e.g. compilation errors on unused imports). So even though the app recompiles seamlessly, it will not compile on the CI server.

2. Warnings

I actually quite like a strict approach when warnings prevent compilation. But this is not always the case, so it’s worth having in mind to look through the warnings and apply fixes where needed.

3. Unit and integration tests

Just run all tests and see if they are green. This is also the time for some framework-specific checks, e.g. mocha requires to append only() to test methods to run a specific subset of the tests. Of course you need to remove it before commiting :) Do you know any other frameworks’ features which are likely to produce this kind of leftovers?

4. The code review itself

I usually list all the files that have changed and then read them carefully one by one, paying special attention to the following elements (the similarity to an ordinary code review process is not accidental :) ).

  • All the little things that make the code cleaner like all the shorthands or smart methods that modern languages have (to name a few: Kotlin’s isNullOrEmpty or Scala's getOrElse). IDEs give lots of such hints, we just need to make use of them.
  • Spelling - typos make the code messy :)
  • Rethink the names of classes, variables and so on. Are they meaningful enough? Or maybe too verbose?
  • Any too complicated constructions like long computations or nested conditions? If I have just written it and still do not get the sense at first glance, maybe there is a way to make it cleaner?

IDEs make this kind of reading easier. In the code editing window you have the changed lines marked so you know which ones to focus on at most. I know some of us use the diff window for this purpose. I usually prefer the more gentle way of highlighting the differences, but that’s quite personal - try both and decide which is the best for you. Or just combine them.

5. The big picture

Then I read the code again, taking the big picture this time. The aim is to check if the code is clear and understandable, if it just reads smoothly.

6. CI server check

Once I have committed and pushed, the last step is to check if the code compiles and the tests are green on the CI server.

Do I apply this routine each and every time? Does this routine prevent me from checking some fishy code in? Of course not, we all know scenarios of delivering a feature as soon as possible or just a little change which surely does not require all these steps. Commits like Fix typos or Remove “only” from tests still happen :) But after all, we are only humans and we all make mistakes. And the teammate code review is just irreplaceable :)

Originally published at brightinventions.pl

By Agnieszka Olszewska, Software Engineer @ Bright Inventions
Email

Top comments (27)

Collapse
 
peterpaul3358 profile image
PeterPaul3358

49ers jacket mens are another popular style that can add a stylish edge to any outfit. They are versatile and can be worn with jeans or dressed up with a skirt or dress.

Collapse
 
aliciab13550469 profile image
Alicia Black

I was lucky enough to go through the code review when I first came into contact with the development team in the "real world." Code review can get people to criticize their own code, but I found it especially helpful to get code review skills that are greatly better than my code.
Regards: Master Degree Dissertation

Collapse
 
sarahtaylor profile image
Sarah Taylor

The code review itself is really helpful for me and I am very happy when read about self code review I was shocked why don't people aware about it. Actually my profession is providing Cheap Dissertation service provider and this is and outstanding topic for me.

Collapse
 
ramonmiles profile image
RamonMiles

Dubai's recording studios epitomize excellence in audio production. Equipped with state-of-the-art technology, these sanctuaries of sound provide unparalleled creative spaces for artists and musicians. From world-class mixing consoles to high-end acoustics, every detail is meticulously crafted to capture the essence of musical genius. recording studio in dubai are the epitome of luxury and precision, inspiring the creation of unforgettable sonic masterpieces.

Collapse
 
sophiekells profile image
Sophiekells

My brother is into coding. I think he will find this post useful. I was planning to learn a bit of coding as well but then I got busy with my work. I started providing master thesis help and it leaves me with no time to learn coding. Anyway, I am sending this post to my brother – I hope he finds it helpful.

Collapse
 
adampeake20 profile image
AdamPeake

The post is really superb. It’s varied accessory information that consists during a basic and necessary method. Thanks for sharing this text. The substance is genuinely composed. This web log is frequently sharing lost vape orion useful actualities. Keep sharing a lot of posts.

Collapse
 
jozephchristopher profile image
JozephChristopher

By using the code, I have made much improvements and i am sure that reviewing things in this way, there would be some services available from which people can buy dissertation online easily.

Collapse
 
photoworks profile image
Photosthatwork

As a toronto event photographer, I bring over 20 years of experience to capture the essence of your corporate or social events. My approach combines professionalism, creativity, and technical skill to deliver high-quality images that reflect the energy and spirit of each occasion. Whether it’s a gala, conference, or private celebration, I work diligently to document every important moment. With a keen eye for detail and a commitment to excellence, I ensure that your event is captured in a way that can be cherished and used for promotional purposes. Trust me to make your event memorable with stunning photography.

Collapse
 
pro5physio profile image
Pro 5 Physio

Physiotherapist Mississauga services at our clinic are designed to provide comprehensive care for a wide range of conditions. Our team of skilled physiotherapists is dedicated to helping patients recover from injuries, manage chronic pain, and improve their overall physical function. We offer personalized treatment plans that incorporate manual therapy, therapeutic exercises, and other specialized techniques to address your unique needs. Our goal is to provide high-quality care that promotes healing and enhances your quality of life.

Collapse
 
fullypromoted profile image
fullypromoted

School promotional products are tailored specifically for educational institutions to foster school spirit and community involvement. These products include customized backpacks, notebooks, pens, and school uniforms. By incorporating school logos and colors, these promotional items help create a sense of unity and pride among students, teachers, and staff. Additionally, schools can use these products as rewards for academic achievements, giveaways during events, and tools for fundraising efforts, thus enhancing their outreach and engagement.

Collapse
 
hqnetworksolutions profile image
HQ Network Solutions

At HQNS, our Managed IT Services offer comprehensive support and management for your company's IT infrastructure. We provide proactive monitoring, maintenance, and support to ensure your systems run smoothly and efficiently. Our services are designed to minimize downtime and maximize productivity, allowing you to focus on your core business activities while we handle your IT needs. From network management to software updates, our team ensures your technology is always up-to-date and secure.

Collapse
 
creativesquad profile image
Creative Squad

Enhance user satisfaction and loyalty with our user interface experience service in Canada. Creative Squad employs UX/UI design principles to create intuitive interfaces that prioritize user needs and deliver exceptional digital experiences.

Collapse
 
exchangesavvy profile image
Exchange Savvy

Successful migration to Microsoft 365 requires careful planning and execution. Conducting a thorough assessment of existing data, defining migration goals, and choosing appropriate migration strategies are essential steps. Following best practices ensures a smooth transition with minimal downtime and data loss. exchangesavvy.com/

Collapse
 
elev8te_mens_health profile image
Elev8te Mens Health

Penile shockwave therapy near me is an advanced treatment option for men experiencing erectile dysfunction. This therapy utilizes low-intensity sound waves to improve blood flow and repair tissues in the penis, promoting natural and long-lasting erections. At Elev8te Men’s Health, we offer this state-of-the-art therapy in a comfortable and confidential setting. Our Toronto-based clinic is dedicated to providing personalized care and support throughout your treatment journey. Experience the benefits of penile shockwave therapy and regain your sexual confidence with our expert team.

Collapse
 
wearvarsity profile image
Get Varsity Jackets

Get ready to rock the fashion scene with the must-have ateez bomber jacket! This stylish piece is a true statement-maker, perfect for all fans of the sensational K-pop group. Crafted with premium quality materials, it ensures both comfort and durability. The ATEEZ bomber jacket features the iconic group logo and vibrant colors that showcase your love and support. Whether you're attending a concert or simply want to stand out in style, this jacket is a wardrobe essential. So, gear up, embrace the energetic vibes, and make heads turn with the ATEEZ bomber jacket - a must-have for every K-pop enthusiast!

Some comments have been hidden by the post's author - find out more