Screens and Blocks in outsystems

Difference Between Screens and Blocks

OutSystems, one of the fastest growing low code platforms for today, where you can do the coding with visual representation, not only makes the application easier and more understandable, but also increases the speed of development than traditional coding or, in technical terms, in core coding forms.

And there are two main elements without which, no matter how efficient your code is, or how defined your logic is, there will be no use for it. These elements are blocks and the screen.

Screens and blocks for a developer are same as the canvas for a painter, no matter how creative you are, or how great your imagination is, if you can’t show it to others, it’s of no use. Similarly, screens and blocks are the canvas for developers; end user don’t see their logics, they see the screen where it is working.

But every beginner has this one doubt that if there is a screen, then what is the requirement of the blocks? So in this blog, we will discuss the basic difference between the block and screen and how both elements are important for OutSystems developers.

So let’s get started !!!

Before we start discussing the difference between the screen and block, let’s define both elements first.

What is Screen?

A screen is a user interface (UI) element of OutSystiaems that stores other UI elements which could be just visible to the end user, like images, lists, tables, etc,  or users can interact with them, like buttons, input fields, dropdowns, etc. Eventually, if there are no elements in the screen, or we can say that when the screen is empty, then it contains the basic screen layout for developers to add UI elements. A screen always uses the screen template, which is predefined content that works as a demo.

To know more about the screen and its lifecycle, do read this blog. Understanding the Lifecycle of a Screen in OutSystems

What is Block?

Blocks are the reusable components that can have their own logic and can store other UI elements of OutSystems. Blocks are a smaller version of the screen with some limitations and some add-ons.

In simple words we can say that blocks acts as a function in the core coding, like even when there are main function in the coding, still different functions are created to make the code more manageable and clean, similarly, even when everything which is done in the block can be performed in the screen but they are more preferred to make code easier to understand and modify.

To learn about the properties of blocks in detail, visit documentation from OutSystems

Difference between Screen And Block

Now that we know what is screen and a block are and how similar they are now, let’s see all the factors that differentiate them from each other.

Reusability

Reusability is the term that means that something is created once and can be used in multiple places.

The screen is not reusable, which means that a screen cannot be used somewhere else if there is almost the same requirement with the slightest difference.

On the other hand, blocks are not only reusable, but they can also have the feature of nested blocks, which means inside one block, another block can be used, with the only condition that the parent and child block should not be the same.

Maintainability

When we talk about the maintainability of the screen and block, you can find a huge difference between the two. As we already discussed that the screen cannot be reused and needs to be created separately every time, which maintaining screens are more difficult.

While blocks are way more easier to maintain, they are reusable as well. Wherever the block is used, it’s not the original block; kind of it’s a replica.

Let’s understand it better with an example.

There is are ten screen of almost same type, and now there is a require to change the text of the button, so the developer needs to navigate to each screen and perform the change, on the other hand, if a block is used in ten places and there is some change to be performed then also the developer just have to do the changes in the block and the changes will be reflects on everyplace where the block is being used.

Dependability

If we talk about the dependability from the perspective of application creation or web development, both screens as well as blocks are important, but if we talk about the dependability of the block and screen, then it’s a different story.

There is no dependence on blocks for the screen; there won’t be much difference in the end user experience if the whole page is created inside the screen rather than blocks.

If there is an application that has only blocks and no screen, then the end user will not be able to see anything on the screen, as blocks aren’t directly accessible by the end user; a block needs to be placed on the screen to show the user.

It’s the same as in the core coding; if there are hundreds of functions, but no main function, then no code will be executed.

Block Exclusive Features

In addition to the above differences, there are some features that are only available to the blocks, and the screen doesn’t have them, so now let’s discuss these features.

On Parameters Change Event

In the block event, in addition to “OnInitialize”, “OnReady”, “OnRender” and “OnDestroy”, there is another event “OnParametersChanged”.

This event is triggered when any of the input parameters’ values are changed from the side of the parent. Regardless of whether there is one input parameter or fifty, even if a single input parameter’s value is changed, then also the “OnParametersChanged” will be triggered.

Customized Events

The normal events, developer can create and use the customized events for the code, which will trigger wherever the developer wants. Mainly, these events are used by blocks to share the information with the parent or notify them about the occurrence of some event. 

Placeholders

Placeholders are an OutSystems element that can only be used inside a block. Placeholders are the elements that reserve a particular place inside the block for the elements that will be placed inside them from the parents.

These elements are mainly used when there is a requirement for similar blocks but not the same; the developers need the dynamic heading for the blocks or need to include an extra feature inside the block dynamically.

Conclusion

So after knowing the difference between blocks and screens, we can say that even when blocks and screens looks same from the far, but when we look closely, they both have different uses as well as features, which not only makes different but also irreplaceable from each other, as there are some requirements which screams the use of blocks while others can be managed by screens.

I hope this blog cleared all the confusion between screen and blocks.

If you want more knowledgeable blocks like this, then do subscribe our newsletter.

Happy Coding!!!

Facebook
Pinterest
Twitter
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

Newsletter

Signup our newsletter to get updated information, and insight about the technology

Latest article