When should I create a class? [closed]

0

I know it sounds like a pretty silly question, but I'm starting now in the programming world (focused on mobile).

When I create an app it gets all the functions within the Activities, so I never know when I should take methods and attributes of the class and separate them. ah! this also serves to organize packages and classes

Thank you for your attention.

    
asked by anonymous 11.10.2016 / 23:25

2 answers

2

It depends,

Each activity has its own lifecycle, which may or may not affect the app life cycle.

I recommend reading Activity .

And then there are fragments, which helps the app to be split by blocks of the app itself, which can then reuse in various activities. I recommend reading Fragment .

And then, following Java standards, you should program following the POO paradigm, creating classes to represent various things (objects or abstract things)

    
11.10.2016 / 23:37
0

Based on the concept that a classe is a structure that abstracts a set of objects with similar characteristics it may contain methods or attributes. So you can have a class to represent an entity of your bank for example or a class that contains methods to perform operations in your bank. Before you start coding I suggest giving a good read on a material about POO Concepts of Object Orientation - Ufpa Object Oriented Programming - Unicamp

    
11.10.2016 / 23:50