10 Programming Tips To Practise Maintainable Coffee Applications

10 Programming Tips To Practise Maintainable Coffee Applications - Hallo sahabat BEST LEARNING JAVA, Pada Artikel yang anda baca kali ini dengan judul 10 Programming Tips To Practise Maintainable Coffee Applications, kami telah mempersiapkan artikel ini dengan baik untuk anda baca dan ambil informasi didalamnya. mudah-mudahan isi postingan Artikel best practices, Artikel programming, yang kami tulis ini dapat anda pahami. baiklah, selamat membaca.

Judul : 10 Programming Tips To Practise Maintainable Coffee Applications
link : 10 Programming Tips To Practise Maintainable Coffee Applications

Baca juga


10 Programming Tips To Practise Maintainable Coffee Applications

Hello all, today is 31st December, the lastly solar daytime of 2016 too this is in all likelihood the lastly postal service on for this yr too I desire to arrive special. That's why I am going to portion yous approximately tips on creating maintainable Java applications which volition aid yous non precisely inward the novel year, but also inward all the coming years inward your software evolution career.  One aspect of development, which is oft overlooked yesteryear developers is to create applications which are both easy to maintain too support. Since a software spends 90% of its lifetime inward maintenance mode, it's real of import that your application is piece of cake to configure, support, too maintain. Also, Java application is no dissimilar than whatever other software, yous must pay attending to these fundamental properties of writing production character code, thence this tips also applies to whatever programming linguistic communication which is used to create real-world software which is used yesteryear existent users.

If yous receive got piece of work inward large scheme e.g. Investment banks e.g. Barclays, Citibank, or large Insurance companies yous volition uncovering how of import is back upwards too maintenance of production applications are. There are several to a greater extent than software engineers working inward back upwards role too so programmers developing software. You receive got L1, L2, too L3 back upwards too and so dedicated back upwards squad for every application. This agency back upwards is truly important.

But, when programmers railroad train an application, they focus on features too speed of evolution e.g. how rapidly a characteristic is create for testing etc, too to accomplish these many programmers including myself inward yesteryear oft ignore things which affair a lot inward production.




How to Make Java Application to a greater extent than Maintainable

Here are approximately practical tips to brand your Java application to a greater extent than maintainable. Always remember, maintenance terms is much higher than evolution terms too it's piece of cake to give a solution but it's every bit hard to give a maintainable solution i.e. something which tin withstand the essay of time.

Before going to explains these 10 tips which tin brand your Java application to a greater extent than maintainable too piece of cake to support, allow me say yous that I receive got personally made a lot of these mistakes myself. It requires a dandy bargain of discipline, hard work, too to live vigilant most writing character code. Sometimes yous receive got to force dorsum fifty-fifty to your squad Pb or managers bringing the points similar support, which is oft overlooked.



Don't swallow exceptions
Please avoid swallowing the exceptions. The stack describe is the most valuable troubleshooting information. In the production scheme where the priority is to convey the scheme upwards too and so uncovering the root cause, these exceptions are gold, without them, yous volition never live able to uncovering what happened alongside your application at that moment. On the other hand, delight don’t impress the stack describe multiple times. Printing a stack describe is a resources intensive procedure too should live controlled i.e. yous impress to a greater extent than information land running on DEBUG or INFO trend too solely impress essential information land running inward PRODUCTION mode. This is an illustration of swallowing exception inward Java:
try{    // do something  }catch(FileNotFoundException fe){    // do nothing }

This is also known as empty try-catch block too many static code analysis tools similar Fortify volition grab these inward the early on phase of development.  This also highlights the of import of static code analysis inward Java development. Make sure, yous integrate static code analysis tool as portion of your construct process.

If yous are nevertheless non convinced on static analysis, too so delight read my postal service why static code analysis is important, that volition give yous to a greater extent than reasons to utilization it inward your project.


Avoid excessive logging
This tip is closely related to the initiatory of all ane too at initiatory of all it may expect contradictory but inward reality, it's not, inward fact, they both compliment each other. When yous run the Java application inward your evolution environs (PC), nobody cares what’s the logging marking yous have. Go ‘DEBUG’ or ‘ALL’ if yous please. But when it goes to production (or other higher environments e.g. QA or UAT ), limit your logging to ‘INFO’ or ‘ERROR’. Excessive logging has iii major impacts:

1. It puts unnecessary charge on the Application. I’ve seen throughput of application is reduced to one-half due to excessive logging.

2. It tin fill upwards up the file scheme real rapidly too that tin create issues for your application too other applications hosted on the same server. This is a serious work peculiarly if yous are co-hosted alongside another application. Do yous know what volition hap when root directory of for certain flavors of Unix scheme fills up? - that’s right. No ane tin login into the host.

3. Troubleshooting volition live painful, similar looking for a needle inward a haystack (if the piteous back upwards guy tin ever acquire the log file to open).

In short, yous receive got to kicking the bucket along the residual betwixt excessive logging too non plenty logging too to live honest that is also an art, which requires a practiced cognition of both application too domain. This is also where sense comes into the picture, involve back upwards guys from the UAT itself, they volition give yous valuable tips on logging too back upwards of the application. Remember, life is all most keeping correct residual :-). See here for to a greater extent than logging tips for Java developers.

 too this is in all likelihood the lastly postal service on  for this yr too I desire to arrive sec 10 Programming Tips to Create Maintainable Java Applications



Don't Forget to Close Database Connections
This is ane of the most mutual reasons for production issues inward the lastly decade, but thankfully alongside modern frameworks too library, this number is truly tardily disappearing (as the framework takes aid of opening/closing connections). However, brand for certain yous ever ‘close’ the database connexion so that it is released dorsum to the pool. This is also ane of the JDBC best practices, I receive got shared alongside yous inward my before postal service 10 Essential JDBC best practices for Java programmers. If yous haven't read it yet, brand for certain yous read it on 2017.

Influenza A virus subtype H5N1 mutual fault is non closing the connexion inward the ‘finally’ block of a ‘try catch’. If in that location is a connexion puddle leak, your connexion puddle alongside live exhausted presently too your user volition sense immediate slowness.

The same rules kicking the bucket to closing sockets too streams if yous don't unopen them yous volition run out alongside resources pretty soon. Sometimes, Java developer think that they receive got closed the connexion but inward reality, they were non closed, thence yous must know the right way to unopen streams inward Java.

This is portion of full general resources administration best practices. Not to discourage yous but I receive got personally constitute C++ developers excel Java developers when it comes to resources management. They are to a greater extent than vigilant most closing the connexion too releasing resources, something Java developers tin larn from C++ programmers.



Don't underestimate production load
If yous are an experienced Java developer yous would receive got noticed that most of the issues are exposed inward the production environs rather than inward UAT or QA environment, peculiarly concurrency related issues? Do yous know why? because of production load.

You mightiness receive got heard developer talking to back upwards personnel that  ‘It industrial plant fine inward my evolution environment. But when it went to production, it crashed’.

Yes, it is the chore of the charge testing squad to essay your application alongside the production similar load. But that does non hateful that as a developer yous write code that does non scale well. For example, it industrial plant fine for 1 user, but what happens when in that location are 500 users online simultaneously.

The number is brutally exposed land writing concurrent code because the probability of race condition is much higher inward production than whatever other environment. So, ever kicking the bucket along production charge inward hear too code.

You should also read my postal service most essential multi-threading too concurrency best practices for Java programmers if haven't read already. That volition aid yous to envision approximately of the things which yous mightiness non think otherwise.

 too this is in all likelihood the lastly postal service on  for this yr too I desire to arrive sec 10 Programming Tips to Create Maintainable Java Applications



Avoid loading large resultant sets from Database
This is ane of the mutual mistakes made yesteryear beginners too intermediate Java programmers who don't know most paging or pagination. You precisely cannot charge every tape e.g. guild or merchandise from database inward ane call. In approximately cases, obviously, yous volition run out of retention too it is also a waste matter of network bandwidth, CPU too retention as the user mightiness non require all of those data.

Secondly, yous precisely cannot kicking the bucket along the information inward your application forever because it may acquire stale thence yous require to charge it again.

So, instead of loading all records inward ane go, implement approximately form of ‘pagination’ and/or ‘lazy loading’ so that yous don’t receive got to charge everything inward the beginning.

This is where ORM too caching framework similar Hibernate helps a lot. They precisely costless upwards Java developers from worrying most lazy loading too pagination. If yous desire to larn to a greater extent than how lazy loading industrial plant inward Hibernate, I propose reading Java Persistence alongside Hibernate or High-Performance Java Persistence by Vlad Mihalcea both are dandy books which every Java developer using Hibernate should read.

 too this is in all likelihood the lastly postal service on  for this yr too I desire to arrive sec 10 Programming Tips to Create Maintainable Java Applications



Avoid hard coding Configuration Parameters
You mightiness receive got heard this tip several times but yous would live surprised if yous expect at the code written yesteryear many professional person software engineers too programmers. There is hardly a code where something is non hard-coded but hard-coding configuration values similar URLs, directory locations, username/passwords, cache sizes, log levels etc inward the code results inward hard to maintain Java applications.

Instead of hard-coding configuration parameters, yous must externalize them inward a property file. It seems uncomplicated plenty but I receive got seen it over too over over again that somehow approximately hard coded value sneaks inward too breaks when it goes to production. In ane word, managing configuration information inside the code is a nightmare. Never do that.

There is a flip side as well, where many programmers precisely create as good many belongings files alongside the promise to generalize everything. It does brand sense to kicking the bucket along related properties inward ane house e.g.  if a couplet of configuration parameters is shared yesteryear multiple application too so externalize them inward ane belongings file e.g. database too middleware URLs, username, password etc too allow other application import that file, but if yous do it over a limit too so it becomes a maintenance nightmare. 

You should also never mix environment-related configuration parameters e.g. URL, directories, username/password alongside application related parameters e.g. config parameters to enable disable approximately functionalities. It's amend to kicking the bucket along split upwards properties file for application properties too environs properties. This way, yous would receive got ane application properties across the environs which are essential for testing too production release. 



Don't write Platform specific Code
Many Java programmers precisely don't give a shit to writing platform specific code, thinking that Java is platform independent. Even though Java is platform independent, if yous are non careful yous volition halt upwards making your Java application platform dependent. Java programmers should non code anything that is related to the local operating system. For example, executing a Linux command (example: uname -a) from coffee too treatment the output.

This volition non piece of work whenever your fellowship decides to movement to Windows from Unix too it volition live painful to refactor hundreds of lines of code containing such code. This is over again the illustration where static code analysis tin aid yous a lot. Make for certain yous integrate tools similar Sonar or Fortify inward your construct procedure to regularly scan code for such code smells.

 too this is in all likelihood the lastly postal service on  for this yr too I desire to arrive sec 10 Programming Tips to Create Maintainable Java Applications



Consider Clustering
This is ane expanse where fifty-fifty many experienced Java programmer also fails. Since every application doesn't run inward the cluster it's possible to non thinking most clustering at the start but if yous ever determine to run your application inward a cluster inward the afterwards phase of development, it would live truly hard to refactor your application.

For example, if yous receive got a scheduled chore inside the code, what volition hap to it if yous run multiple instances of the same application? Wouldn’t it run multiple times? What are the side effects of this?

It's best to think to cluster at the start of evolution too avoid scheduling jobs from Java code directly, think most using to a greater extent than useful tools similar Autosys for Job scheduling too monitoring.


Avoid packing multiple versions of same JAR files
Packaging utility jolt files inward several places, peculiarly diverse versions of the same utility jolt inward diverse locations is the effort of many production issues.

You must receive got a create clean construct too versioning processing, peculiarly for internal applications.  Consider using Maven for dependency management, it makes life a lot easier than keeping versioned JAR files inward the lib folder.

The infamous ‘ClassCast Exception’ or ‘NoClassDefFoundException’ is most of the times due to the version mismatch of 3rd political party jolt files. Make for certain yous solely parcel ane re-create of the jolt file too your construct is consistent across environments e.g. Dev, QA, UAT etc.

It's also a practiced do to kicking the bucket along configuration split upwards from binaries so that yous tin unloose same binaries across the environs e.g. promoting the same binary from UAT to Production after testing successfully.


That's all most approximately practical tips on how yous tin brand your Java application piece of cake to back upwards too maintain. These minor things tin brand large departure when it comes to developing too maintaining a real-world Java application. If yous are aspiring to acquire a solution architect or Java architect, paying attending to these details volition aid yous position your illustration frontwards to a greater extent than strongly. Influenza A virus subtype H5N1 practiced Java architect volition ensure that application is both piece of cake to maintain too support.

You tin also do practiced if yous include diverse stakeholders early on inward evolution phase e.g. back upwards team, testing team, middleware guys, Unix too infra guys, networking peoples too line of piece of work concern guys. Though, don't overwhelm alongside a lot of details coming from every direction, precisely kicking the bucket along calm too drive.

Other Java best practices article to improve code character of your Java applications:
  • 10 Java Exception Handling Best Practices (read)
  • 10 Java Multithreading too Concurrency Best Practices (click here)
  • 10 Programming best practices to cite your variables (learn)
  • 10 Tips to Avoid NullPointerException inward Java? (read)
  • 5 Method too Constructor Overloading Best Practices inward Java? (learn)
  • 10 JDBC Best Practices for Java Programmers (learn)
  • 10 Tips to follow land writing Code Comments (follow)
  • 10 Logging Best Practices Every Java Developer should follow (read)

These were approximately collections of essential best practices for Java programmers, but yous volition uncovering a lot to a greater extent than if yous explore the weblog e.g. why utilization SLF4j for logging over Log4J inward Java etc. I receive got shared a lot of minor tips too best practices which volition aid yous to write amend code inward Java. Once yous larn most them they volition kicking the bucket into the dorsum of your hear too alarm your whenever yous are writing code which violates those rules.

Further Learning
Design Pattern Library
Data Structures too Algorithms: Deep Dive Using Java
Algorithms too Data Structures - Part 1 too 2

Though these best practices volition aid yous to write amend code inward Java, they are non substitutes of practiced programming habit too essential programming best practices given inward the Clean Code yesteryear Uncle Bob Martin. If yous desire to do ane thing inward the novel yr to improve your programming, I propose yous must read the Clean Code side yesteryear side year.


Happy New Year's Day 2017 !!!


Demikianlah Artikel 10 Programming Tips To Practise Maintainable Coffee Applications

Sekianlah artikel 10 Programming Tips To Practise Maintainable Coffee Applications kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.

Anda sekarang membaca artikel 10 Programming Tips To Practise Maintainable Coffee Applications dengan alamat link https://bestlearningjava.blogspot.com/2017/06/10-programming-tips-to-practise.html

Belum ada Komentar untuk "10 Programming Tips To Practise Maintainable Coffee Applications"

Posting Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel